210 |
|
{ |
211 |
|
int rtotal = 0; |
212 |
|
char buf[MAXLINE]; |
213 |
+ |
int firstc = fgetc(fp); |
214 |
|
|
215 |
+ |
if (!isprint(firstc)) |
216 |
+ |
return(-1); /* messed up */ |
217 |
+ |
ungetc(firstc, fp); |
218 |
|
for ( ; ; ) { |
219 |
|
int rval = 0; |
220 |
|
buf[MAXLINE-2] = '\n'; |
221 |
|
if (fgets(buf, MAXLINE, fp) == NULL) |
222 |
|
return(-1); |
223 |
< |
if (buf[buf[0]=='\r'] == '\n') |
223 |
> |
if (buf[buf[0]=='\r'] == '\n') /* end of header? */ |
224 |
|
return(rtotal); |
225 |
|
if (buf[MAXLINE-2] != '\n') { |
226 |
|
ungetc(buf[MAXLINE-2], fp); /* prevent false end */ |
245 |
|
void *cp |
246 |
|
) |
247 |
|
{ |
248 |
< |
if (!formatval(((struct check*)cp)->fs, s) |
249 |
< |
&& ((struct check*)cp)->fp != NULL) { |
250 |
< |
fputs(s, ((struct check*)cp)->fp); |
251 |
< |
} |
248 |
> |
struct check *scp = (struct check *)cp; |
249 |
> |
|
250 |
> |
if (!formatval(scp->fs, s) && scp->fp != NULL) |
251 |
> |
fputs(s, scp->fp); |
252 |
> |
|
253 |
|
return(0); |
254 |
|
} |
255 |
|
|