Mirror of git://git.busybox.net/busybox with our patches on top
Source
len = printf("%5d %-8s %6ld %s ", p->pid, p->user, p->rss, p->state);
/* vi: set sw=4 ts=4: */
/*
* Mini ps implementation(s) for busybox
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Licensed under the GPL v2, see the file LICENSE in this tarball.
*/
/* for is_selinux_enabled() */
int ps_main(int argc, char **argv)
{
procps_status_t * p;
int i, len;
int use_selinux = 0;
security_context_t sid=NULL;
int terminal_width;
int w_count = 0;
bb_opt_complementally="-:ww";
/* handle arguments */
i = bb_getopt_ulflags(argc, argv, "wc", &w_count);
bb_getopt_ulflags(argc, argv, "w", &w_count);
/* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */
i = bb_getopt_ulflags(argc, argv, "c");
/* if w is given once, GNU ps sets the width to 132,
* if w is given more than once, it is "unlimited"
*/
if(w_count) {
terminal_width = (w_count==1) ? 132 : INT_MAX;
} else {
get_terminal_width_height(1, &terminal_width, NULL);
/* Go one less... */
terminal_width--;
}