Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jan 2013 00:21:55 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245635 - in head: bin/ps usr.bin/w
Message-ID:  <201301190021.r0J0Lt4j002672@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat Jan 19 00:21:55 2013
New Revision: 245635
URL: http://svnweb.freebsd.org/changeset/base/245635

Log:
  - Move 'showthreads' check out of fmt.c.
  - Update shadow copy of fmt_argv() prototype in w.c and fix calls for
    additional parameter.

Modified:
  head/bin/ps/fmt.c
  head/bin/ps/ps.c
  head/usr.bin/w/w.c

Modified: head/bin/ps/fmt.c
==============================================================================
--- head/bin/ps/fmt.c	Fri Jan 18 23:59:22 2013	(r245634)
+++ head/bin/ps/fmt.c	Sat Jan 19 00:21:55 2013	(r245635)
@@ -123,7 +123,7 @@ fmt_argv(char **argv, char *cmd, char *t
 	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);

Modified: head/bin/ps/ps.c
==============================================================================
--- head/bin/ps/ps.c	Fri Jan 18 23:59:22 2013	(r245634)
+++ head/bin/ps/ps.c	Sat Jan 19 00:21:55 2013	(r245635)
@@ -1168,7 +1168,7 @@ fmt(char **(*fn)(kvm_t *, const struct k
 	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);
 }
 

Modified: head/usr.bin/w/w.c
==============================================================================
--- head/usr.bin/w/w.c	Fri Jan 18 23:59:22 2013	(r245634)
+++ head/usr.bin/w/w.c	Sat Jan 19 00:21:55 2013	(r245635)
@@ -96,7 +96,6 @@ static int	nflag;		/* true if -n flag: d
 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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301190021.r0J0Lt4j002672>