diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-26 18:09:13 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-01-26 18:09:13 +0000 |
commit | 5641b8c2b0d61a2a731fed115db517d320b3a207 (patch) | |
tree | f93ba969c8141b1d405d94251ddc6ad1b3bbd25e /ls.c | |
parent | d90dacacf9a823d8ed2210a6aad7e9099fdd8ad8 (diff) | |
download | busybox-w32-5641b8c2b0d61a2a731fed115db517d320b3a207.tar.gz busybox-w32-5641b8c2b0d61a2a731fed115db517d320b3a207.tar.bz2 busybox-w32-5641b8c2b0d61a2a731fed115db517d320b3a207.zip |
I am an idiot. Looking over my patch, ls doesn't need to do anything
more then the ioctl to get the win size. None of the termios handling
crap is needed.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@1681 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'ls.c')
-rw-r--r-- | ls.c | 52 |
1 files changed, 1 insertions, 51 deletions
@@ -185,31 +185,6 @@ static int status = EXIT_SUCCESS; | |||
185 | unsigned long ls_disp_hr = KILOBYTE; | 185 | unsigned long ls_disp_hr = KILOBYTE; |
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | /* sparc termios is broken -- use old termio handling. */ | ||
189 | #ifdef BB_FEATURE_USE_TERMIOS | ||
190 | # if #cpu(sparc) | ||
191 | # include <termio.h> | ||
192 | # define termios termio | ||
193 | # define setTermSettings(fd,argp) ioctl(fd,TCSETAF,argp) | ||
194 | # define getTermSettings(fd,argp) ioctl(fd,TCGETA,argp) | ||
195 | # else | ||
196 | # include <termios.h> | ||
197 | # define setTermSettings(fd,argp) tcsetattr(fd,TCSANOW,argp) | ||
198 | # define getTermSettings(fd,argp) tcgetattr(fd, argp); | ||
199 | # endif | ||
200 | |||
201 | static FILE *cin; | ||
202 | |||
203 | static struct termios initial_settings, new_settings; | ||
204 | |||
205 | static void gotsig(int sig) | ||
206 | { | ||
207 | setTermSettings(fileno(cin), &initial_settings); | ||
208 | putchar('\n'); | ||
209 | exit(EXIT_FAILURE); | ||
210 | } | ||
211 | #endif /* BB_FEATURE_USE_TERMIOS */ | ||
212 | |||
213 | static int my_stat(struct dnode *cur) | 188 | static int my_stat(struct dnode *cur) |
214 | { | 189 | { |
215 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 190 | #ifdef BB_FEATURE_LS_FOLLOWLINKS |
@@ -736,7 +711,7 @@ extern int ls_main(int argc, char **argv) | |||
736 | int opt; | 711 | int opt; |
737 | int oi, ac; | 712 | int oi, ac; |
738 | char **av; | 713 | char **av; |
739 | #if defined BB_FEATURE_AUTOWIDTH && defined BB_FEATURE_USE_TERMIOS | 714 | #ifdef BB_FEATURE_AUTOWIDTH |
740 | struct winsize win = { 0, 0, 0, 0 }; | 715 | struct winsize win = { 0, 0, 0, 0 }; |
741 | #endif | 716 | #endif |
742 | 717 | ||
@@ -751,32 +726,11 @@ extern int ls_main(int argc, char **argv) | |||
751 | time_fmt= TIME_MOD; | 726 | time_fmt= TIME_MOD; |
752 | #endif | 727 | #endif |
753 | #ifdef BB_FEATURE_AUTOWIDTH | 728 | #ifdef BB_FEATURE_AUTOWIDTH |
754 | #ifdef BB_FEATURE_USE_TERMIOS | ||
755 | cin = fopen("/dev/tty", "r"); | ||
756 | if (!cin) | ||
757 | cin = fopen("/dev/console", "r"); | ||
758 | getTermSettings(fileno(cin), &initial_settings); | ||
759 | new_settings = initial_settings; | ||
760 | new_settings.c_cc[VMIN] = 1; | ||
761 | new_settings.c_cc[VTIME] = 0; | ||
762 | new_settings.c_lflag &= ~ICANON; | ||
763 | new_settings.c_lflag &= ~ECHO; | ||
764 | setTermSettings(fileno(cin), &new_settings); | ||
765 | |||
766 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 729 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
767 | if (win.ws_row > 4) | 730 | if (win.ws_row > 4) |
768 | column_width = win.ws_row - 2; | 731 | column_width = win.ws_row - 2; |
769 | if (win.ws_col > 0) | 732 | if (win.ws_col > 0) |
770 | terminal_width = win.ws_col - 1; | 733 | terminal_width = win.ws_col - 1; |
771 | |||
772 | (void) signal(SIGINT, gotsig); | ||
773 | (void) signal(SIGQUIT, gotsig); | ||
774 | (void) signal(SIGTERM, gotsig); | ||
775 | #else | ||
776 | |||
777 | terminal_width = TERMINAL_WIDTH; | ||
778 | column_width = COLUMN_WIDTH; | ||
779 | #endif | ||
780 | #endif | 734 | #endif |
781 | tabstops = 8; | 735 | tabstops = 8; |
782 | nfiles=0; | 736 | nfiles=0; |
@@ -963,10 +917,6 @@ extern int ls_main(int argc, char **argv) | |||
963 | showdirs(dnd, dndirs); | 917 | showdirs(dnd, dndirs); |
964 | } | 918 | } |
965 | } | 919 | } |
966 | |||
967 | #ifdef BB_FEATURE_USE_TERMIOS | ||
968 | gotsig(0); | ||
969 | #endif | ||
970 | return(status); | 920 | return(status); |
971 | 921 | ||
972 | print_usage_message: | 922 | print_usage_message: |