summaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
authorDenys Vlasenko2017-08-04 16:23:42 +0200
committerDenys Vlasenko2017-08-04 16:33:23 +0200
commit727948e585cb133c32c8d42570e5524c58190307 (patch)
treef2beb48ded47f9d8ebef707516e7bbb00335b1a8 /procps/top.c
parent7f9d62d7f5b67b6b1cc7e0b94826ba2a6e193586 (diff)
downloadbusybox-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/top.c')
-rw-r--r--procps/top.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/procps/top.c b/procps/top.c
index 015d1ab..1bc432f 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -1110,15 +1110,14 @@ int top_main(int argc UNUSED_PARAM, char **argv)
#endif
/* all args are options; -n NUM */
- opt_complementary = "-"; /* options can be specified w/o dash */
+ make_all_argv_opts(argv); /* options can be specified w/o dash */
col = getopt32(argv, "d:n:b"IF_FEATURE_TOPMEM("m"), &str_interval, &str_iterations);
#if ENABLE_FEATURE_TOPMEM
if (col & OPT_m) /* -m (busybox specific) */
scan_mask = TOPMEM_MASK;
#endif
if (col & OPT_d) {
- /* work around for "-d 1" -> "-d -1" done by getopt32
- * (opt_complementary == "-" does this) */
+ /* work around for "-d 1" -> "-d -1" done by make_all_argv_opts() */
if (str_interval[0] == '-')
str_interval++;
/* Need to limit it to not overflow poll timeout */