Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / libcc.ansi / misc / getw.c
1 /*
2  * getw - read a word from a stream
3  */
4 /* $Id: getw.c,v 1.2 1994/06/24 11:45:24 ceriel Exp $ */
5
6 #include        <stdio.h>
7
8 int getw(register FILE *stream)
9 {
10         register int cnt = sizeof(int);
11         int w;
12         register char *p = (char *) &w;
13
14         while (cnt--) {
15                 *p++ = getc(stream);
16         }
17         if (feof(stream) || ferror(stream)) return EOF;
18         return w;
19 }