304 |
|
if (fgets(mg_file->inpline+len, |
305 |
|
MG_MAXLINE-len, mg_file->fp) == NULL) |
306 |
|
return(len); |
307 |
– |
mg_file->lineno++; |
307 |
|
len += strlen(mg_file->inpline+len); |
308 |
< |
if (len > 1 && mg_file->inpline[len-2] == '\\') |
309 |
< |
mg_file->inpline[--len-1] = ' '; |
310 |
< |
} while (mg_file->inpline[len]); |
308 |
> |
if (len >= MG_MAXLINE-1) |
309 |
> |
return(len); |
310 |
> |
mg_file->lineno++; |
311 |
> |
} while (len > 1 && mg_file->inpline[len-2] == '\\'); |
312 |
|
|
313 |
|
return(len); |
314 |
|
} |
320 |
|
char abuf[MG_MAXLINE]; |
321 |
|
char *argv[MG_MAXARGC]; |
322 |
|
int en; |
323 |
< |
register char *cp, **ap; |
324 |
< |
|
325 |
< |
strcpy(cp=abuf, mg_file->inpline); |
326 |
< |
ap = argv; /* break into words */ |
323 |
> |
register char *cp, *cp2, **ap; |
324 |
> |
/* copy line, removing escape chars */ |
325 |
> |
cp = abuf; cp2 = mg_file->inpline; |
326 |
> |
while ((*cp++ = *cp2++)) |
327 |
> |
if (cp2[0] == '\n' && cp2[-1] == '\\') |
328 |
> |
cp--; |
329 |
> |
cp = abuf; ap = argv; /* break into words */ |
330 |
|
for ( ; ; ) { |
331 |
|
while (isspace(*cp)) |
332 |
|
*cp++ = '\0'; |
359 |
|
return(rval); |
360 |
|
} |
361 |
|
while ((nbr = mg_read()) > 0) { /* parse each line */ |
362 |
< |
if (nbr >= MG_MAXLINE-1 && cntxt.inpline[nbr-1] != '\n') { |
362 |
> |
if (nbr >= MG_MAXLINE-1) { |
363 |
|
fprintf(stderr, "%s: %d: %s\n", cntxt.fname, |
364 |
|
cntxt.lineno, mg_err[rval=MG_ELINE]); |
365 |
|
break; |
438 |
|
} |
439 |
|
do { |
440 |
|
while ((rv = mg_read()) > 0) { |
441 |
< |
if (rv >= MG_MAXLINE-1 && ictx.inpline[rv-1] != '\n') { |
441 |
> |
if (rv >= MG_MAXLINE-1) { |
442 |
|
fprintf(stderr, "%s: %d: %s\n", ictx.fname, |
443 |
|
ictx.lineno, mg_err[MG_ELINE]); |
444 |
|
mg_close(); |