aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stty.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r--coreutils/stty.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index f987fbbcf..57e2cc30d 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -25,7 +25,7 @@
25//config: help 25//config: help
26//config: stty is used to change and print terminal line settings. 26//config: stty is used to change and print terminal line settings.
27 27
28//applet:IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP)) 28//applet:IF_STTY(APPLET_NOEXEC(stty, stty, BB_DIR_BIN, BB_SUID_DROP, stty))
29 29
30//kbuild:lib-$(CONFIG_STTY) += stty.o 30//kbuild:lib-$(CONFIG_STTY) += stty.o
31 31
@@ -782,12 +782,13 @@ struct globals {
782 unsigned max_col; 782 unsigned max_col;
783 /* Current position, to know when to wrap */ 783 /* Current position, to know when to wrap */
784 unsigned current_col; 784 unsigned current_col;
785 char buf[10];
786} FIX_ALIASING; 785} FIX_ALIASING;
787#define G (*(struct globals*)bb_common_bufsiz1) 786#define G (*(struct globals*)bb_common_bufsiz1)
788#define INIT_G() do { \ 787#define INIT_G() do { \
788 setup_common_bufsiz(); \
789 G.device_name = bb_msg_standard_input; \ 789 G.device_name = bb_msg_standard_input; \
790 G.max_col = 80; \ 790 G.max_col = 80; \
791 G.current_col = 0; /* we are noexec, must clear */ \
791} while (0) 792} while (0)
792 793
793static void set_speed_or_die(enum speed_setting type, const char *arg, 794static void set_speed_or_die(enum speed_setting type, const char *arg,
@@ -1018,6 +1019,8 @@ static void do_display(const struct termios *mode, int all)
1018 1019
1019 for (i = 0; i != CIDX_min; ++i) { 1020 for (i = 0; i != CIDX_min; ++i) {
1020 char ch; 1021 char ch;
1022 char buf10[10];
1023
1021 /* If swtch is the same as susp, don't print both */ 1024 /* If swtch is the same as susp, don't print both */
1022#if VSWTCH == VSUSP 1025#if VSWTCH == VSUSP
1023 if (i == CIDX_swtch) 1026 if (i == CIDX_swtch)
@@ -1033,10 +1036,10 @@ static void do_display(const struct termios *mode, int all)
1033#endif 1036#endif
1034 ch = mode->c_cc[control_info[i].offset]; 1037 ch = mode->c_cc[control_info[i].offset];
1035 if (ch == _POSIX_VDISABLE) 1038 if (ch == _POSIX_VDISABLE)
1036 strcpy(G.buf, "<undef>"); 1039 strcpy(buf10, "<undef>");
1037 else 1040 else
1038 visible(ch, G.buf, 0); 1041 visible(ch, buf10, 0);
1039 wrapf("%s = %s;", nth_string(control_name, i), G.buf); 1042 wrapf("%s = %s;", nth_string(control_name, i), buf10);
1040 } 1043 }
1041#if VEOF == VMIN 1044#if VEOF == VMIN
1042 if ((mode->c_lflag & ICANON) == 0) 1045 if ((mode->c_lflag & ICANON) == 0)