summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>1999-11-30 22:24:20 +0000
committerespie <espie@openbsd.org>1999-11-30 22:24:20 +0000
commitb768b8e1a1050d5e65a09667b97d73ce67212b7e (patch)
treeb3b18455c6a3d1543ce9ee2268e48a1ace49a5be
parentClean up comment/quote recognition a little bit: (diff)
downloadwireguard-openbsd-b768b8e1a1050d5e65a09667b97d73ce67212b7e.tar.xz
wireguard-openbsd-b768b8e1a1050d5e65a09667b97d73ce67212b7e.zip
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@.
-rw-r--r--usr.bin/m4/main.c22
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;
}
}