348 |
|
char *fn; |
349 |
|
{ |
350 |
|
MG_FCTXT cntxt; |
351 |
< |
int rval; |
351 |
> |
register int rval; |
352 |
|
|
353 |
|
if ((rval = mg_open(&cntxt, fn)) != MG_OK) { |
354 |
|
fprintf(stderr, "%s: %s\n", fn, mg_err[rval]); |
355 |
|
return(rval); |
356 |
|
} |
357 |
< |
while (mg_read()) /* parse each line */ |
357 |
> |
while ((rval = mg_read()) > 0) { /* parse each line */ |
358 |
> |
if (rval >= MG_MAXLINE-1 && cntxt.inpline[rval-1] != '\n') { |
359 |
> |
fprintf(stderr, "%s: %d: %s\n", cntxt.fname, |
360 |
> |
cntxt.lineno, mg_err[rval=MG_ELINE]); |
361 |
> |
break; |
362 |
> |
} |
363 |
|
if ((rval = mg_parse()) != MG_OK) { |
364 |
|
fprintf(stderr, "%s: %d: %s:\n%s", cntxt.fname, |
365 |
|
cntxt.lineno, mg_err[rval], |
366 |
|
cntxt.inpline); |
367 |
|
break; |
368 |
|
} |
369 |
+ |
} |
370 |
|
mg_close(); |
371 |
|
return(rval); |
372 |
|
} |
414 |
|
char *xfarg[MG_MAXARGC]; |
415 |
|
MG_FCTXT ictx; |
416 |
|
XF_SPEC *xf_orig = xf_context; |
417 |
< |
int rv; |
417 |
> |
register int rv; |
418 |
|
|
419 |
|
if (ac < 2) |
420 |
|
return(MG_EARGC); |
431 |
|
return(rv); |
432 |
|
} |
433 |
|
do { |
434 |
< |
while (mg_read()) |
434 |
> |
while ((rv = mg_read()) > 0) { |
435 |
> |
if (rv >= MG_MAXLINE-1 && ictx.inpline[rv-1] != '\n') { |
436 |
> |
fprintf(stderr, "%s: %d: %s\n", ictx.fname, |
437 |
> |
ictx.lineno, mg_err[MG_ELINE]); |
438 |
> |
mg_close(); |
439 |
> |
return(MG_EINCL); |
440 |
> |
} |
441 |
|
if ((rv = mg_parse()) != MG_OK) { |
442 |
|
fprintf(stderr, "%s: %d: %s:\n%s", ictx.fname, |
443 |
|
ictx.lineno, mg_err[rv], |
445 |
|
mg_close(); |
446 |
|
return(MG_EINCL); |
447 |
|
} |
448 |
+ |
} |
449 |
|
if (ac > 2) |
450 |
|
if ((rv = mg_handle(MG_E_XF, 1, xfarg)) != MG_OK) |
451 |
|
return(rv); |