svn commit: r221372 - head/bin/stty
Ruslan Ermilov
ru at FreeBSD.org
Tue May 3 10:08:12 UTC 2011
Author: ru
Date: Tue May 3 10:08:11 2011
New Revision: 221372
URL: http://svn.freebsd.org/changeset/base/221372
Log:
Don't call -f option's argument "stdin".
MFC after: 3 days
Modified:
head/bin/stty/stty.c
Modified: head/bin/stty/stty.c
==============================================================================
--- head/bin/stty/stty.c Tue May 3 10:01:08 2011 (r221371)
+++ head/bin/stty/stty.c Tue May 3 10:08:11 2011 (r221372)
@@ -61,9 +61,11 @@ main(int argc, char *argv[])
struct info i;
enum FMT fmt;
int ch;
+ const char *file;
fmt = NOTSET;
i.fd = STDIN_FILENO;
+ file = "stdin";
opterr = 0;
while (optind < argc &&
@@ -79,6 +81,7 @@ main(int argc, char *argv[])
case 'f':
if ((i.fd = open(optarg, O_RDONLY | O_NONBLOCK)) < 0)
err(1, "%s", optarg);
+ file = optarg;
break;
case 'g':
fmt = GFLAG;
@@ -92,7 +95,7 @@ args: argc -= optind;
argv += optind;
if (tcgetattr(i.fd, &i.t) < 0)
- errx(1, "stdin isn't a terminal");
+ errx(1, "%s isn't a terminal", file);
if (ioctl(i.fd, TIOCGETD, &i.ldisc) < 0)
err(1, "TIOCGETD");
if (ioctl(i.fd, TIOCGWINSZ, &i.win) < 0)
More information about the svn-src-all
mailing list