]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tset.c
ncurses 6.3 - patch 20211204
[ncurses.git] / progs / tset.c
index 7fd916346aee2346e6291579358d1395d0814615..0ba522cbc4c6eed57bf8f9fa4010894f8d54980e 100644 (file)
 #include <transform.h>
 #include <tty_settings.h>
 
-#if HAVE_GETTTYNAM && HAVE_TTYENT_H
+#if HAVE_GETTTYNAM
 #include <ttyent.h>
 #endif
 #ifdef NeXT
 char *ttyname(int fd);
 #endif
 
-MODULE_ID("$Id: tset.c,v 1.128 2021/04/03 23:03:48 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.131 2021/12/04 23:02:13 tom Exp $")
 
 #ifndef environ
 extern char **environ;
@@ -545,12 +545,14 @@ get_termcap_entry(int fd, char *userarg)
     int errret;
     char *p;
     const char *ttype;
+#if HAVE_PATH_TTYS
 #if HAVE_GETTTYNAM
     struct ttyent *t;
 #else
     FILE *fp;
 #endif
     char *ttypath;
+#endif /* HAVE_PATH_TTYS */
 
     (void) fd;
 
@@ -563,6 +565,7 @@ get_termcap_entry(int fd, char *userarg)
     if ((ttype = getenv("TERM")) != 0)
        goto map;
 
+#if HAVE_PATH_TTYS
     if ((ttypath = ttyname(fd)) != 0) {
        p = _nc_basename(ttypath);
 #if HAVE_GETTTYNAM
@@ -600,6 +603,7 @@ get_termcap_entry(int fd, char *userarg)
        }
 #endif /* HAVE_GETTTYNAM */
     }
+#endif /* HAVE_PATH_TTYS */
 
     /* If still undefined, use "unknown". */
     ttype = "unknown";
@@ -775,6 +779,7 @@ main(int argc, char **argv)
     bool opt_w = FALSE;                /* set window-size */
     TTY mode, oldmode;
 
+    _nc_progname = _nc_rootname(*argv);
     obsolete(argv);
     noinit = noset = quiet = Sflag = sflag = showterm = 0;
     while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:p:qQrSsVw")) != -1) {
@@ -833,7 +838,6 @@ main(int argc, char **argv)
        }
     }
 
-    _nc_progname = _nc_rootname(*argv);
     argc -= optind;
     argv += optind;
 
@@ -855,7 +859,7 @@ main(int argc, char **argv)
 
     if (same_program(_nc_progname, PROG_RESET)) {
        reset_start(stderr, TRUE, FALSE);
-       reset_tty_settings(my_fd, &mode);
+       reset_tty_settings(my_fd, &mode, noset);
     } else {
        reset_start(stderr, FALSE, TRUE);
     }