summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-05 10:52:47 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-10-05 10:52:47 +0000
commit35939d93783230998439848b2798865c598723e2 (patch)
tree188f195a595c4f494fdc1d8d27da67a2e5b42b5d /procps
parent7abe7098676aeb0654ef0159f589484b4cf520e8 (diff)
downloadbusybox-w32-35939d93783230998439848b2798865c598723e2.tar.gz
busybox-w32-35939d93783230998439848b2798865c598723e2.tar.bz2
busybox-w32-35939d93783230998439848b2798865c598723e2.zip
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')
-rw-r--r--procps/ps.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/procps/ps.c b/procps/ps.c
index 6b5a4a908..b423b06ce 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -26,16 +26,19 @@ extern int ps_main(int argc, char **argv)
26{ 26{
27 procps_status_t * p; 27 procps_status_t * p;
28 int i, len; 28 int i, len;
29
29#if ENABLE_SELINUX 30#if ENABLE_SELINUX
30 int use_selinux = 0; 31 int use_selinux = 0;
31 security_context_t sid=NULL; 32 security_context_t sid=NULL;
32#endif 33#endif
34
33#if ENABLE_FEATURE_PS_WIDE 35#if ENABLE_FEATURE_PS_WIDE
34 int terminal_width; 36 int terminal_width;
35 int w_count = 0; 37 int w_count = 0;
36 bb_opt_complementally="ww"; 38
39 bb_opt_complementally="-:ww";
37#else 40#else
38# define terminal_width 80 41# define terminal_width 79
39#endif 42#endif
40 43
41#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX 44#if ENABLE_FEATURE_PS_WIDE || ENABLE_SELINUX
@@ -43,7 +46,7 @@ extern int ps_main(int argc, char **argv)
43#if ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX 46#if ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX
44 i = bb_getopt_ulflags(argc, argv, "wc", &w_count); 47 i = bb_getopt_ulflags(argc, argv, "wc", &w_count);
45#elif ENABLE_FEATURE_PS_WIDE && !ENABLE_SELINUX 48#elif ENABLE_FEATURE_PS_WIDE && !ENABLE_SELINUX
46 i = bb_getopt_ulflags(argc, argv, "w", &w_count); 49 bb_getopt_ulflags(argc, argv, "w", &w_count);
47#else /* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */ 50#else /* !ENABLE_FEATURE_PS_WIDE && ENABLE_SELINUX */
48 i = bb_getopt_ulflags(argc, argv, "c"); 51 i = bb_getopt_ulflags(argc, argv, "c");
49#endif 52#endif
@@ -51,10 +54,10 @@ extern int ps_main(int argc, char **argv)
51 /* if w is given once, GNU ps sets the width to 132, 54 /* if w is given once, GNU ps sets the width to 132,
52 * if w is given more than once, it is "unlimited" 55 * if w is given more than once, it is "unlimited"
53 */ 56 */
54 if((i & 1)) { 57 if(w_count) {
55 terminal_width = (w_count==1) ? 132 : INT_MAX; 58 terminal_width = (w_count==1) ? 132 : INT_MAX;
56 } else { 59 } else {
57 get_terminal_width_height(0, &terminal_width, NULL); 60 get_terminal_width_height(1, &terminal_width, NULL);
58 /* Go one less... */ 61 /* Go one less... */
59 terminal_width--; 62 terminal_width--;
60 } 63 }