diff options
author | 2017-02-23 06:41:46 +0000 | |
---|---|---|
committer | 2017-02-23 06:41:46 +0000 | |
commit | 44fe112cc54161c30a877b4a5311b42b6f067c23 (patch) | |
tree | 31d04e951d3df23cc093c2573c38158b27a8776c | |
parent | Introduce e command, equivalent to p, but writes to stderr (diff) | |
download | wireguard-openbsd-44fe112cc54161c30a877b4a5311b42b6f067c23.tar.xz wireguard-openbsd-44fe112cc54161c30a877b4a5311b42b6f067c23.zip |
- write parse errors to stderr, prompted by Martijn Dekker
- we're only interactive if stdout en stderr are a tty as well as stdin
-rw-r--r-- | usr.bin/bc/bc.y | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y index 537e8bb832a..598906364a0 100644 --- a/usr.bin/bc/bc.y +++ b/usr.bin/bc/bc.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: bc.y,v 1.49 2015/11/23 09:58:55 otto Exp $ */ +/* $OpenBSD: bc.y,v 1.50 2017/02/23 06:41:46 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -969,7 +969,7 @@ yyerror(char *s) putchar('\\'); putchar(*p); } - fputs("]pc\n", stdout); + fputs("]ec\n", stdout); free(str); } @@ -1135,7 +1135,8 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - interactive = isatty(STDIN_FILENO); + interactive = isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) && + isatty(STDERR_FILENO); for (i = 0; i < argc; i++) sargv[sargc++] = argv[i]; |