* Editline and history functions (and glue).
History
*hist
; /* history cookie */
EditLine
*el
; /* editline cookie */
static FILE *el_in
, *el_out
;
extern int is_interactive
;
* Set history and editing status. Called whenever the status may
* have changed (figures out what to do).
out2str("sh: can't initialize history\n");
if (Eflag
&& !el
&& isatty(0)) { /* && isatty(2) ??? */
if (el_in
== NULL
|| el_out
== NULL
)
el
= el_init(arg0
, el_in
, el_out
);
el_set(el
, EL_HIST
, history_set
, hist
);
el_set(el
, EL_PROMPT
, getprompt
);
out2str("sh: can't initialize editing\n");
if (el
) /* XXX - -o vi etc... */
el_set(el
, EL_EDITOR
, "vi");
} else if (!Eflag
&& el
) {
if (el
) { /* no editing if not interactive */
cp
= lookupvar("HISTSIZE");
if (cp
== NULL
|| *cp
== '\0' ||
(histsize
= atoi(cp
)) < 0)
history_set(hist
, H_EVENT
, histsize
);