aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:35:52 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-11 16:35:52 +0100
commited15dde60a72dce888df10295a916b199346929d (patch)
treee3d9fab96ea62f20f29460de32e8cacaab9d2267
parent6c1f348fa792a33d5a98e68c139df65c2d4c1628 (diff)
downloadbusybox-ed15dde60a72dce888df10295a916b199346929d.tar.gz
Move FEATURE_AUTOWIDTH config option to two applets which use it
No code changes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Config.in11
-rw-r--r--configs/TEST_nommu_defconfig5
-rw-r--r--configs/TEST_noprintf_defconfig1
-rw-r--r--configs/TEST_rh9_defconfig5
-rw-r--r--configs/android2_defconfig5
-rw-r--r--configs/android_502_defconfig5
-rw-r--r--configs/android_defconfig5
-rw-r--r--configs/android_ndk_defconfig5
-rw-r--r--configs/cygwin_defconfig5
-rw-r--r--configs/freebsd_defconfig5
-rw-r--r--coreutils/ls.c27
-rw-r--r--networking/telnet.c15
12 files changed, 26 insertions, 68 deletions
diff --git a/Config.in b/Config.in
index ec302ffdf..cfb3aa0ee 100644
--- a/Config.in
+++ b/Config.in
@@ -50,17 +50,6 @@ config USE_PORTABLE_CODE
compiler other than gcc.
If you do use gcc, this option may needlessly increase code size.
-#fixme: delete, create suboptions for applets which use this
-config FEATURE_AUTOWIDTH
- bool "Calculate terminal & column widths"
- default y
- help
- This option allows utilities such as 'ls', 'telnet' etc
- to determine the width of the screen, which can allow them to
- display additional text or avoid wrapping text onto the next line.
- If you leave this disabled, your utilities will be especially
- primitive and will be unable to determine the current screen width.
-
config SHOW_USAGE
bool "Show applet usage messages"
default y
diff --git a/configs/TEST_nommu_defconfig b/configs/TEST_nommu_defconfig
index 37f3df019..b7d9a35c2 100644
--- a/configs/TEST_nommu_defconfig
+++ b/configs/TEST_nommu_defconfig
@@ -266,11 +266,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/TEST_noprintf_defconfig b/configs/TEST_noprintf_defconfig
index b03f6250e..3f85ee1df 100644
--- a/configs/TEST_noprintf_defconfig
+++ b/configs/TEST_noprintf_defconfig
@@ -277,7 +277,6 @@ CONFIG_TRUE=y
# CONFIG_WHOAMI is not set
# CONFIG_YES is not set
# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
-# CONFIG_FEATURE_AUTOWIDTH is not set
# CONFIG_FEATURE_HUMAN_READABLE is not set
# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
diff --git a/configs/TEST_rh9_defconfig b/configs/TEST_rh9_defconfig
index 3fc137787..99deb67fe 100644
--- a/configs/TEST_rh9_defconfig
+++ b/configs/TEST_rh9_defconfig
@@ -277,11 +277,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/android2_defconfig b/configs/android2_defconfig
index 1846bb764..b079fa759 100644
--- a/configs/android2_defconfig
+++ b/configs/android2_defconfig
@@ -289,11 +289,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/android_502_defconfig b/configs/android_502_defconfig
index 2cf4cd86c..4273d3382 100644
--- a/configs/android_502_defconfig
+++ b/configs/android_502_defconfig
@@ -390,11 +390,6 @@ CONFIG_FEATURE_VERBOSE=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/android_defconfig b/configs/android_defconfig
index 8316b2efb..b9489c456 100644
--- a/configs/android_defconfig
+++ b/configs/android_defconfig
@@ -312,11 +312,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/android_ndk_defconfig b/configs/android_ndk_defconfig
index d8b994ed4..caf22e57b 100644
--- a/configs/android_ndk_defconfig
+++ b/configs/android_ndk_defconfig
@@ -316,11 +316,6 @@ CONFIG_FEATURE_VERBOSE=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/cygwin_defconfig b/configs/cygwin_defconfig
index 352ed90ad..6bfc973ef 100644
--- a/configs/cygwin_defconfig
+++ b/configs/cygwin_defconfig
@@ -289,11 +289,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/configs/freebsd_defconfig b/configs/freebsd_defconfig
index b19a9fd49..e3d04aedc 100644
--- a/configs/freebsd_defconfig
+++ b/configs/freebsd_defconfig
@@ -287,11 +287,6 @@ CONFIG_YES=y
CONFIG_FEATURE_PRESERVE_HARDLINKS=y
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 531eb85b5..13df77410 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -48,6 +48,11 @@
//config: default y
//config: depends on LS
//config:
+//config:config FEATURE_LS_WIDTH
+//config: bool "Enable -w WIDTH and window size autodetection"
+//config: default y
+//config: depends on LS
+//config:
//config:config FEATURE_LS_SORTFILES
//config: bool "Sort the file names"
//config: default y
@@ -101,7 +106,7 @@
//usage: IF_FEATURE_LS_SORTFILES("rSXv")
//usage: IF_FEATURE_LS_TIMESTAMPS("ctu")
//usage: IF_SELINUX("kKZ") "]"
-//usage: IF_FEATURE_AUTOWIDTH(" [-w WIDTH]") " [FILE]..."
+//usage: IF_FEATURE_LS_WIDTH(" [-w WIDTH]") " [FILE]..."
//usage:#define ls_full_usage "\n\n"
//usage: "List directory contents\n"
//usage: "\n -1 One column output"
@@ -147,7 +152,7 @@
//usage: "\n -K List security context in long format"
//usage: "\n -Z List security context and permission"
//usage: )
-//usage: IF_FEATURE_AUTOWIDTH(
+//usage: IF_FEATURE_LS_WIDTH(
//usage: "\n -w N Assume the terminal is N columns wide"
//usage: )
//usage: IF_FEATURE_LS_COLOR(
@@ -263,7 +268,7 @@ static const char ls_options[] ALIGN1 =
IF_SELINUX("KZ") /* 2, 26 */
IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */
IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */
- IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 31 */
+ IF_FEATURE_LS_WIDTH("T:w:") /* 2, 31 */
/* with --color, we use all 32 bits */;
enum {
//OPT_C = (1 << 0),
@@ -298,7 +303,7 @@ enum {
OPTBIT_h = OPTBIT_L + 2 * ENABLE_FEATURE_LS_FOLLOWLINKS,
OPTBIT_T = OPTBIT_h + 1 * ENABLE_FEATURE_HUMAN_READABLE,
OPTBIT_w, /* 30 */
- OPTBIT_color = OPTBIT_T + 2 * ENABLE_FEATURE_AUTOWIDTH,
+ OPTBIT_color = OPTBIT_T + 2 * ENABLE_FEATURE_LS_WIDTH,
OPT_c = (1 << OPTBIT_c) * ENABLE_FEATURE_LS_TIMESTAMPS,
OPT_e = (1 << OPTBIT_e) * ENABLE_FEATURE_LS_TIMESTAMPS,
@@ -316,8 +321,8 @@ enum {
OPT_L = (1 << OPTBIT_L) * ENABLE_FEATURE_LS_FOLLOWLINKS,
OPT_H = (1 << OPTBIT_H) * ENABLE_FEATURE_LS_FOLLOWLINKS,
OPT_h = (1 << OPTBIT_h) * ENABLE_FEATURE_HUMAN_READABLE,
- OPT_T = (1 << OPTBIT_T) * ENABLE_FEATURE_AUTOWIDTH,
- OPT_w = (1 << OPTBIT_w) * ENABLE_FEATURE_AUTOWIDTH,
+ OPT_T = (1 << OPTBIT_T) * ENABLE_FEATURE_LS_WIDTH,
+ OPT_w = (1 << OPTBIT_w) * ENABLE_FEATURE_LS_WIDTH,
OPT_color = (1 << OPTBIT_color) * ENABLE_FEATURE_LS_COLOR,
};
@@ -417,7 +422,7 @@ struct globals {
#endif
smallint exit_code;
unsigned all_fmt;
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_LS_WIDTH
unsigned terminal_width;
# define G_terminal_width (G.terminal_width)
#else
@@ -433,7 +438,7 @@ struct globals {
setup_common_bufsiz(); \
/* we have to zero it out because of NOEXEC */ \
memset(&G, 0, sizeof(G)); \
- IF_FEATURE_AUTOWIDTH(G_terminal_width = TERMINAL_WIDTH;) \
+ IF_FEATURE_LS_WIDTH(G_terminal_width = TERMINAL_WIDTH;) \
IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \
} while (0)
@@ -1167,7 +1172,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
if (ENABLE_FEATURE_LS_SORTFILES)
G.all_fmt = SORT_NAME;
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_LS_WIDTH
/* obtain the terminal width */
G_terminal_width = get_terminal_width(STDIN_FILENO);
/* go one less... */
@@ -1190,9 +1195,9 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
":x-1:1-x" /* bylines/oneline (not in SuS, but in GNU coreutils 8.4) */
IF_FEATURE_LS_TIMESTAMPS(":c-u:u-c") /* mtime/atime */
/* -w NUM: */
- IF_FEATURE_AUTOWIDTH(":w+");
+ IF_FEATURE_LS_WIDTH(":w+");
opt = getopt32(argv, ls_options
- IF_FEATURE_AUTOWIDTH(, NULL, &G_terminal_width)
+ IF_FEATURE_LS_WIDTH(, NULL, &G_terminal_width)
IF_FEATURE_LS_COLOR(, &color_opt)
);
for (i = 0; opt_flags[i] != (1U << 31); i++) {
diff --git a/networking/telnet.c b/networking/telnet.c
index f520fe1dd..a70f74762 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -45,6 +45,11 @@
//config: remote host you are connecting to. This is useful when you need to
//config: log into a machine without telling the username (autologin). This
//config: option enables `-a' and `-l USER' arguments.
+//config:
+//config:config FEATURE_TELNET_WIDTH
+//config: bool "Enable window size autodetection"
+//config: default y
+//config: depends on TELNET
//applet:IF_TELNET(APPLET(telnet, BB_DIR_USR_BIN, BB_SUID_DROP))
@@ -128,7 +133,7 @@ struct globals {
#if ENABLE_FEATURE_TELNET_AUTOLOGIN
const char *autologin;
#endif
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_TELNET_WIDTH
unsigned win_width, win_height;
#endif
/* same buffer used both for network and console read/write */
@@ -401,7 +406,7 @@ static void put_iac_subopt_autologin(void)
}
#endif
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_TELNET_WIDTH
static void put_iac_naws(byte c, int x, int y)
{
if (G.iaclen + 9 > IACBUFSIZE)
@@ -538,7 +543,7 @@ static void to_new_environ(void)
}
#endif
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_TELNET_WIDTH
static void to_naws(void)
{
/* Tell server we will do NAWS */
@@ -561,7 +566,7 @@ static void telopt(byte c)
case TELOPT_NEW_ENVIRON:
to_new_environ(); break;
#endif
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_TELNET_WIDTH
case TELOPT_NAWS:
to_naws();
put_iac_naws(c, G.win_width, G.win_height);
@@ -623,7 +628,7 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
-#if ENABLE_FEATURE_AUTOWIDTH
+#if ENABLE_FEATURE_TELNET_WIDTH
get_terminal_width_height(0, &G.win_width, &G.win_height);
#endif