]> git.wh0rd.org Git - nano.git/commitdiff
- nano.c: - Move the termios things in main() up to signal_init(), where they should...
authorChris Allegretta <chrisa@asty.org>
Fri, 29 Mar 2002 15:31:54 +0000 (15:31 +0000)
committerChris Allegretta <chrisa@asty.org>
Fri, 29 Mar 2002 15:31:54 +0000 (15:31 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1156 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
nano.c

index 540ea9f46a19000ae879f705eb01a8bd6a2cc858..df089328c2a5a13b2328eb927fe2722d17534479 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,8 @@ CVS code -
        - Change input var to one char instead of array (David Benbennick).
        - Move NO_CONVERT check up so chars get read in properly (DLR).
 - nano.c:
+       - Move the termios things in main() up to signal_init(), where
+         they should probably be anyway.
   do_justify()
        - More fixes for indented justify (David Benbennick).
   do_int_speller()
diff --git a/nano.c b/nano.c
index cfb666f358a1434e1771863deeb183c21f78fdd6..2cd5ea3e91fe6cc3bd5450aaf255de177817d828 100644 (file)
--- a/nano.c
+++ b/nano.c
@@ -2038,7 +2038,12 @@ void signal_init(void)
 
 
 #ifdef _POSIX_VDISABLE
-    tcgetattr(0, &term);
+    tcgetattr(0, &oldterm);
+
+    term = oldterm;
+    term.c_cc[VINTR] = _POSIX_VDISABLE;
+    term.c_cc[VQUIT] = _POSIX_VDISABLE;
+    term.c_lflag &= ~IEXTEN;
 
 #ifdef VDSUSP
     term.c_cc[VDSUSP] = _POSIX_VDISABLE;
@@ -2733,10 +2738,6 @@ int main(int argc, char *argv[])
     toggle *t;
 #endif
 
-#ifdef _POSIX_VDISABLE
-    struct termios term;
-#endif
-
 #ifdef HAVE_GETOPT_LONG
     int option_index = 0;
     struct option long_options[] = {
@@ -2975,18 +2976,6 @@ int main(int argc, char *argv[])
            filename = mallocstrcpy(filename, argv[optind]);
     }
 
-
-    /* First back up the old settings so they can be restored, duh */
-    tcgetattr(0, &oldterm);
-
-#ifdef _POSIX_VDISABLE
-    term = oldterm;
-    term.c_cc[VINTR] = _POSIX_VDISABLE;
-    term.c_cc[VQUIT] = _POSIX_VDISABLE;
-    term.c_lflag &= ~IEXTEN;
-    tcsetattr(0, TCSANOW, &term);
-#endif
-
     /* now ncurses init stuff... */
     initscr();
     savetty();