aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2026-05-26 07:40:19 +0100
committerRon Yorston <rmy@pobox.com>2026-05-26 07:40:19 +0100
commitf9e24f4766afdf2c0a1011097bd2fd6e01fd39e0 (patch)
treef9478b76ed95494e9db9f3ce7fa303fc11b9750e /coreutils
parent0ab4bc6ce5f6480b03093866b04c17e5d13ef046 (diff)
downloadbusybox-w32-f9e24f4766afdf2c0a1011097bd2fd6e01fd39e0.tar.gz
busybox-w32-f9e24f4766afdf2c0a1011097bd2fd6e01fd39e0.tar.bz2
busybox-w32-f9e24f4766afdf2c0a1011097bd2fd6e01fd39e0.zip
stty: code shrink
The current implementation of 'stty' for Windows only uses a limited subset of the flags in 'struct termios'. Remove some unused features. Saves 16-40 bytes. Signed-off-by: Ron Yorston <rmy@pobox.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/stty.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c
index db4e2299d..2c3066a02 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -268,10 +268,15 @@ enum speed_setting {
268 268
269/* Which member(s) of 'struct termios' a mode uses */ 269/* Which member(s) of 'struct termios' a mode uses */
270enum { 270enum {
271#if !ENABLE_PLATFORM_MINGW32
271 control, input, output, local, combination 272 control, input, output, local, combination
273#else
274 local, combination
275#endif
272}; 276};
273static tcflag_t *get_ptr_to_tcflag(unsigned type, const struct termios *mode) 277static tcflag_t *get_ptr_to_tcflag(unsigned type, const struct termios *mode)
274{ 278{
279#if !ENABLE_PLATFORM_MINGW32
275 static const uint8_t tcflag_offsets[] ALIGN1 = { 280 static const uint8_t tcflag_offsets[] ALIGN1 = {
276 offsetof(struct termios, c_cflag), /* control */ 281 offsetof(struct termios, c_cflag), /* control */
277 offsetof(struct termios, c_iflag), /* input */ 282 offsetof(struct termios, c_iflag), /* input */
@@ -282,6 +287,9 @@ static tcflag_t *get_ptr_to_tcflag(unsigned type, const struct termios *mode)
282 return (tcflag_t*) (((char*)mode) + tcflag_offsets[type]); 287 return (tcflag_t*) (((char*)mode) + tcflag_offsets[type]);
283 } 288 }
284 return NULL; 289 return NULL;
290#else
291 return (type == local) ? (tcflag_t*)&mode->c_lflag : NULL;
292#endif
285} 293}
286 294
287/* Flags for 'struct mode_info' */ 295/* Flags for 'struct mode_info' */
@@ -1090,7 +1098,11 @@ static void do_display(const struct termios *mode, int all)
1090 int i; 1098 int i;
1091 tcflag_t *bitsp; 1099 tcflag_t *bitsp;
1092 unsigned long mask; 1100 unsigned long mask;
1101#if !ENABLE_PLATFORM_MINGW32
1093 int prev_type = control; 1102 int prev_type = control;
1103#else
1104 int prev_type = local;
1105#endif
1094 1106
1095 display_speed(mode, 1); 1107 display_speed(mode, 1);
1096 if (all) 1108 if (all)