summaryrefslogtreecommitdiffstats
path: root/usr.bin/m4/eval.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2002-04-17 17:26:32 +0000
committerjmallett <jmallett@FreeBSD.org>2002-04-17 17:26:32 +0000
commit116615d3b6f71cba30abbab2209f6de4932ce179 (patch)
treef15399016c5f676e5ad2cd82d618f2460c8d601e /usr.bin/m4/eval.c
parent217b7e94cc85bc1c09a4dfebfe0d9656ebc8c6f1 (diff)
downloadFreeBSD-src-116615d3b6f71cba30abbab2209f6de4932ce179.zip
FreeBSD-src-116615d3b6f71cba30abbab2209f6de4932ce179.tar.gz
This adds support for -s to the m4(1) utility, which causes #line directives
to be emitted as per the C preprocessor. It updates the manual page in regards to standards accordingly. PR: standards/36075 Submitted by: tjr Reviewed by: mike MFC after: 1 week
Diffstat (limited to 'usr.bin/m4/eval.c')
-rw-r--r--usr.bin/m4/eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
index ced63cd..81eeb18 100644
--- a/usr.bin/m4/eval.c
+++ b/usr.bin/m4/eval.c
@@ -584,7 +584,11 @@ char *ifile;
errx(1, "too many include files");
if ((infile[ilevel + 1] = fopen(ifile, "r")) != NULL) {
ilevel++;
+ if ((inname[ilevel] = strdup(ifile)) == NULL)
+ err(1, NULL);
+ inlineno[ilevel] = 1;
bbase[ilevel] = bufbase = bp;
+ emitline();
return (1);
}
else
@@ -604,9 +608,11 @@ char *pfile;
register int c;
if ((pf = fopen(pfile, "r")) != NULL) {
+ fprintf(active, "#line 1 \"%s\"\n", pfile);
while ((c = getc(pf)) != EOF)
putc(c, active);
(void) fclose(pf);
+ emitline();
return (1);
}
else
OpenPOWER on IntegriCloud