/****************************************************************************
- * Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2015,2016 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 <dump_entry.h>
#include <transform.h>
-MODULE_ID("$Id: tset.c,v 1.97 2015/11/08 01:45:47 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.99 2016/07/24 00:07:16 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
obsolete(argv);
noinit = noset = quiet = Sflag = sflag = showterm = 0;
- while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:np:qQSrsVw")) != -1) {
+ while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:p:qQSrsVw")) != -1) {
switch (ch) {
case 'c': /* set control-chars */
opt_c = TRUE;
case 'm': /* map identifier to type */
add_mapping(0, optarg);
break;
- case 'n': /* OBSOLETE: set new tty driver */
- break;
case 'p': /* OBSOLETE: map identifier to type */
add_mapping("plugboard", optarg);
break;
if (!opt_c && !opt_w)
opt_c = opt_w = TRUE;
- if (GET_TTY(STDERR_FILENO, &mode) < 0)
- failed("standard error");
+ /*
+ * stderr is less likely to be redirected than stdout; try that first.
+ */
+ if (GET_TTY(STDERR_FILENO, &mode) < 0 &&
+ GET_TTY(STDOUT_FILENO, &mode) < 0) {
+ failed("terminal attributes");
+ }
can_restore = TRUE;
original = oldmode = mode;
#ifdef TERMIOS