projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix bug that can cause recursive .forward files to fail
[unix-history]
/
usr
/
src
/
bin
/
sh
/
show.c
diff --git
a/usr/src/bin/sh/show.c
b/usr/src/bin/sh/show.c
index
79a79a6
..
f11a8f6
100644
(file)
--- a/
usr/src/bin/sh/show.c
+++ b/
usr/src/bin/sh/show.c
@@
-1,6
+1,6
@@
/*-
/*-
- * Copyright (c) 1991
The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991
, 1993
+ *
The Regents of the University of California.
All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
*
* This code is derived from software contributed to Berkeley by
* Kenneth Almquist.
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)show.c
5
.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)show.c
8
.1 (Berkeley) %G%";
#endif /* not lint */
#include <stdio.h>
#endif /* not lint */
#include <stdio.h>
@@
-213,6
+213,11
@@
indent(amount, pfx, fp)
FILE *tracefile;
FILE *tracefile;
+#if DEBUG == 2
+int debug = 1;
+#else
+int debug = 0;
+#endif
trputc(c) {
trputc(c) {
@@
-319,13
+324,23
@@
opentrace() {
int flags;
#ifdef DEBUG
int flags;
#ifdef DEBUG
- if ((p = getenv("HOME")) == NULL)
- p = "/tmp";
+ if (!debug)
+ return;
+#ifdef not_this_way
+ if ((p = getenv("HOME")) == NULL) {
+ if (geteuid() == 0)
+ p = "/";
+ else
+ p = "/tmp";
+ }
scopy(p, s);
strcat(s, "/trace");
scopy(p, s);
strcat(s, "/trace");
+#else
+ scopy("./trace", s);
+#endif /* not_this_way */
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s\n", s);
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s\n", s);
-
exit(2)
;
+
return
;
}
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
}
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
@@
-333,5
+348,5
@@
opentrace() {
#endif
fputs("\nTracing started.\n", tracefile);
fflush(tracefile);
#endif
fputs("\nTracing started.\n", tracefile);
fflush(tracefile);
-#endif
+#endif
/* DEBUG */
}
}