summaryrefslogtreecommitdiff
path: root/usr.bin/w/w.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-01-16 17:50:44 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-01-16 17:50:44 +0000
commitac09fd03216443f5ff3ce61c30d37983ae6aff1c (patch)
tree28328083940debb1e4d07e3a6149f11de3d63448 /usr.bin/w/w.c
parent639342ea49499245c09b966f9b7e1455df232f42 (diff)
Add rcsid tags.
If program has set argv[0] or argv[0][0] to NUL, print p->p_comm instead. Based on patch from Paul Janzen <pjanzen@foatdi.harvard.edu>
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r--usr.bin/w/w.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index eb97475cc59..0b88efe5ac7 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.22 1997/12/24 19:57:11 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.23 1998/01/16 17:50:43 millert Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -40,7 +40,11 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
+#else
+static char *rcsid = "$OpenBSD: w.c,v 1.23 1998/01/16 17:50:43 millert Exp $";
+#endif
#endif /* not lint */
/*
@@ -345,13 +349,19 @@ pr_args(kp)
char **argv, *str;
int left;
- if (kp == 0)
+ if (kp == NULL)
goto nothing;
left = argwidth;
argv = kvm_getargv(kd, kp, argwidth+60); /*+60 for ftpd snip */
- if (argv == 0)
+ if (argv == NULL)
goto nothing;
+ if (*argv == NULL || **argv == '\0') {
+ /* Process has zeroed argv[0], display executable name. */
+ fmt_putc('(', &left);
+ fmt_puts(kp->kp_proc.p_comm, &left);
+ fmt_putc(')', &left);
+ }
while (*argv) {
/* ftp is a special case... */
if (strncmp(*argv, "ftpd:", 5) == 0) {