From a3e4aad42fe23abd6dce3086fffffab49c7b8e24 Mon Sep 17 00:00:00 2001 From: mainzelm Date: Tue, 16 May 2006 13:31:41 +0000 Subject: [PATCH] Rearrange code --- scsh/tty1.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scsh/tty1.c b/scsh/tty1.c index 4596ce7..80e8f0a 100644 --- a/scsh/tty1.c +++ b/scsh/tty1.c @@ -85,17 +85,12 @@ s48_value scheme_tcgetattr(s48_value sch_fd, s48_value sch_control_chars) int *lflag, int *ispeed, int *ospeed)*/ { + S48_DECLARE_GC_PROTECT(6); struct termios t; int fd = s48_extract_fixnum(sch_fd); - - if (isatty(fd) == 0) { - fprintf(stderr, "%d is not a tty\n", fd); - return S48_FALSE; - } - - - int result = tcgetattr(s48_extract_fixnum (sch_fd), &t); int i; + int result; + s48_value sch_iflag = S48_UNSPECIFIC; s48_value sch_oflag = S48_UNSPECIFIC; s48_value sch_cflag = S48_UNSPECIFIC; @@ -103,7 +98,14 @@ s48_value scheme_tcgetattr(s48_value sch_fd, s48_value sch_control_chars) s48_value sch_ispeed = S48_UNSPECIFIC; s48_value sch_ospeed = S48_UNSPECIFIC; s48_value sch_retval = S48_UNSPECIFIC; - S48_DECLARE_GC_PROTECT(6); + + if (isatty(fd) == 0) { + fprintf(stderr, "%d is not a tty\n", fd); + return S48_FALSE; + } + + + result = tcgetattr(s48_extract_fixnum (sch_fd), &t); S48_GC_PROTECT_6(sch_iflag, sch_oflag, sch_cflag, sch_lflag, sch_ispeed, sch_ospeed); @@ -364,6 +366,7 @@ allocate_pty (void) int master_fd = -1; const char *slave_name = NULL; const char* clone = NULL; + int off = 0; s48_value scm_slave_name = S48_UNSPECIFIC; @@ -389,7 +392,6 @@ allocate_pty (void) tytso@mit.edu), but apparently it messed up rlogind and telnetd, so he removed the fix in pre2.0.14. - dkindred@cs.cmu.edu */ - int off = 0; ioctl (master_fd, TIOCPKT, (char *)&off); #endif /* TIOCPKT */