summaryrefslogtreecommitdiff
path: root/bin/ps/ps.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r--bin/ps/ps.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 53aa66d00f2..cfa15f804fe 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.44 2007/12/28 19:17:28 chl Exp $ */
+/* $OpenBSD: ps.c,v 1.45 2008/03/08 19:20:12 millert Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.44 2007/12/28 19:17:28 chl Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.45 2008/03/08 19:20:12 millert Exp $";
#endif
#endif /* not lint */
@@ -82,7 +82,7 @@ int totwidth; /* calculated width of requested variables */
int ncpu = 1;
-int needcomm, needenv, commandonly;
+int needcomm, needenv, neednlist, commandonly;
enum sort { DEFAULT, SORTMEM, SORTCPU } sortby = DEFAULT;
@@ -295,6 +295,10 @@ main(int argc, char *argv[])
* and adjusting header widths as appropriate.
*/
scanvars();
+
+ if (neednlist && !nlistread)
+ (void) donlist();
+
/*
* get proc list
*/
@@ -403,6 +407,8 @@ scanvars(void)
totwidth += v->width + 1; /* +1 for space */
if (v->flag & COMM)
needcomm = 1;
+ if (v->flag & NLIST)
+ neednlist = 1;
}
totwidth--;
}