aboutsummaryrefslogtreecommitdiff
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-10-21 07:30:26 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-10-21 07:30:26 +0000
commitdb91faacb6575b5147c6bebd0f6d13587558a2e8 (patch)
tree6da5843225e613b5eb4f4456c650f4b7576cd2de /bin/ps/print.c
parent92579404e8c58543982270d9b41600361ba0b0fd (diff)
downloadsrc-db91faacb6575b5147c6bebd0f6d13587558a2e8.tar.gz
src-db91faacb6575b5147c6bebd0f6d13587558a2e8.zip
Implement a -c option to ps to display the short command name instead of
the full argument vector. I've bumped into a few things that expected this switch to be present, the most recent was the snmp package in ports. I'm not 100% sure of the origins of this, but Linux has it, so does the "BSD-compatable" version of ps on our SVR4 systems (so I assume SunOS has it too).
Notes
Notes: svn path=/head/; revision=19068
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 5c01f302af74..0d5a09ff74a1 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: print.c,v 1.14 1996/06/29 08:04:05 peter Exp $
+ * $Id: print.c,v 1.15 1996/06/29 10:25:31 peter Exp $
*/
#ifndef lint
@@ -100,6 +100,13 @@ command(k, ve)
int left;
char *cp, *vis_env, *vis_args;
+ v = ve->var;
+
+ if (cflag) {
+ (void)printf("%-*s", v->width, KI_PROC(k)->p_comm);
+ return;
+ }
+
if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
err(1, NULL);
strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH);
@@ -110,7 +117,6 @@ command(k, ve)
} else
vis_env = NULL;
- v = ve->var;
if (ve->next == NULL) {
/* last field */
if (termwidth == UNLIMITED) {