diff options
author | Erik Andersen | 2000-04-21 01:26:49 +0000 |
---|---|---|
committer | Erik Andersen | 2000-04-21 01:26:49 +0000 |
commit | 1d1d95051a288b6bf64498aac9fb20047f384b7d (patch) | |
tree | 2c99ce8ba7d4d592806fbf81899e663bc884676b /more.c | |
parent | cf8d38a3eb46f4f9c4e674d43cff486cd79c9c0f (diff) | |
download | busybox-1d1d95051a288b6bf64498aac9fb20047f384b7d.zip busybox-1d1d95051a288b6bf64498aac9fb20047f384b7d.tar.gz |
More Doc updates. cmdedit and more termio fixes.
Diffstat (limited to 'more.c')
-rw-r--r-- | more.c | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -33,17 +33,26 @@ static const char more_usage[] = "more [file ...]\n"; +/* ED: sparc termios is broken: revert back to old termio handling. */ #ifdef BB_FEATURE_USE_TERMIOS -#include <termio.h> +#if #cpu(sparc) +# include <termio.h> +# define termios termio +# define setTermSettings(fd,argp) ioctl(fd,TCSETAF,argp) +# define getTermSettings(fd,argp) ioctl(fd,TCGETA,argp) +#else +# include <termios.h> +# define setTermSettings(fd,argp) tcsetattr(fd,TCSANOW,argp) +# define getTermSettings(fd,argp) tcgetattr(fd, argp); +#endif FILE *cin; -/* sparc and other have broken termios support: use old termio handling. */ -struct termio initial_settings, new_settings; +struct termios initial_settings, new_settings; void gotsig(int sig) { - ioctl(fileno(cin), TCSETAF, &initial_settings); + setTermSettings(fileno(cin), &initial_settings); fprintf(stdout, "\n"); exit(TRUE); } @@ -98,11 +107,11 @@ extern int more_main(int argc, char **argv) cin = fopen("/dev/tty", "r"); if (!cin) cin = fopen("/dev/console", "r"); - ioctl(fileno(cin), TCGETA, &initial_settings); + getTermSettings(fileno(cin), &initial_settings); new_settings = initial_settings; new_settings.c_lflag &= ~ICANON; new_settings.c_lflag &= ~ECHO; - ioctl(fileno(cin), TCSETAF, &new_settings); + setTermSettings(fileno(cin), &new_settings); #ifdef BB_FEATURE_AUTOWIDTH ioctl(fileno(stdout), TIOCGWINSZ, &win); |