SCCS-vsn: bin/sh/show.c 5.2
-static char sccsid[] = "@(#)show.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)show.c 5.2 (Berkeley) %G%";
#endif /* not lint */
#include <stdio.h>
#endif /* not lint */
#include <stdio.h>
+#if DEBUG == 2
+int debug = 1;
+#else
+int debug = 0;
+#endif
- if ((p = getenv("HOME")) == NULL)
- p = "/tmp";
+ if (!debug)
+ return;
+ if ((p = getenv("HOME")) == NULL) {
+ if (getuid() == 0)
+ p = "/";
+ else
+ p = "/tmp";
+ }
scopy(p, s);
strcat(s, "/trace");
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s\n", s);
scopy(p, s);
strcat(s, "/trace");
if ((tracefile = fopen(s, "a")) == NULL) {
fprintf(stderr, "Can't open %s\n", s);
}
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
}
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)