18 |
|
|
19 |
|
|
20 |
|
char * |
21 |
< |
fgetline(s, n, fp) /* read in line with escapes, elide final newline */ |
22 |
< |
char *s; |
23 |
< |
int n; |
24 |
< |
register FILE *fp; |
21 |
> |
fgetline( /* read in line with escapes, elide final newline */ |
22 |
> |
char *s, |
23 |
> |
int n, |
24 |
> |
FILE *fp |
25 |
> |
) |
26 |
|
{ |
27 |
< |
register char *cp = s; |
28 |
< |
register int c = EOF; |
27 |
> |
char *cp = s; |
28 |
> |
int c = EOF; |
29 |
|
|
30 |
|
while (--n > 0 && (c = getc(fp)) != EOF) { |
31 |
|
if (c == '\r' && (c = getc(fp)) != '\n') { |
36 |
|
break; |
37 |
|
*cp++ = c; |
38 |
|
} |
39 |
< |
if (cp == s && c == EOF) |
39 |
> |
if ((cp == s) & (c == EOF)) |
40 |
|
return(NULL); |
41 |
|
*cp = '\0'; |
42 |
|
return(s); |