diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-01-21 19:11:03 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-01-21 19:11:03 +0000 |
commit | 624370dbede1e39a6fb23dd0a906d383b3f0eb03 (patch) | |
tree | d7ae53f8100639751d82c3bc4ff6f582c477c313 | |
parent | 1df4c703e39363bec334e809d0a39a297ceceec2 (diff) |
more portable code, stderr is not necessarily a constant.
-rw-r--r-- | usr.bin/m4/eval.c | 6 | ||||
-rw-r--r-- | usr.bin/m4/trace.c | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 4ca9992832d..34d8a4e6b10 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.52 2005/01/20 23:47:04 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.53 2005/01/21 19:11:02 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: eval.c,v 1.52 2005/01/20 23:47:04 espie Exp $"; +static char rcsid[] = "$OpenBSD: eval.c,v 1.53 2005/01/21 19:11:02 espie Exp $"; #endif #endif /* not lint */ @@ -614,6 +614,8 @@ dopushdef(const char *name, const char *defn) static void dump_one_def(const char *name, struct macro_definition *p) { + if (!traceout) + traceout = stderr; if (mimic_gnu) { if ((p->type & TYPEMASK) == MACRTYPE) fprintf(traceout, "%s:\t%s\n", name, p->defn); diff --git a/usr.bin/m4/trace.c b/usr.bin/m4/trace.c index 8338db2b91b..b96e7c7af4b 100644 --- a/usr.bin/m4/trace.c +++ b/usr.bin/m4/trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trace.c,v 1.11 2005/01/20 23:47:04 espie Exp $ */ +/* $OpenBSD: trace.c,v 1.12 2005/01/21 19:11:02 espie Exp $ */ /* * Copyright (c) 2001 Marc Espie. * @@ -33,7 +33,7 @@ #include "stdd.h" #include "extern.h" -FILE *traceout = stderr; +FILE *traceout; #define TRACE_ARGS 1 #define TRACE_EXPANSION 2 @@ -56,7 +56,7 @@ void trace_file(const char *name) { - if (traceout != stderr) + if (traceout && traceout != stderr) fclose(traceout); traceout = fopen(name, "w"); if (!traceout) @@ -145,6 +145,8 @@ print_header(struct input_file *inp) ssize_t trace(const char *argv[], int argc, struct input_file *inp) { + if (!traceout) + traceout = stderr; print_header(inp); if (trace_flags & TRACE_CONT) { fprintf(traceout, "%s ...\n", argv[1]); |