Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2011 05:30:07 +0000 (UTC)
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221723 - stable/8/bin/stty
Message-ID:  <201105100530.p4A5U7Vq028420@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ru
Date: Tue May 10 05:30:06 2011
New Revision: 221723
URL: http://svn.freebsd.org/changeset/base/221723

Log:
  MFC r221372: Don't call -f option's argument "stdin".

Modified:
  stable/8/bin/stty/stty.c
Directory Properties:
  stable/8/bin/stty/   (props changed)

Modified: stable/8/bin/stty/stty.c
==============================================================================
--- stable/8/bin/stty/stty.c	Tue May 10 04:32:27 2011	(r221722)
+++ stable/8/bin/stty/stty.c	Tue May 10 05:30:06 2011	(r221723)
@@ -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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105100530.p4A5U7Vq028420>