Tests for EOF returned by stdio routines need the full int width.

This commit is contained in:
keie 1985-01-21 23:53:41 +00:00
parent 682e5d9b8a
commit d4a597912f

View file

@ -6,14 +6,14 @@
_readln() _readln()
{ {
char c; register int c;
while( (c=fgetc(_chanrd)) != EOF && c!= '\n') while( (c=fgetc(_chanrd)) != EOF && c!= '\n')
; ;
} }
readskip() readskip()
{ {
char c; register int c;
#ifdef DEBUG #ifdef DEBUG
printf("readskip\n"); printf("readskip\n");
#endif #endif
@ -73,6 +73,7 @@ _readstr(s)
String **s; String **s;
{ {
char buffer[1024]; char buffer[1024];
register int kar ;
char *c; char *c;
#ifdef DEBUG #ifdef DEBUG
@ -80,17 +81,18 @@ String **s;
#endif #endif
_asschn(); _asschn();
c= buffer; c= buffer;
*c= fgetc(_chanrd); kar= fgetc(_chanrd);
while(isspace(*c) && *c!= EOF) while(isspace(kar) && kar!= EOF)
*c= fgetc(_chanrd); kar= fgetc(_chanrd);
if( *c== '"') *c=kar ;
if( kar== '"')
{ {
/* read quoted string */ /* read quoted string */
#ifdef DEBUG #ifdef DEBUG
printf("qouted string\n"); printf("qouted string\n");
#endif #endif
while( (*c= fgetc(_chanrd)) != '"' && *c!= EOF ) c++; while ( (kar= fgetc(_chanrd)) != EOF && kar!='"' ) *c++ = kar ;
ungetc(*c,_chanrd); ungetc(kar,_chanrd);
*c=0; *c=0;
}else }else
if( isalpha(*c)) if( isalpha(*c))
@ -100,10 +102,10 @@ String **s;
#ifdef DEBUG #ifdef DEBUG
printf("non-qouted string\n"); printf("non-qouted string\n");
#endif #endif
while( (*c= fgetc(_chanrd)) != ',' && *c!= EOF && while( (kar= fgetc(_chanrd)) != ',' && kar!= EOF &&
!isspace(*c) && *c!='\n') !isspace(kar) && kar!='\n')
c++; *c++= kar ;
ungetc(*c,_chanrd); ungetc(kar,_chanrd);
*c=0; *c=0;
}else{ }else{
if( ferror(_chanrd)) error(29); if( ferror(_chanrd)) error(29);