]> granicus.if.org Git - sudo/commitdiff
Instead of messing with line endings, just set terminal to raw mode
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Sep 2009 22:39:40 +0000 (22:39 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 27 Sep 2009 22:39:40 +0000 (22:39 +0000)
in sudoreplay.

Makefile.in
sudoreplay.c
term.c

index 0f128eeea27a04179f67c13860b16c29dee29181..c995abaa5d90d2f3043c8d049755f394b73ccc3c 100644 (file)
@@ -131,12 +131,12 @@ AUTH_OBJS = sudo_auth.o @AUTH_OBJS@
 # Note: gram.o must come first here
 COMMON_OBJS = alias.o alloc.o defaults.o error.o getline.o gram.o \
              list.o match.o pwutil.o timestr.o toke.o redblack.o \
-             zero_bytes.o @NONUNIX_GROUPS_IMPL@
+             term.o zero_bytes.o @NONUNIX_GROUPS_IMPL@
 
 SUDO_OBJS = $(AUTH_OBJS) @SUDO_OBJS@ audit.o check.o \
            env.o getspwuid.o gettime.o goodpath.o fileops.o find_path.o \
            interfaces.o lbuf.o logging.o parse.o set_perms.o sudo.o \
-           sudo_edit.o sudo_nss.o term.o tgetpass.o
+           sudo_edit.o sudo_nss.o tgetpass.o
 
 VISUDO_OBJS = visudo.o fileops.o gettime.o goodpath.o find_path.o
 
index 3a5a0bb1243c9609a5f7b9448d95dfabaa9be7e6..9aa56edb942d6f2bb11612c881b408aa8687e94a 100644 (file)
@@ -272,10 +272,14 @@ main(argc, argv)
     free(cp);
     fclose(lfile);
 
+    /* Set stdout to raw mode if it is a tty */
+    /* XXX - reset terminal on signal */
+    fflush(stdout);
+    term_raw(STDOUT_FILENO);
+
     /*
      * Timing file consists of line of the format: "%f %d\n"
      */
-    fflush(stdout);
     while (fgets(buf, sizeof(buf), tfile) != NULL) {
        errno = 0;
        seconds = strtod(buf, &ep);
@@ -310,6 +314,7 @@ main(argc, argv)
            } while (nread);
        }
     }
+    term_restore(STDOUT_FILENO);
     exit(0);
 }
 
diff --git a/term.c b/term.c
index ca86c607c43eaaa307e863e93fc0edcf8c7b0b2c..92f381291eaeee01fee4e090aaa64abd9ff15d20 100644 (file)
--- a/term.c
+++ b/term.c
@@ -191,8 +191,6 @@ term_copy(src, dst)
 
     if (tcgetattr(src, &tt) != 0)
        return(0);
-    /* Do not convert line endings from NL to NLCR. */
-    CRL(tt.c_oflag, ONLCR);
     if (tcsetattr(dst, TCSAFLUSH, &tt) != 0)
        return(0);
     return(1);
@@ -251,8 +249,6 @@ term_copy(src, dst)
        ioctl(src, TIOCLGET, &lb)) {
        return(0);
     }
-    /* Do not convert line endings from NL to NLCR. */
-    CLR(b.sg_flags, CRMOD);
     if (ioctl(dst, TIOCSETP, &b) != 0 || ioctl(dst, TIOCSETC, &tc) != 0 ||
        ioctl(dst, TIOCSLTC, &lc) != 0 || ioctl(dst, TIOCLSET, &lb) != 0 ||
        ioctl(dst, TIOCSETD, &l) != 0) {