diff options
author | Denys Vlasenko | 2017-08-04 16:23:42 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-04 16:33:23 +0200 |
commit | 727948e585cb133c32c8d42570e5524c58190307 (patch) | |
tree | f2beb48ded47f9d8ebef707516e7bbb00335b1a8 /procps/ps.c | |
parent | 7f9d62d7f5b67b6b1cc7e0b94826ba2a6e193586 (diff) | |
download | busybox-727948e585cb133c32c8d42570e5524c58190307.zip busybox-727948e585cb133c32c8d42570e5524c58190307.tar.gz |
getopt32: factor out code to treat all args as options
Working towards making getopt32() xmalloc-free
function old new delta
make_all_argv_opts - 58 +58
top_main 914 912 -2
getopt32 1517 1458 -59
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/2 up/down: 58/-61) Total: -3 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps/ps.c')
-rw-r--r-- | procps/ps.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/procps/ps.c b/procps/ps.c index eb1946d..081479b 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -715,7 +715,8 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) # if ENABLE_FEATURE_PS_WIDE /* -w is a bit complicated */ int w_count = 0; - opt_complementary = "-:ww"; + make_all_argv_opts(argv); + opt_complementary = "ww"; opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")IF_FEATURE_PS_LONG("l") "w", &w_count); /* if w is given once, GNU ps sets the width to 132, @@ -731,7 +732,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) } # else /* -w is not supported, only -Z and/or -T */ - opt_complementary = "-"; + make_all_argv_opts(argv); opts = getopt32(argv, IF_SELINUX("Z")IF_FEATURE_SHOW_THREADS("T")IF_FEATURE_PS_LONG("l")); # endif |