diff options
Diffstat (limited to 'coreutils/ls.c')
-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 |