/****************************************************************************
- * 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.128 2021/04/03 23:03:48 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.135 2024/04/20 22:20:41 tom Exp $")
#ifndef environ
extern char **environ;
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;
if ((ttype = getenv("TERM")) != 0)
goto map;
+#if HAVE_PATH_TTYS
if ((ttypath = ttyname(fd)) != 0) {
p = _nc_basename(ttypath);
#if HAVE_GETTTYNAM
}
#endif /* HAVE_GETTTYNAM */
}
+#endif /* HAVE_PATH_TTYS */
/* If still undefined, use "unknown". */
ttype = "unknown";
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) {
}
}
- _nc_progname = _nc_rootname(*argv);
argc -= optind;
argv += optind;
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);
}
if (!noset) {
#if HAVE_SIZECHANGE
if (opt_w) {
- set_window_size(my_fd, &lines, &columns);
+ NCURSES_INT2 my_rows = lines;
+ NCURSES_INT2 my_cols = columns;
+ set_window_size(my_fd, &my_rows, &my_cols);
+ lines = my_rows;
+ columns = my_cols;
}
#endif
if (opt_c) {
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. */
+ }
}
}