aboutsummaryrefslogtreecommitdiff
path: root/util-linux/more.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-21 01:26:49 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-21 01:26:49 +0000
commit1d1d95051a288b6bf64498aac9fb20047f384b7d (patch)
tree2c99ce8ba7d4d592806fbf81899e663bc884676b /util-linux/more.c
parentcf8d38a3eb46f4f9c4e674d43cff486cd79c9c0f (diff)
downloadbusybox-w32-1d1d95051a288b6bf64498aac9fb20047f384b7d.tar.gz
busybox-w32-1d1d95051a288b6bf64498aac9fb20047f384b7d.tar.bz2
busybox-w32-1d1d95051a288b6bf64498aac9fb20047f384b7d.zip
More Doc updates. cmdedit and more termio fixes.
Diffstat (limited to 'util-linux/more.c')
-rw-r--r--util-linux/more.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/util-linux/more.c b/util-linux/more.c
index f84214905..20aa37095 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -33,17 +33,26 @@
33 33
34static const char more_usage[] = "more [file ...]\n"; 34static const char more_usage[] = "more [file ...]\n";
35 35
36/* ED: sparc termios is broken: revert back to old termio handling. */
36#ifdef BB_FEATURE_USE_TERMIOS 37#ifdef BB_FEATURE_USE_TERMIOS
37 38
38#include <termio.h> 39#if #cpu(sparc)
40# include <termio.h>
41# define termios termio
42# define setTermSettings(fd,argp) ioctl(fd,TCSETAF,argp)
43# define getTermSettings(fd,argp) ioctl(fd,TCGETA,argp)
44#else
45# include <termios.h>
46# define setTermSettings(fd,argp) tcsetattr(fd,TCSANOW,argp)
47# define getTermSettings(fd,argp) tcgetattr(fd, argp);
48#endif
39 49
40FILE *cin; 50FILE *cin;
41/* sparc and other have broken termios support: use old termio handling. */ 51struct termios initial_settings, new_settings;
42struct termio initial_settings, new_settings;
43 52
44void gotsig(int sig) 53void gotsig(int sig)
45{ 54{
46 ioctl(fileno(cin), TCSETAF, &initial_settings); 55 setTermSettings(fileno(cin), &initial_settings);
47 fprintf(stdout, "\n"); 56 fprintf(stdout, "\n");
48 exit(TRUE); 57 exit(TRUE);
49} 58}
@@ -98,11 +107,11 @@ extern int more_main(int argc, char **argv)
98 cin = fopen("/dev/tty", "r"); 107 cin = fopen("/dev/tty", "r");
99 if (!cin) 108 if (!cin)
100 cin = fopen("/dev/console", "r"); 109 cin = fopen("/dev/console", "r");
101 ioctl(fileno(cin), TCGETA, &initial_settings); 110 getTermSettings(fileno(cin), &initial_settings);
102 new_settings = initial_settings; 111 new_settings = initial_settings;
103 new_settings.c_lflag &= ~ICANON; 112 new_settings.c_lflag &= ~ICANON;
104 new_settings.c_lflag &= ~ECHO; 113 new_settings.c_lflag &= ~ECHO;
105 ioctl(fileno(cin), TCSETAF, &new_settings); 114 setTermSettings(fileno(cin), &new_settings);
106 115
107#ifdef BB_FEATURE_AUTOWIDTH 116#ifdef BB_FEATURE_AUTOWIDTH
108 ioctl(fileno(stdout), TIOCGWINSZ, &win); 117 ioctl(fileno(stdout), TIOCGWINSZ, &win);