/****************************************************************************
- * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <reset_cmd.h>
#include <termcap.h>
#include <transform.h>
+#include <tty_settings.h>
#if HAVE_GETTTYNAM && HAVE_TTYENT_H
#include <ttyent.h>
char *ttyname(int fd);
#endif
-MODULE_ID("$Id: tset.c,v 1.110 2016/08/27 18:06:47 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.116 2017/01/07 22:48:20 tom Exp $")
#ifndef environ
extern char **environ;
#define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c))
+static void exit_error(void) GCC_NORETURN;
+
static int
CaselessCmp(const char *a, const char *b)
{ /* strcasecmp isn't portable */
} else {
_nc_STRCPY(temp, "tset: ", sizeof(temp));
}
- perror(strncat(temp, msg, sizeof(temp) - strlen(temp) - 2));
+ _nc_STRNCAT(temp, msg, sizeof(temp), sizeof(temp) - strlen(temp) - 2);
+ perror(temp);
exit_error();
/* NOTREACHED */
}
ttype = askuser(0);
}
/* Find the terminfo entry. If it doesn't exist, ask the user. */
- while (setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, &errret)
+ while (setupterm((NCURSES_CONST char *) ttype, fd, &errret)
!= OK) {
if (errret == 0) {
(void) fprintf(stderr, "%s: unknown terminal type %s\n",
if (same_program(_nc_progname, PROG_RESET)) {
reset_start(stderr, TRUE, FALSE);
- reset_tty_settings(&mode);
+ reset_tty_settings(my_fd, &mode);
} else {
- reset_start(stderr, FALSE, FALSE);
+ reset_start(stderr, FALSE, TRUE);
}
ttype = get_termcap_entry(my_fd, *argv);
if (!noset) {
#if HAVE_SIZECHANGE
if (opt_w) {
- set_window_size(my_fd, lines, columns);
+ set_window_size(my_fd, &lines, &columns);
}
#endif
if (opt_c) {
set_conversions(&mode);
if (!noinit) {
- if (send_init_strings(&oldmode)) {
+ if (send_init_strings(my_fd, &oldmode)) {
(void) putc('\r', stderr);
(void) fflush(stderr);
(void) napms(1000); /* Settle the terminal. */