diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-28 16:40:25 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-09-28 16:40:25 +0000 |
commit | bacaff6e5474d6c5f080ce4cd2a55e8ff1ba5c94 (patch) | |
tree | 5ca8c92753ef2c2fb7d39f125dc90deb18cfc1b8 /procps/top.c | |
parent | 261cf4784fa39fb6cb3b7db99e809a7832d94d0a (diff) | |
download | busybox-w32-1_12_1.tar.gz busybox-w32-1_12_1.tar.bz2 busybox-w32-1_12_1.zip |
apply post-1.12.0 fixes, bump version to 1.12.11_12_1
Diffstat (limited to 'procps/top.c')
-rw-r--r-- | procps/top.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/procps/top.c b/procps/top.c index 663eac674..46e29a9dd 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -745,7 +745,7 @@ int top_main(int argc UNUSED_PARAM, char **argv) | |||
745 | int iterations; | 745 | int iterations; |
746 | unsigned lines, col; | 746 | unsigned lines, col; |
747 | unsigned interval; | 747 | unsigned interval; |
748 | char *sinterval; | 748 | char *str_interval, *str_iterations; |
749 | SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK; | 749 | SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK; |
750 | #if ENABLE_FEATURE_USE_TERMIOS | 750 | #if ENABLE_FEATURE_USE_TERMIOS |
751 | struct termios new_settings; | 751 | struct termios new_settings; |
@@ -762,10 +762,19 @@ int top_main(int argc UNUSED_PARAM, char **argv) | |||
762 | iterations = 0; /* infinite */ | 762 | iterations = 0; /* infinite */ |
763 | 763 | ||
764 | /* all args are options; -n NUM */ | 764 | /* all args are options; -n NUM */ |
765 | opt_complementary = "-:n+"; | 765 | opt_complementary = "-"; |
766 | if (getopt32(argv, "d:n:b", &sinterval, &iterations) & OPT_d) { | 766 | col = getopt32(argv, "d:n:b", &str_interval, &str_iterations); |
767 | if (col & OPT_d) { | ||
768 | /* work around for "-d 1" -> "-d -1" done by getopt32 */ | ||
769 | if (str_interval[0] == '-') | ||
770 | str_interval++; | ||
767 | /* Need to limit it to not overflow poll timeout */ | 771 | /* Need to limit it to not overflow poll timeout */ |
768 | interval = xatou16(sinterval); // -d | 772 | interval = xatou16(str_interval); |
773 | } | ||
774 | if (col & OPT_n) { | ||
775 | if (str_iterations[0] == '-') | ||
776 | str_iterations++; | ||
777 | iterations = xatou(str_iterations); | ||
769 | } | 778 | } |
770 | 779 | ||
771 | /* change to /proc */ | 780 | /* change to /proc */ |