diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-09-27 11:40:34 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-09-27 11:40:34 +0000 |
commit | 075e3957eaedc259ec5ceda71fbc399ebb27f739 (patch) | |
tree | fbdfcadefcc6bcccd57925fcf5860c288ddb76ce /usr.bin/m4/eval.c | |
parent | 37bf947e8d7999f07e2efca7fba6082b5a75f630 (diff) |
traceon/traceoff built-ins.
Diffstat (limited to 'usr.bin/m4/eval.c')
-rw-r--r-- | usr.bin/m4/eval.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 868621d2d57..36f70ee4d6a 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.36 2001/09/19 13:14:18 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.37 2001/09/27 11:40:33 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.36 2001/09/19 13:14:18 espie Exp $"; +static char rcsid[] = "$OpenBSD: eval.c,v 1.37 2001/09/27 11:40:33 espie Exp $"; #endif #endif /* not lint */ @@ -70,6 +70,7 @@ static char rcsid[] = "$OpenBSD: eval.c,v 1.36 2001/09/19 13:14:18 espie Exp $"; static void dodefn __P((const char *)); static void dopushdef __P((const char *, const char *)); static void dodump __P((const char *[], int)); +static void dotrace __P((const char *[], int, int)); static void doifelse __P((const char *[], int)); static int doincl __P((const char *)); static int dopaste __P((const char *)); @@ -169,6 +170,14 @@ expand_builtin(argv, argc, td) dodump(argv, argc); break; + case TRACEONTYPE: + dotrace(argv, argc, 1); + break; + + case TRACEOFFTYPE: + dotrace(argv, argc, 0); + break; + case EXPRTYPE: /* * doexpr - evaluate arithmetic @@ -676,6 +685,24 @@ dodump(argv, argc) } /* + * dotrace - mark some macros as traced/untraced depending upon on. + */ +static void +dotrace(argv, argc, on) + const char *argv[]; + int argc; + int on; +{ + int n; + + if (argc > 2) { + for (n = 2; n < argc; n++) + mark_traced(argv[n], on); + } else + mark_traced(NULL, on); +} + +/* * doifelse - select one of two alternatives - loop. */ static void |