aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-05-02 03:28:43 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-05-02 03:28:43 +0000
commit376b0e97f41ec9989602754a5c05a4f012899091 (patch)
treed76e6c43fec0c646ccd55bdc471428c3ba837684 /contrib/bc
parent3c33646725b8ee575936de0117ea70e4986b7d9d (diff)
downloadsrc-376b0e97f41ec9989602754a5c05a4f012899091.tar.gz
src-376b0e97f41ec9989602754a5c05a4f012899091.zip
If not interactive, we need the traditional behaviour of the input
not being echoed to the output. So as a _hack_ to get the world building again, redirect the readline rl_outstream to stderr when not interactive. The proper way to handle non-interactive mode is to read from stdin and don't worry about edit mode, but this is GNU so it's not worth the time thinking about. I'm already pissed off that I even had to look at this "nice code".
Notes
Notes: svn path=/head/; revision=35613
Diffstat (limited to 'contrib/bc')
-rw-r--r--contrib/bc/bc/main.c7
-rw-r--r--contrib/bc/bc/scan.l5
2 files changed, 8 insertions, 4 deletions
diff --git a/contrib/bc/bc/main.c b/contrib/bc/bc/main.c
index 0189e1904053..d2bbdfe29463 100644
--- a/contrib/bc/bc/main.c
+++ b/contrib/bc/bc/main.c
@@ -137,16 +137,19 @@ main (argc, argv)
char *env_value;
char *env_argv[30];
int env_argc;
+ extern FILE *rl_outstream;
/* Initialize many variables. */
compile_only = FALSE;
use_math = FALSE;
warn_not_std = FALSE;
std_only = FALSE;
- if (isatty(0) && isatty(1))
+ if (isatty(0) && isatty(1))
interactive = TRUE;
- else
+ else {
interactive = FALSE;
+ rl_outstream = stderr;
+ }
quiet = FALSE;
file_names = NULL;
diff --git a/contrib/bc/bc/scan.l b/contrib/bc/bc/scan.l
index 8b5b25dc142c..70c8df6a4167 100644
--- a/contrib/bc/bc/scan.l
+++ b/contrib/bc/bc/scan.l
@@ -63,6 +63,7 @@ static char *rl_start = (char *)NULL;
static char rl_len = 0;
/* Definitions for readline access. */
+extern FILE *rl_outstream;
extern FILE *rl_instream;
_PROTOTYPE(char *readline, (char *));
@@ -107,8 +108,8 @@ rl_input (buf, result, max)
if (rl_len != 1)
add_history (rl_line);
rl_line[rl_len-1] = '\n';
- printf ("\r");
- fflush (stdout);
+ fprintf (rl_outstream,"\r");
+ fflush (rl_outstream);
}
if (rl_len <= max)