diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2002-04-19 23:58:00 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2002-04-19 23:58:00 +0000 |
commit | 91ae52cb17311050793a5b60c5ae054da6a83db6 (patch) | |
tree | 4e45febc1e60bb431e422cb54792c7db82c099ff /usr.bin/xargs/xargs.c | |
parent | 5e61dfa3ca6b67a7f0369c23abcd15eaff28cf93 (diff) | |
download | src-91ae52cb17311050793a5b60c5ae054da6a83db6.tar.gz src-91ae52cb17311050793a5b60c5ae054da6a83db6.zip |
In the case where we can't open /dev/tty, fall back to -t behaviour.
Submitted by: fenner
Notes
Notes:
svn path=/head/; revision=95085
Diffstat (limited to 'usr.bin/xargs/xargs.c')
-rw-r--r-- | usr.bin/xargs/xargs.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 06a9adfa30e8..1ec7766f18c1 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -392,15 +392,13 @@ run(char **argv) (void)fprintf(stderr, "%s", *argv); for (p = argv + 1; *p; ++p) (void)fprintf(stderr, " %s", *p); - if (pflag) { - if ((ttyfp = fopen("/dev/tty", "r")) != NULL) { - (void)fprintf(stderr, "?"); - (void)fflush(stderr); - ch = getc(ttyfp); - fclose(ttyfp); - if (ch != 'y') - return; - } + if (pflag && (ttyfp = fopen("/dev/tty", "r")) != NULL) { + (void)fprintf(stderr, "?"); + (void)fflush(stderr); + ch = getc(ttyfp); + fclose(ttyfp); + if (ch != 'y') + return; } else { (void)fprintf(stderr, "\n"); (void)fflush(stderr); |