diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-12-29 17:13:56 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-12-29 17:13:56 +0000 |
commit | ca6e8a65a743155f0952eff98ff5bf1f28e4572d (patch) | |
tree | cb5865fcd771013bcc7b9fe21e017b7d240a9572 /bin/ps | |
parent | 9a7af7ec309e1b8bc76d267187bcc3a827a20c9b (diff) |
Suppress the header line if all the field headers have been set to empty.
ok millert@
Diffstat (limited to 'bin/ps')
-rw-r--r-- | bin/ps/extern.h | 4 | ||||
-rw-r--r-- | bin/ps/keyword.c | 5 | ||||
-rw-r--r-- | bin/ps/print.c | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h index cc43314d707..3ffd723a89f 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.15 2011/12/11 00:16:49 nicm Exp $ */ +/* $OpenBSD: extern.h,v 1.16 2011/12/29 17:13:55 guenther Exp $ */ /* $NetBSD: extern.h,v 1.10 1995/05/21 13:38:27 mycroft Exp $ */ /*- @@ -39,7 +39,7 @@ struct varent; extern fixpt_t ccpu; extern int eval, fscale, nlistread, rawcpu, maxslp; extern u_int mempages; -extern int sumrusage, termwidth, totwidth, kvm_sysctl_only; +extern int sumrusage, termwidth, totwidth, kvm_sysctl_only, needheader; extern VAR var[]; extern VARENT *vhead; diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 4653db0b790..9a6457b6772 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keyword.c,v 1.33 2011/12/11 00:16:49 nicm Exp $ */ +/* $OpenBSD: keyword.c,v 1.34 2011/12/29 17:13:55 guenther Exp $ */ /* $NetBSD: keyword.c,v 1.12.6.1 1996/05/30 21:25:13 cgd Exp $ */ /*- @@ -47,6 +47,8 @@ #include <sys/ucred.h> #include <sys/sysctl.h> +int needheader; + static VAR *findvar(char *); static int vcmp(const void *, const void *); @@ -227,6 +229,7 @@ parsefmt(char *p) vtail->next = vent; vtail = vent; } + needheader |= v->header[0] != '\0'; } if (!vhead) errx(1, "no valid keywords"); diff --git a/bin/ps/print.c b/bin/ps/print.c index 2c3b84f19fd..1f0000efb60 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.51 2011/12/11 00:16:49 nicm Exp $ */ +/* $OpenBSD: print.c,v 1.52 2011/12/29 17:13:55 guenther Exp $ */ /* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */ /*- @@ -76,6 +76,8 @@ printheader(void) VAR *v; struct varent *vent; + if (!needheader) + return; for (vent = vhead; vent; vent = vent->next) { v = vent->var; if (v->flag & LJUST) { |