Make "LOGIN" and "CLASS" columns width scale properly instead of wasting space.
This commit is contained in:
parent
c6b2aa689a
commit
3bf92decd3
@ -75,6 +75,8 @@ void runame(KINFO *, VARENT *);
|
||||
void rvar(KINFO *, VARENT *);
|
||||
int s_comm(KINFO *);
|
||||
int s_label(KINFO *);
|
||||
int s_loginclass(KINFO *);
|
||||
int s_logname(KINFO *);
|
||||
int s_rgroupname(KINFO *);
|
||||
int s_runame(KINFO *);
|
||||
int s_uname(KINFO *);
|
||||
|
@ -79,8 +79,8 @@ static VAR var[] = {
|
||||
CHAR, NULL, 0},
|
||||
{"blocked", "", "sigmask", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"caught", "", "sigcatch", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"class", "CLASS", NULL, LJUST, loginclass, NULL, MAXLOGNAME-1, 0,
|
||||
CHAR, NULL, 0},
|
||||
{"class", "CLASS", NULL, LJUST|DSIZ, loginclass, s_loginclass,
|
||||
MAXLOGNAME-1, 0, CHAR, NULL, 0},
|
||||
{"comm", "COMMAND", NULL, LJUST|DSIZ, ucomm, s_comm,
|
||||
COMMLEN + OCOMMLEN + 1, 0, CHAR, NULL, 0},
|
||||
{"command", "COMMAND", NULL, COMM|LJUST|USER, command, NULL, 16, 0,
|
||||
@ -108,8 +108,8 @@ static VAR var[] = {
|
||||
{"lim", "LIM", NULL, 0, maxrss, NULL, 5, 0, CHAR, NULL, 0},
|
||||
{"lockname", "LOCK", NULL, LJUST, lockname, NULL, 6, 0, CHAR, NULL,
|
||||
0},
|
||||
{"login", "LOGIN", NULL, LJUST, logname, NULL, MAXLOGNAME-1, 0, CHAR,
|
||||
NULL, 0},
|
||||
{"login", "LOGIN", NULL, LJUST|DSIZ, logname, s_logname, MAXLOGNAME-1,
|
||||
0, CHAR, NULL, 0},
|
||||
{"logname", "", "login", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
|
||||
{"lstart", "STARTED", NULL, LJUST|USER, lstarted, NULL, 28, 0, CHAR,
|
||||
NULL, 0},
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user