summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-03-24 17:20:24 +0000
committertrasz <trasz@FreeBSD.org>2011-03-24 17:20:24 +0000
commit7a8bd43974c3b65965d0a1661898bf7a3f1ff052 (patch)
tree980af12c457ea8c63e75a33eb60c2b8270f7a7a4 /bin/ps/print.c
parent6e5f09a2229c3dafda3b8dd3581af91e48db5919 (diff)
downloadFreeBSD-src-7a8bd43974c3b65965d0a1661898bf7a3f1ff052.zip
FreeBSD-src-7a8bd43974c3b65965d0a1661898bf7a3f1ff052.tar.gz
Make "LOGIN" and "CLASS" columns width scale properly instead of wasting space.
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 253793a..0c97030 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -908,7 +908,7 @@ loginclass(KINFO *k, VARENT *ve)
* and limits don't apply to system processes.
*/
if (k->ki_p->ki_flag & P_SYSTEM) {
- (void)printf("%-*s", v->width, " -");
+ (void)printf("%-*s", v->width, "-");
return;
}
s = k->ki_p->ki_loginclass;
@@ -948,3 +948,30 @@ s_label(KINFO *k)
mac_free(proclabel);
return (size);
}
+
+int
+s_loginclass(KINFO *k)
+{
+ char *s;
+
+ if (k->ki_p->ki_flag & P_SYSTEM)
+ return (1);
+
+ s = k->ki_p->ki_loginclass;
+ if (s == NULL)
+ return (1);
+
+ return (strlen(s));
+}
+
+int
+s_logname(KINFO *k)
+{
+ char *s;
+
+ s = k->ki_p->ki_login;
+ if (s == NULL)
+ return (1);
+
+ return (strlen(s));
+}
OpenPOWER on IntegriCloud