diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-11-30 22:24:21 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-11-30 22:24:21 +0000 |
commit | 993907b3a2389f35311cb86369d32a7a10ec74ff (patch) | |
tree | 9cd770766e0cfc0b171f3d6b599eafa5837bb7c8 /usr.bin/m4/main.c | |
parent | 7aad3d32d1df2773dc37f5b2763f3b9e206f8b5c (diff) |
Recognizes comments while parsing macros arguments, as every other
m4 implementation does (including DEC/OSF, Solaris, HP/UX, Aix,
and gnu-m4).
Checked with millert@.
Diffstat (limited to 'usr.bin/m4/main.c')
-rw-r--r-- | usr.bin/m4/main.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c index 6bc389a9bd2..543d09b1cd7 100644 --- a/usr.bin/m4/main.c +++ b/usr.bin/m4/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.21 1999/11/30 22:19:50 espie Exp $ */ +/* $OpenBSD: main.c,v 1.22 1999/11/30 22:24:20 espie Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.21 1999/11/30 22:19:50 espie Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.22 1999/11/30 22:24:20 espie Exp $"; #endif #endif /* not lint */ @@ -417,7 +417,23 @@ macro() break; default: - chrsave(t); /* stack the char */ + if (LOOK_AHEAD(t, scommt)) { + char *p; + for (p = scommt; *p; p++) + chrsave(*p); + for(;;) { + t = gpbc(); + if (LOOK_AHEAD(t, ecommt)) { + for (p = ecommt; *p; p++) + chrsave(*p); + break; + } + if (t == EOF) + break; + chrsave(t); + } + } else + chrsave(t); /* stack the char */ break; } } |