]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tset.c
ncurses 6.4 - patch 20240413
[ncurses.git] / progs / tset.c
index 62611b3d40dbfed89695232105a0a1e461b9a46f..8bc502a36967b7afeabe4709ca3641b893262106 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 2020-2021,2024 Thomas E. Dickey                                *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
 #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.130 2021/10/02 18:08:09 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.134 2024/04/13 18:59:53 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";
@@ -874,9 +878,13 @@ main(int argc, char **argv)
 
            if (!noinit) {
                if (send_init_strings(my_fd, &oldmode)) {
+                   const char *name;
+
                    (void) putc('\r', stderr);
                    (void) fflush(stderr);
-                   (void) napms(1000);         /* Settle the terminal. */
+                   if (IsRealTty(my_fd, name)) {
+                       (void) napms(1000);     /* Settle the terminal. */
+                   }
                }
            }