summaryrefslogtreecommitdiff
path: root/usr.bin/bc/bc.y
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2012-03-08 08:20:09 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2012-03-08 08:20:09 +0000
commit2cb4357039a7adf0854c4d049c60a2b13d0941c5 (patch)
tree15dd64f30a493d9837068ab23ae3f87dacb9374d /usr.bin/bc/bc.y
parent8f57e1bff5634dfc91f225293e4b357660931a1b (diff)
allow editline in -d mode; from AIDA Shinra
Diffstat (limited to 'usr.bin/bc/bc.y')
-rw-r--r--usr.bin/bc/bc.y28
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/bc/bc.y b/usr.bin/bc/bc.y
index 1499a94ba94..aabcbff4228 100644
--- a/usr.bin/bc/bc.y
+++ b/usr.bin/bc/bc.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: bc.y,v 1.40 2011/10/06 14:37:56 otto Exp $ */
+/* $OpenBSD: bc.y,v 1.41 2012/03/08 08:20:08 otto Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -1144,19 +1144,6 @@ main(int argc, char *argv[])
dup(p[1]);
close(p[0]);
close(p[1]);
- if (interactive) {
- gettty(&ttysaved);
- 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, 0);
- el_set(el, EL_PROMPT, dummy_prompt);
- el_set(el, EL_ADDFN, "bc_eof", "", bc_eof);
- el_set(el, EL_BIND, "^D", "bc_eof", NULL);
- el_source(el, NULL);
- }
} else {
close(STDIN_FILENO);
dup(p[0]);
@@ -1166,6 +1153,19 @@ main(int argc, char *argv[])
err(1, "cannot find dc");
}
}
+ if (interactive) {
+ gettty(&ttysaved);
+ 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, 0);
+ el_set(el, EL_PROMPT, dummy_prompt);
+ el_set(el, EL_ADDFN, "bc_eof", "", bc_eof);
+ el_set(el, EL_BIND, "^D", "bc_eof", NULL);
+ el_source(el, NULL);
+ }
yywrap();
return yyparse();
}