mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 13:32:45 +00:00
Don't call -f option's argument "stdin".
MFC after: 3 days
This commit is contained in:
parent
51f95b0a42
commit
a35a58824b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221372
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user