Date: Wed, 28 Jun 1995 11:50:01 -0700 From: peter@haywire.dialix.com (Peter Wemm) To: freebsd-bugs Subject: bin/573: /bin/stty gives obscure error message on non-tty stdin Message-ID: <199506281850.LAA17756@freefall.cdrom.com> In-Reply-To: Your message of Thu, 29 Jun 1995 02:46:45 %2B0800 <199506281846.CAA06073@jhome.DIALix.COM>
index | next in thread | previous in thread | raw e-mail
>Number: 573
>Category: bin
>Synopsis: /bin/stty gives obscure error message on non-tty stdin
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs (FreeBSD bugs mailing list)
>State: open
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 28 11:50:00 1995
>Originator: Peter Wemm
>Organization:
DIALix Services
>Release: FreeBSD 2.0-BUILT-19950626 i386
>Environment:
FreeBSD-current
FreeBSD jhome.DIALix.COM 2.0-BUILT-19950626 FreeBSD 2.0-BUILT-19950626 #7: Mon Jun 26 04:47:14 WST 1995 pwroot@jhome.DIALix.COM:/usr/src/sys/compile/JHOME i386
>Description:
stty fails with a non-obvious error message if it's run on a non-tty stream,
such as a rsh or vi pipeline.
The error message is:
stty: TIOCGETD: Operation not supported
It's immediately obvious to the knowledgable hacker type, but not
exactly comforting to the user who's not native to unix. It's especially
confusing if there's a stty command in their .cshrc and it's showing up
on rsh output.
>How-To-Repeat:
rsh localhost stty
>Fix:
I suggest a slight rewording, for example:
stty: tcgetattr: not running on a terminal: Operation not supported
There surely are better messages...
Note that this is a REAL LOW priority.
--- stty.c.dist Tue May 30 17:51:44 1995
+++ stty.c Thu Jun 29 02:30:23 1995
@@ -95,10 +95,12 @@
args: argc -= optind;
argv += optind;
+ if (tcgetattr(i.fd, &i.t) < 0) {
+ warn("tcgetattr: not running on a terminal");
+ exit(1);
+ }
if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
err(1, "TIOCGETD");
- if (tcgetattr(i.fd, &i.t) < 0)
- err(1, "tcgetattr");
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
warn("TIOCGWINSZ: %s\n", strerror(errno));
>Audit-Trail:
>Unformatted:
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506281850.LAA17756>
