summaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
author"Vladimir N. Oleynik"2005-11-29 12:32:33 +0000
committer"Vladimir N. Oleynik"2005-11-29 12:32:33 +0000
commit70678bc5b65a62176a6b41b4481e7f4f274a9c93 (patch)
tree13846b060d8049286f4788a2607bbf6c30fdedc0 /procps/top.c
parent5a5d0fa0445ceafb2258d63a5da01da83380adaf (diff)
downloadbusybox-70678bc5b65a62176a6b41b4481e7f4f274a9c93.zip
busybox-70678bc5b65a62176a6b41b4481e7f4f274a9c93.tar.gz
getopt -> getopt_ulflags. noticed by Rob Sullivan
Diffstat (limited to 'procps/top.c')
-rw-r--r--procps/top.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/procps/top.c b/procps/top.c
index 3ab138d..5faeafb 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -301,10 +301,10 @@ static unsigned long display_generic(void)
* First, we read in the first line. Old kernels will have bogus
* strings we don't care about, whereas new kernels will start right
* out with MemTotal:
- * -- PFM.
+ * -- PFM.
*/
if (fscanf(fp, "MemTotal: %lu %s\n", &total, buf) != 2) {
- fgets(buf, sizeof(buf), fp); /* skip first line */
+ fgets(buf, sizeof(buf), fp); /* skip first line */
fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu",
&total, &used, &mfree, &shared, &buffers, &cached);
@@ -438,6 +438,7 @@ static void sig_catcher (int sig)
int top_main(int argc, char **argv)
{
int opt, interval, lines, col;
+ char *sinterval;
#ifdef CONFIG_FEATURE_USE_TERMIOS
struct termios new_settings;
struct timeval tv;
@@ -446,18 +447,13 @@ int top_main(int argc, char **argv)
struct sigaction sa;
#endif /* CONFIG_FEATURE_USE_TERMIOS */
- /* Default update rate is 5 seconds */
- interval = 5;
-
/* do normal option parsing */
- while ((opt = getopt(argc, argv, "d:")) > 0) {
- switch (opt) {
- case 'd':
- interval = atoi(optarg);
- break;
- default:
- bb_show_usage();
- }
+ opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
+ if((opt & 1)) {
+ interval = atoi(sinterval);
+ } else {
+ /* Default update rate is 5 seconds */
+ interval = 5;
}
/* Default to 25 lines - 5 lines for status */