diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-15 08:33:45 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-15 08:33:45 +0000 |
commit | 7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c (patch) | |
tree | 7590704be6cf03c87242043f5909e12eb4150356 /coreutils | |
parent | fc2b3bc3efa6de860a1d3a961c700650e1a590eb (diff) | |
download | busybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.tar.gz busybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.tar.bz2 busybox-w32-7531d242c93e4ff7d3b2ebeeaf1f0de4dcb6b71c.zip |
Be entirely consistant when using ioctl(0, TIOCGWINSZ, &winsize)
to ensure proper fallback behavior on, i.e. serial consoles.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@7526 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index a7f036b61..727529255 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -203,7 +203,7 @@ static int is_flask_enabled_flag; | |||
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | #ifdef CONFIG_FEATURE_AUTOWIDTH | 205 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
206 | static unsigned short terminal_width = TERMINAL_WIDTH; | 206 | static int terminal_width = TERMINAL_WIDTH; |
207 | static unsigned short tabstops = COLUMN_GAP; | 207 | static unsigned short tabstops = COLUMN_GAP; |
208 | #else | 208 | #else |
209 | #define tabstops COLUMN_GAP | 209 | #define tabstops COLUMN_GAP |
@@ -915,10 +915,6 @@ extern int ls_main(int argc, char **argv) | |||
915 | is_flask_enabled_flag = is_flask_enabled(); | 915 | is_flask_enabled_flag = is_flask_enabled(); |
916 | #endif | 916 | #endif |
917 | 917 | ||
918 | #ifdef CONFIG_FEATURE_AUTOWIDTH | ||
919 | struct winsize win = { 0, 0, 0, 0 }; | ||
920 | #endif | ||
921 | |||
922 | all_fmt = LIST_SHORT | DISP_NORMAL | STYLE_AUTO | 918 | all_fmt = LIST_SHORT | DISP_NORMAL | STYLE_AUTO |
923 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS | 919 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
924 | | TIME_MOD | 920 | | TIME_MOD |
@@ -927,11 +923,10 @@ extern int ls_main(int argc, char **argv) | |||
927 | | SORT_NAME | SORT_ORDER_FORWARD | 923 | | SORT_NAME | SORT_ORDER_FORWARD |
928 | #endif | 924 | #endif |
929 | ; | 925 | ; |
930 | #ifdef CONFIG_FEATURE_AUTOWIDTH | 926 | /* Obtain the terminal width. */ |
931 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 927 | get_terminal_width_height(0, &terminal_width, NULL); |
932 | if (win.ws_col > 0) | 928 | /* Go one less... */ |
933 | terminal_width = win.ws_col - 1; | 929 | terminal_width--; |
934 | #endif | ||
935 | nfiles = 0; | 930 | nfiles = 0; |
936 | 931 | ||
937 | #ifdef CONFIG_FEATURE_LS_COLOR | 932 | #ifdef CONFIG_FEATURE_LS_COLOR |