summaryrefslogtreecommitdiff
path: root/usr.bin/m4/eval.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2002-04-28 14:37:13 +0000
committerMarc Espie <espie@cvs.openbsd.org>2002-04-28 14:37:13 +0000
commit2f15e29fadc2bc35285820205ae7ff94f2d19be8 (patch)
tree77ba7576a9503cf0fede4d33937d28f1badeb600 /usr.bin/m4/eval.c
parent46b4ea21951a8b60d15104c3a547e37ce9d1ad07 (diff)
Implement -s.
Triggered by recent FreeBSD changes. - emits #line directives at every file change (like FreeBSD) - maintains a synch_lineno variable to verify when the output gets out of synch with the input, so that it can emit #line to re-synch as well (unlike FreeBSD) To do: either handle \end-of-line, or recognize when a macro expansion is in progress, so that line synch don't perturb cpp on multi-line expansions. With this, we should have a fully POSIX-compliant m4. ok miod@
Diffstat (limited to 'usr.bin/m4/eval.c')
-rw-r--r--usr.bin/m4/eval.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c
index 5af3c8774c4..951863936a4 100644
--- a/usr.bin/m4/eval.c
+++ b/usr.bin/m4/eval.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $ */
+/* $OpenBSD: eval.c,v 1.45 2002/04/28 14:37:12 espie Exp $ */
/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $";
+static char rcsid[] = "$OpenBSD: eval.c,v 1.45 2002/04/28 14:37:12 espie Exp $";
#endif
#endif /* not lint */
@@ -753,9 +753,12 @@ dopaste(const char *pfile)
int c;
if ((pf = fopen(pfile, "r")) != NULL) {
+ if (synch_lines)
+ fprintf(active, "#line 1 \"%s\"\n", pfile);
while ((c = getc(pf)) != EOF)
putc(c, active);
(void) fclose(pf);
+ emit_synchline();
return (1);
} else
return (0);