mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2025-03-03 01:35:57 +00:00
getopt -> getopt_ulflags. noticed by Rob Sullivan
This commit is contained in:
parent
5a5d0fa044
commit
70678bc5b6
22
procps/top.c
22
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
|
* First, we read in the first line. Old kernels will have bogus
|
||||||
* strings we don't care about, whereas new kernels will start right
|
* strings we don't care about, whereas new kernels will start right
|
||||||
* out with MemTotal:
|
* out with MemTotal:
|
||||||
* -- PFM.
|
* -- PFM.
|
||||||
*/
|
*/
|
||||||
if (fscanf(fp, "MemTotal: %lu %s\n", &total, buf) != 2) {
|
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",
|
fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu",
|
||||||
&total, &used, &mfree, &shared, &buffers, &cached);
|
&total, &used, &mfree, &shared, &buffers, &cached);
|
||||||
@ -438,6 +438,7 @@ static void sig_catcher (int sig)
|
|||||||
int top_main(int argc, char **argv)
|
int top_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt, interval, lines, col;
|
int opt, interval, lines, col;
|
||||||
|
char *sinterval;
|
||||||
#ifdef CONFIG_FEATURE_USE_TERMIOS
|
#ifdef CONFIG_FEATURE_USE_TERMIOS
|
||||||
struct termios new_settings;
|
struct termios new_settings;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@ -446,18 +447,13 @@ int top_main(int argc, char **argv)
|
|||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
/* Default update rate is 5 seconds */
|
|
||||||
interval = 5;
|
|
||||||
|
|
||||||
/* do normal option parsing */
|
/* do normal option parsing */
|
||||||
while ((opt = getopt(argc, argv, "d:")) > 0) {
|
opt = bb_getopt_ulflags(argc, argv, "d:", &sinterval);
|
||||||
switch (opt) {
|
if((opt & 1)) {
|
||||||
case 'd':
|
interval = atoi(sinterval);
|
||||||
interval = atoi(optarg);
|
} else {
|
||||||
break;
|
/* Default update rate is 5 seconds */
|
||||||
default:
|
interval = 5;
|
||||||
bb_show_usage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default to 25 lines - 5 lines for status */
|
/* Default to 25 lines - 5 lines for status */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user