Move FEATURE_USE_TERMIOS config option to two applets which use it
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Jan 2017 15:27:12 +0000 (16:27 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Jan 2017 15:27:12 +0000 (16:27 +0100)
No code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 files changed:
Config.in
configs/TEST_nommu_defconfig
configs/TEST_noprintf_defconfig
configs/TEST_rh9_defconfig
configs/android2_defconfig
configs/android_502_defconfig
configs/android_defconfig
configs/android_ndk_defconfig
configs/cygwin_defconfig
configs/freebsd_defconfig
procps/powertop.c
procps/top.c

index db15871694acd850a330b94b2a98237a1192dc30..ec302ffdf14f7bab64f093ae212ae3202f2188ff 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -61,15 +61,6 @@ config FEATURE_AUTOWIDTH
          If you leave this disabled, your utilities will be especially
          primitive and will be unable to determine the current screen width.
 
-#fixme: delete, create suboptions for applets which use this
-config FEATURE_USE_TERMIOS
-       bool "Use termios for one-stroke input"
-       default y
-       help
-         This option allows utilities such as 'top' to accept keyboard
-         commands. Without this option, they simply refresh display
-         after a fixed period.
-
 config SHOW_USAGE
        bool "Show applet usage messages"
        default y
index d7a9cfe253e5acb14ce53cedd88b2c400933e533..37f3df019ab0190d900977572508c0e99a3d32c8 100644 (file)
@@ -524,7 +524,6 @@ CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
 CONFIG_MKSWAP=y
 CONFIG_FEATURE_MKSWAP_UUID=y
 CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
 CONFIG_VOLUMEID=y
 CONFIG_FEATURE_VOLUMEID_EXT=y
 CONFIG_FEATURE_VOLUMEID_BTRFS=y
index adb6b7036a95b6e1c2a16faf76b491015095b3a0..b03f6250e4c34c12d2072d6214aa4f6ceb9b1aba 100644 (file)
@@ -527,7 +527,6 @@ CONFIG_FDISK_SUPPORT_LARGE_DISKS=y
 # CONFIG_MKSWAP is not set
 # CONFIG_FEATURE_MKSWAP_UUID is not set
 # CONFIG_MORE is not set
-# CONFIG_FEATURE_USE_TERMIOS is not set
 CONFIG_VOLUMEID=y
 # CONFIG_FEATURE_VOLUMEID_EXT is not set
 # CONFIG_FEATURE_VOLUMEID_BTRFS is not set
index 0d72cdac9f21c00190037a1908cc4f1cdc0122fb..3fc137787c03c2765382f2349e0c16976b042ce4 100644 (file)
@@ -540,7 +540,6 @@ CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
 CONFIG_MKSWAP=y
 CONFIG_FEATURE_MKSWAP_UUID=y
 CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
 CONFIG_VOLUMEID=y
 CONFIG_FEATURE_VOLUMEID_EXT=y
 CONFIG_FEATURE_VOLUMEID_BTRFS=y
index 866a8798938f6bbb2f3f6d7c2568de425ea8c9e8..1846bb764353ed5601cad8593c467c1159043c82 100644 (file)
@@ -94,7 +94,6 @@ CONFIG_PASSWORD_MINLEN=6
 CONFIG_MD5_SMALL=1
 # CONFIG_FEATURE_FAST_TOP is not set
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 # CONFIG_FEATURE_EDITING is not set
 CONFIG_FEATURE_EDITING_MAX_LEN=0
 # CONFIG_FEATURE_EDITING_VI is not set
index 8d8dd250ffe7f70a7332e6dab19b9804e3f28421..2cf4cd86ccae3c9821565d05e8770657eeee3572 100644 (file)
@@ -174,7 +174,6 @@ CONFIG_MD5_SMALL=1
 CONFIG_SHA3_SMALL=1
 # CONFIG_FEATURE_FAST_TOP is not set
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 CONFIG_FEATURE_EDITING=y
 CONFIG_FEATURE_EDITING_MAX_LEN=1024
 # CONFIG_FEATURE_EDITING_VI is not set
index 1eaab9eaea9967e3d5fc7e77af91c0ffd7c64f9c..8316b2efb731a43c4fee0b24fc9123c1611a103c 100644 (file)
@@ -112,7 +112,6 @@ CONFIG_PASSWORD_MINLEN=6
 CONFIG_MD5_SMALL=1
 # CONFIG_FEATURE_FAST_TOP is not set
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 # CONFIG_FEATURE_EDITING is not set
 CONFIG_FEATURE_EDITING_MAX_LEN=0
 # CONFIG_FEATURE_EDITING_VI is not set
index dc9d21ce5dc56f892cc46b8270637be4d36c7d7c..d8b994ed400b2f3780d5108457675b88767135be 100644 (file)
@@ -102,7 +102,6 @@ CONFIG_MD5_SMALL=1
 CONFIG_SHA3_SMALL=1
 # CONFIG_FEATURE_FAST_TOP is not set
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 # CONFIG_FEATURE_EDITING is not set
 CONFIG_FEATURE_EDITING_MAX_LEN=0
 # CONFIG_FEATURE_EDITING_VI is not set
index 37e3e210fd37e996406a41e684e708b6279e7dc9..352ed90ad22f051d358dccd42216a28aa502f312 100644 (file)
@@ -94,7 +94,6 @@ CONFIG_PASSWORD_MINLEN=6
 CONFIG_MD5_SMALL=1
 CONFIG_FEATURE_FAST_TOP=y
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 CONFIG_FEATURE_EDITING=y
 CONFIG_FEATURE_EDITING_MAX_LEN=1024
 # CONFIG_FEATURE_EDITING_VI is not set
index 90e0a8bda5dc3a7ac23a83b7fa1accf95265b363..b19a9fd49133516583790f10d0d2951ea448487d 100644 (file)
@@ -93,7 +93,6 @@ CONFIG_PASSWORD_MINLEN=6
 CONFIG_MD5_SMALL=1
 CONFIG_FEATURE_FAST_TOP=y
 # CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
 CONFIG_FEATURE_EDITING=y
 CONFIG_FEATURE_EDITING_MAX_LEN=1024
 # CONFIG_FEATURE_EDITING_VI is not set
index ee806161f3a47fd835020e31b8c7cc7d4803ebe9..413806836176f4bc38791a5425258d2025eb737b 100644 (file)
 //config:      default y
 //config:      help
 //config:        Analyze power consumption on Intel-based laptops
+//config:
+//config:config FEATURE_POWERTOP_INTERACTIVE
+//config:      bool "Accept keyboard commands"
+//config:      default y
+//config:      depends on POWERTOP
+//config:      help
+//config:        Without this, powertop will only refresh display every 10 seconds.
+//config:        No keyboard commands will work, only ^C to terminate.
 
 // XXX This should be configurable
 #define ENABLE_FEATURE_POWERTOP_PROCIRQ 1
@@ -82,7 +90,7 @@ struct globals {
        ullong last_usage[MAX_CSTATE_COUNT];
        ullong start_duration[MAX_CSTATE_COUNT];
        ullong last_duration[MAX_CSTATE_COUNT];
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
        struct termios init_settings;
 #endif
 };
@@ -91,7 +99,7 @@ struct globals {
        SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
 } while (0)
 
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
 static void reset_term(void)
 {
        tcsetattr_stdin_TCSANOW(&G.init_settings);
@@ -682,7 +690,7 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv)
        ullong cur_usage[MAX_CSTATE_COUNT];
        ullong cur_duration[MAX_CSTATE_COUNT];
        char cstate_lines[MAX_CSTATE_COUNT + 2][64];
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
        struct pollfd pfd[1];
 
        pfd[0].fd = 0;
@@ -705,7 +713,7 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv)
 
        puts("Collecting data for "DEFAULT_SLEEP_STR" seconds");
 
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_POWERTOP_INTERACTIVE
        /* Turn on unbuffered input; turn off echoing, ^C ^Z etc */
        set_termios_to_raw(STDIN_FILENO, &G.init_settings, TERMIOS_CLEAR_ISIG);
        bb_signals(BB_FATAL_SIGS, sig_handler);
@@ -735,7 +743,7 @@ int powertop_main(int UNUSED_PARAM argc, char UNUSED_PARAM **argv)
                int i;
 
                G.cant_enable_timer_stats |= start_timer(); /* 1 on error */
-#if !ENABLE_FEATURE_USE_TERMIOS
+#if !ENABLE_FEATURE_POWERTOP_INTERACTIVE
                sleep(DEFAULT_SLEEP);
 #else
                if (safe_poll(pfd, 1, DEFAULT_SLEEP * 1000) > 0) {
index 91bb8a88379cdf7a9c1c233f79c959cf97bbfd19..ff2fddeea768ac00b1aeca662ea6e531617353d7 100644 (file)
 //config:        The top program provides a dynamic real-time view of a running
 //config:        system.
 //config:
+//config:config FEATURE_TOP_INTERACTIVE
+//config:      bool "Accept keyboard commands"
+//config:      default y
+//config:      depends on TOP
+//config:      help
+//config:        Without this, top will only refresh display every 5 seconds.
+//config:        No keyboard commands will work, only ^C to terminate.
+//config:
 //config:config FEATURE_TOP_CPU_USAGE_PERCENTAGE
 //config:      bool "Show CPU per-process usage percentage"
 //config:      default y
@@ -158,7 +166,7 @@ struct globals {
        smallint smp_cpu_info; /* one/many cpu info lines? */
 #endif
        unsigned lines;  /* screen height */
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
        struct termios initial_settings;
        int scroll_ofs;
 #define G_scroll_ofs G.scroll_ofs
@@ -181,7 +189,7 @@ struct globals {
        jiffy_counts_t *cpu_jif, *cpu_prev_jif;
        int num_cpus;
 #endif
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
        char kbd_input[KEYCODE_BUFFER_SIZE];
 #endif
        char line_buf[80];
@@ -220,7 +228,7 @@ enum {
 #define OPT_BATCH_MODE (option_mask32 & OPT_b)
 
 
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
 static int pid_sort(top_status_t *P, top_status_t *Q)
 {
        /* Buggy wrt pids with high bit set */
@@ -725,7 +733,7 @@ static void clearmems(void)
        top = NULL;
 }
 
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
 static void reset_term(void)
 {
        if (!OPT_BATCH_MODE)
@@ -737,7 +745,7 @@ static void sig_catcher(int sig)
        reset_term();
        kill_myself_with_sig(sig);
 }
-#endif /* FEATURE_USE_TERMIOS */
+#endif /* FEATURE_TOP_INTERACTIVE */
 
 /*
  * TOPMEM support
@@ -892,7 +900,7 @@ enum {
        EXIT_MASK = (unsigned)-1,
 };
 
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
 static unsigned handle_input(unsigned scan_mask, unsigned interval)
 {
        if (option_mask32 & OPT_EOF) {
@@ -1041,7 +1049,7 @@ static unsigned handle_input(unsigned scan_mask, unsigned interval)
 //usage:   "\n""Read the status of all processes from /proc each SECONDS"
 //usage:   "\n""and display a screenful of them."
 //usage:   "\n"
-//usage:       IF_FEATURE_USE_TERMIOS(
+//usage:       IF_FEATURE_TOP_INTERACTIVE(
 //usage:       "Keys:"
 //usage:   "\n""       N/M"
 //usage:                IF_FEATURE_TOP_CPU_USAGE_PERCENTAGE("/P")
@@ -1136,7 +1144,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
        if (OPT_BATCH_MODE) {
                option_mask32 |= OPT_EOF;
        }
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
        else {
                /* Turn on unbuffered input; turn off echoing, ^C ^Z etc */
                set_termios_to_raw(STDIN_FILENO, &initial_settings, TERMIOS_CLEAR_ISIG);
@@ -1237,7 +1245,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
                clearmems();
                if (iterations >= 0 && !--iterations)
                        break;
-#if !ENABLE_FEATURE_USE_TERMIOS
+#if !ENABLE_FEATURE_TOP_INTERACTIVE
                sleep(interval);
 #else
                scan_mask = handle_input(scan_mask, interval);
@@ -1245,7 +1253,7 @@ int top_main(int argc UNUSED_PARAM, char **argv)
        } /* end of "while (not Q)" */
 
        bb_putchar('\n');
-#if ENABLE_FEATURE_USE_TERMIOS
+#if ENABLE_FEATURE_TOP_INTERACTIVE
        reset_term();
 #endif
        if (ENABLE_FEATURE_CLEAN_UP) {