diff options
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r-- | bin/ps/print.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index c54df4beba9e..3ae37fc1607c 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -177,6 +177,7 @@ command(KINFO *k, VARENT *ve) void ucomm(KINFO *k, VARENT *ve) { + char tmpbuff[COMMLEN + OCOMMLEN + 2]; VAR *v; v = ve->var; @@ -184,8 +185,15 @@ ucomm(KINFO *k, VARENT *ve) (void)printf("%s", k->ki_p->ki_comm); if (showthreads && k->ki_p->ki_numthreads > 1) printf("/%s", k->ki_p->ki_ocomm); - } else - (void)printf("%-*s", v->width, k->ki_p->ki_comm); + } else { + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + (void)printf("%-*s", v->width, tmpbuff); + } } void @@ -821,6 +829,20 @@ out: } int +s_comm(KINFO *k) +{ + char tmpbuff[COMMLEN + OCOMMLEN + 2]; + + bzero(tmpbuff, sizeof(tmpbuff)); + if (showthreads && k->ki_p->ki_numthreads > 1) + sprintf(tmpbuff, "%s/%s", k->ki_p->ki_comm, + k->ki_p->ki_ocomm); + else + sprintf(tmpbuff, "%s", k->ki_p->ki_comm); + return (strlen(tmpbuff)); +} + +int s_label(KINFO *k) { char *string = NULL; |