aboutsummaryrefslogtreecommitdiff
path: root/util-linux
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
parentcf8d38a3eb46f4f9c4e674d43cff486cd79c9c0f (diff)
downloadbusybox-1d1d95051a288b6bf64498aac9fb20047f384b7d.tar.gz
More Doc updates. cmdedit and more termio fixes.
Diffstat (limited to 'util-linux')
-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 @@
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);