diff options
author | "Vladimir N. Oleynik" | 2005-10-05 10:52:47 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" | 2005-10-05 10:52:47 +0000 |
commit | 35939d93783230998439848b2798865c598723e2 (patch) | |
tree | 188f195a595c4f494fdc1d8d27da67a2e5b42b5d /procps/ps.c | |
parent | 7abe7098676aeb0654ef0159f589484b4cf520e8 (diff) | |
download | busybox-35939d93783230998439848b2798865c598723e2.zip busybox-35939d93783230998439848b2798865c598723e2.tar.gz |
update bb_getopt_ulflags special for 'ps' applet, usaging '-' as first group char from bb_opt_complementally is new feature: set argv is options;
use new bb_getopt_ulflags for ps
# define terminal_width 80->79 for unwide
use stdout file descriptor for get_terminal_width_height. (its must)
Diffstat (limited to 'procps/ps.c')
-rw-r--r-- | procps/ps.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/procps/ps.c b/procps/ps.c index 6b5a4a9..b423b06 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -26,16 +26,19 @@ extern int ps_main(int argc, char **argv) { procps_status_t * p; int i, len; + #if ENABLE_SELINUX int use_selinux = 0; security_context_t sid=NULL; #endif + #if ENABLE_FEATURE_PS_WIDE int terminal_width; int w_count = 0; - bb_opt_complementally="ww"; + + bb_opt_complementally="-:ww"; #else -# define terminal_width 80 +# define terminal_width 79 #endif #if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX @@ -43,7 +46,7 @@ extern int ps_main(int argc, char **argv) #if ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX i = bb_getopt_ulflags(argc, argv, "wc", &w_count); #elif ENABLE_FEATURE_PS_WIDE && !ENABLE_SELINUX - i = bb_getopt_ulflags(argc, argv, "w", &w_count); + bb_getopt_ulflags(argc, argv, "w", &w_count); #else /* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */ i = bb_getopt_ulflags(argc, argv, "c"); #endif @@ -51,10 +54,10 @@ extern int ps_main(int argc, char **argv) /* if w is given once, GNU ps sets the width to 132, * if w is given more than once, it is "unlimited" */ - if((i & 1)) { + if(w_count) { terminal_width = (w_count==1) ? 132 : INT_MAX; } else { - get_terminal_width_height(0, &terminal_width, NULL); + get_terminal_width_height(1, &terminal_width, NULL); /* Go one less... */ terminal_width--; } |