summaryrefslogtreecommitdiff
path: root/boot/boot.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-02-14 22:01:40 +0000
committerMiles Bader <miles@gnu.org>1996-02-14 22:01:40 +0000
commit5f31d95c75dc3165e4cd8ac11a5c7e238c06575e (patch)
treeb1a1b167be57e198f932d97ceb6a14d47cb52014 /boot/boot.c
parent9d196745cde3e711b0c49f941d692e236ef72cd7 (diff)
[!UX] (orig_tty_state): New variable.
[!UX] (init_termstate, restore_termstate): New hurd versions of these funcs.
Diffstat (limited to 'boot/boot.c')
-rw-r--r--boot/boot.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/boot/boot.c b/boot/boot.c
index 70c600f3..522fedff 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -61,8 +61,33 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <termios.h>
+#include <error.h>
#include <hurd.h>
+static struct termios orig_tty_state;
+
+static void
+init_termstate ()
+{
+ struct termios tty_state;
+
+ if (tcgetattr (0, &tty_state) < 0)
+ error (10, errno, "tcgetattr");
+
+ orig_tty_state = tty_state;
+ cfmakeraw (&tty_state);
+
+ if (tcsetattr (0, 0, &tty_state) < 0)
+ error (11, errno, "tcsetattr");
+}
+
+static void
+restore_termstate ()
+{
+ tcsetattr (0, 0, &orig_tty_state);
+}
+
#define host_fstat fstat
typedef struct stat host_stat_t;
#define host_exit exit
@@ -89,6 +114,7 @@ vm_address_t fs_stack_base;
vm_size_t fs_stack_size;
void init_termstate ();
+void restore_termstate ();
char *fsname;
@@ -958,48 +984,19 @@ bootstrap_compat(in, out)
reply->RetCode = MIG_NO_REPLY;
}
-
+#ifdef notanymore
/* Imlementiation of tioctl interface */
+
+#include <termios.h>
+#undef tcgetattr
+#undef tcsetattr
+
/* This is bletcherously kludged to work with emacs in a fragile
way. */
int term_modes[4];
char term_ccs[20];
int term_speeds[2];
-struct sgttyb term_sgb;
-int localbits;
-
-#define ICANON (1 << 8)
-
-void
-init_termstate ()
-{
- struct sgttyb sgb;
- int bits;
- ioctl (0, TIOCGETP, &term_sgb);
- ioctl (0, TIOCLGET, &localbits);
- /* Enter raw made. Rather than try and interpret these bits,
- we just do what emacs does in .../emacs/src/sysdep.c for
- an old style terminal driver. */
- bits = localbits | LDECCTQ | LLITOUT | LPASS8 | LNOFLSH;
- ioctl (0, TIOCLSET, &bits);
- sgb = term_sgb;
- sgb.sg_flags &= ~ECHO;
- sgb.sg_flags |= RAW | ANYP;
- ioctl (0, TIOCSETN, &sgb);
-}
-
-void
-restore_termstate ()
-{
- ioctl (0, TIOCLSET, &localbits);
- ioctl (0, TIOCSETN, &term_sgb);
-}
-
-#ifdef notanymore
-#include <termios.h>
-#undef tcgetattr
-#undef tcsetattr
kern_return_t
S_tioctl_tiocgeta (mach_port_t port,
@@ -1036,6 +1033,8 @@ S_tioctl_tiocgeta (mach_port_t port,
#endif
}
+#define ICANON (1 << 8)
+
kern_return_t
S_tioctl_tiocseta (mach_port_t port,
int modes[],
@@ -1105,9 +1104,9 @@ S_tioctl_tiocsetaf (mach_port_t port,
{
return S_tioctl_tiocseta (port, modes, ccs, speeds);
}
-#endif /* notanymore */
-
+#endif /* notanymore */
+
/* Implementation of device interface */
kern_return_t