summaryrefslogtreecommitdiffstats
path: root/usr.bin/bc/bc.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/bc/bc.y')
-rw-r--r--usr.bin/bc/bc.y18
1 files changed, 18 insertions, 0 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index b00d140..b00d5ac 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <getopt.h>
+#include <histedit.h>
#include <limits.h>
#include <search.h>
#include <signal.h>
@@ -1106,6 +1107,13 @@ sigchld(int signo)
}
}
+static const char *
+dummy_prompt(void)
+{
+
+ return ("");
+}
+
int
main(int argc, char *argv[])
{
@@ -1173,6 +1181,16 @@ main(int argc, char *argv[])
dup(p[1]);
close(p[0]);
close(p[1]);
+ if (interactive) {
+ el = el_init("bc", stdin, stderr, stderr);
+ hist = history_init();
+ history(hist, &he, H_SETSIZE, 100);
+ el_set(el, EL_HIST, history, hist);
+ el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_SIGNAL, 1);
+ el_set(el, EL_PROMPT, dummy_prompt);
+ el_source(el, NULL);
+ }
} else {
close(STDIN_FILENO);
dup(p[0]);
OpenPOWER on IntegriCloud