aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2013-01-19 00:21:55 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2013-01-19 00:21:55 +0000
commit9f0b6e5e27c5b3ed88d15f5683d6a1809203a14d (patch)
tree3807ba187cd6f0b81b951681a312f8ec5d5649bc
parentc3a1bb32f4b4d4e3825f2f24fce77cdda8d030de (diff)
downloadsrc-9f0b6e5e27c5b3ed88d15f5683d6a1809203a14d.tar.gz
src-9f0b6e5e27c5b3ed88d15f5683d6a1809203a14d.zip
- Move 'showthreads' check out of fmt.c.
- Update shadow copy of fmt_argv() prototype in w.c and fix calls for additional parameter.
Notes
Notes: svn path=/head/; revision=245635
-rw-r--r--bin/ps/fmt.c2
-rw-r--r--bin/ps/ps.c2
-rw-r--r--usr.bin/w/w.c7
3 files changed, 5 insertions, 6 deletions
diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c
index 4d7b1209a980..4db6b8d1d33f 100644
--- a/bin/ps/fmt.c
+++ b/bin/ps/fmt.c
@@ -123,7 +123,7 @@ fmt_argv(char **argv, char *cmd, char *thread, size_t maxlen)
if (cp == NULL)
errx(1, "malloc failed");
if (ap == NULL) {
- if (showthreads && thread != NULL) {
+ if (thread != NULL) {
asprintf(&ap, "%s/%s", cmd, thread);
sprintf(cp, "[%.*s]", (int)maxlen, ap);
free(ap);
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 8a05ebc6f598..7099cc0bff6a 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1168,7 +1168,7 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki,
const char *s;
s = fmt_argv((*fn)(kd, ki->ki_p, termwidth), comm,
- ki->ki_p->ki_numthreads > 1 ? thread : NULL, maxlen);
+ showthreads && ki->ki_p->ki_numthreads > 1 ? thread : NULL, maxlen);
return (s);
}
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 5a84e86cdaca..1b9af5f0cc33 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -96,7 +96,6 @@ static int nflag; /* true if -n flag: don't convert addrs */
static int dflag; /* true if -d flag: output debug info */
static int sortidle; /* sort by idle time */
int use_ampm; /* use AM/PM time */
-int showthreads = 0;/* will threads be shown? */
static int use_comma; /* use comma as floats separator */
static char **sel_users; /* login array of particular users selected */
@@ -124,7 +123,7 @@ static struct stat *ttystat(char *);
static void usage(int);
static int this_is_uptime(const char *s);
-char *fmt_argv(char **, char *, int); /* ../../bin/ps/fmt.c */
+char *fmt_argv(char **, char *, char *, size_t); /* ../../bin/ps/fmt.c */
int
main(int argc, char *argv[])
@@ -321,7 +320,7 @@ main(int argc, char *argv[])
continue;
}
ep->args = fmt_argv(kvm_getargv(kd, ep->kp, argwidth),
- ep->kp->ki_comm, MAXCOMLEN);
+ ep->kp->ki_comm, NULL, MAXCOMLEN);
if (ep->args == NULL)
err(1, NULL);
}
@@ -405,7 +404,7 @@ main(int argc, char *argv[])
const char *ptr;
ptr = fmt_argv(kvm_getargv(kd, dkp, argwidth),
- dkp->ki_comm, MAXCOMLEN);
+ dkp->ki_comm, NULL, MAXCOMLEN);
if (ptr == NULL)
ptr = "-";
(void)printf("\t\t%-9d %s\n",