Always assume that stdin is not a terminal when tcgetattr fails, instead of

printing an error message.
This commit is contained in:
Ned T. Crigler 2007-04-23 18:12:31 +00:00
parent 99e7138017
commit 0b9fe28288
1 changed files with 3 additions and 11 deletions

14
main.c
View File

@ -211,17 +211,8 @@ main(int argc, char **argv)
/* Save the original terminal settings. */
if (tcgetattr(0, &orig_term) < 0)
{
if (errno == ENOTTY)
{
memset(&orig_term, 0, sizeof(struct termios));
dont_have_tty = 1;
}
else
{
printf("%s: tcgetattr: %s\n", progname,
strerror(errno));
return 1;
}
memset(&orig_term, 0, sizeof(struct termios));
dont_have_tty = 1;
}
if (dont_have_tty && mode != 'n')
@ -230,6 +221,7 @@ main(int argc, char **argv)
progname);
return 1;
}
if (mode == 'a')
{
if (argc > 0)