Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/w Print the command in parenthesis, if kvm_getargv2(...
details: https://anonhg.NetBSD.org/src/rev/745f12dcd316
branches: trunk
changeset: 543495:745f12dcd316
user: fredb <fredb%NetBSD.org@localhost>
date: Wed Feb 26 19:01:54 2003 +0000
description:
Print the command in parenthesis, if kvm_getargv2() returns no
arguments. This lets "xterm -e command" display as "(command)".
Reviewed by christos.
diffstat:
usr.bin/w/w.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r c0f7995b927c -r 745f12dcd316 usr.bin/w/w.c
--- a/usr.bin/w/w.c Wed Feb 26 18:36:24 2003 +0000
+++ b/usr.bin/w/w.c Wed Feb 26 19:01:54 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: w.c,v 1.56 2003/02/26 15:04:10 christos Exp $ */
+/* $NetBSD: w.c,v 1.57 2003/02/26 19:01:54 fredb Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@
#if 0
static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94";
#else
-__RCSID("$NetBSD: w.c,v 1.56 2003/02/26 15:04:10 christos Exp $");
+__RCSID("$NetBSD: w.c,v 1.57 2003/02/26 19:01:54 fredb Exp $");
#endif
#endif /* not lint */
@@ -437,8 +437,16 @@
goto nothing;
left = argwidth;
argv = kvm_getargv2(kd, kp, argwidth);
- if (argv == 0)
- goto nothing;
+ if (argv == 0) {
+ if (kp->p_comm == 0) {
+ goto nothing;
+ } else {
+ fmt_putc('(', &left);
+ fmt_puts((char *)kp->p_comm, &left);
+ fmt_putc(')', &left);
+ return;
+ }
+ }
while (*argv) {
fmt_puts(*argv, &left);
argv++;
Home |
Main Index |
Thread Index |
Old Index