From 2f15e29fadc2bc35285820205ae7ff94f2d19be8 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 28 Apr 2002 14:37:13 +0000 Subject: 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@ --- usr.bin/m4/eval.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.bin/m4/eval.c') 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); -- cgit v1.2.3