aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-11-29 12:32:33 +0000
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>2005-11-29 12:32:33 +0000
commit70678bc5b65a62176a6b41b4481e7f4f274a9c93 (patch)
tree13846b060d8049286f4788a2607bbf6c30fdedc0
parent5a5d0fa0445ceafb2258d63a5da01da83380adaf (diff)
downloadbusybox-w32-70678bc5b65a62176a6b41b4481e7f4f274a9c93.tar.gz
busybox-w32-70678bc5b65a62176a6b41b4481e7f4f274a9c93.tar.bz2
busybox-w32-70678bc5b65a62176a6b41b4481e7f4f274a9c93.zip
getopt -> getopt_ulflags. noticed by Rob Sullivan
-rw-r--r--procps/top.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/procps/top.c b/procps/top.c
index 3ab138d29..5faeafb59 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -301,10 +301,10 @@ static unsigned long display_generic(void)
301 * First, we read in the first line. Old kernels will have bogus 301 * First, we read in the first line. Old kernels will have bogus
302 * strings we don't care about, whereas new kernels will start right 302 * strings we don't care about, whereas new kernels will start right
303 * out with MemTotal: 303 * out with MemTotal:
304 * -- PFM. 304 * -- PFM.
305 */ 305 */
306 if (fscanf(fp, "MemTotal: %lu %s\n", &total, buf) != 2) { 306 if (fscanf(fp, "MemTotal: %lu %s\n", &total, buf) != 2) {
307 fgets(buf, sizeof(buf), fp); /* skip first line */ 307 fgets(buf, sizeof(buf), fp); /* skip first line */
308 308
309 fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu", 309 fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu",
310 &total, &used, &mfree, &shared, &buffers, &cached); 310 &total, &used, &mfree, &shared, &buffers, &cached);
@@ -438,6 +438,7 @@ static void sig_catcher (int sig)
438int top_main(int argc, char **argv) 438int top_main(int argc, char **argv)
439{ 439{
440 int opt, interval, lines, col; 440 int opt, interval, lines, col;
441 char *sinterval;
441#ifdef CONFIG_FEATURE_USE_TERMIOS 442#ifdef CONFIG_FEATURE_USE_TERMIOS
442 struct termios new_settings; 443 struct termios new_settings;
443 struct timeval tv; 444 struct timeval tv;
@@ -446,18 +447,13 @@ int top_main(int argc, char **argv)
446 struct sigaction sa; 447 struct sigaction sa;
447#endif /* CONFIG_FEATURE_USE_TERMIOS */ 448#endif /* CONFIG_FEATURE_USE_TERMIOS */
448 449
449 /* Default update rate is 5 seconds */
450 interval = 5;
451
452 /* do normal option parsing */ 450 /* do normal option parsing */
453 while ((opt = getopt(argc, argv, "d:")) > 0) { 451 opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
454 switch (opt) { 452 if((opt & 1)) {
455 case 'd': 453 interval = atoi(sinterval);
456 interval = atoi(optarg); 454 } else {
457 break; 455 /* Default update rate is 5 seconds */
458 default: 456 interval = 5;
459 bb_show_usage();
460 }
461 } 457 }
462 458
463 /* Default to 25 lines - 5 lines for status */ 459 /* Default to 25 lines - 5 lines for status */