version 1.33, 2009/10/27 23:59:36 |
version 1.34, 2011/03/07 08:11:15 |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <err.h> |
#include <err.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <histedit.h> |
#include <limits.h> |
#include <limits.h> |
#include <search.h> |
#include <search.h> |
#include <signal.h> |
#include <signal.h> |
|
|
} |
} |
} |
} |
|
|
|
static const char * |
|
dummy_prompt(void) |
|
{ |
|
|
|
return (""); |
|
} |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
|
|
dup(p[1]); |
dup(p[1]); |
close(p[0]); |
close(p[0]); |
close(p[1]); |
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 { |
} else { |
close(STDIN_FILENO); |
close(STDIN_FILENO); |
dup(p[0]); |
dup(p[0]); |