--- ray/src/common/fgetline.c 2004/09/14 02:53:50 2.7 +++ ray/src/common/fgetline.c 2014/07/09 22:46:51 2.8 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: fgetline.c,v 2.7 2004/09/14 02:53:50 greg Exp $"; +static const char RCSid[] = "$Id: fgetline.c,v 2.8 2014/07/09 22:46:51 greg Exp $"; #endif /* * fgetline.c - read line with escaped newlines. @@ -18,13 +18,14 @@ static const char RCSid[] = "$Id: fgetline.c,v 2.7 200 char * -fgetline(s, n, fp) /* read in line with escapes, elide final newline */ -char *s; -int n; -register FILE *fp; +fgetline( /* read in line with escapes, elide final newline */ + char *s, + int n, + FILE *fp +) { - register char *cp = s; - register int c = EOF; + char *cp = s; + int c = EOF; while (--n > 0 && (c = getc(fp)) != EOF) { if (c == '\r' && (c = getc(fp)) != '\n') { @@ -35,7 +36,7 @@ register FILE *fp; break; *cp++ = c; } - if (cp == s && c == EOF) + if ((cp == s) & (c == EOF)) return(NULL); *cp = '\0'; return(s);