Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions code/shell.l
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <readline/history.h>
#include <stdlib.h>
#include <functional>
#include <cstdlib>
using namespace std;
/*
This piece is added only if commandline editing (via GNU Readline and
Expand All @@ -49,6 +50,15 @@ static int inp_readline(char *buf, size_t max_size)
{
int n,result;
static size_t index=0;
//
// Set the TERM env variable if it does not exist. readline() call
// seg. faults if TERM env variable does not exist. readline()
// (perhaps due to terminfo) is robust to the value of the TERM
// variable -- a blank seems sufficient for it to figure out the
// capabilities of the terminal (at least it does not seg. fault).
//
if (getenv("TERM")==NULL) setenv("TERM","",1);

if (rl_instream == NULL) rl_instream=stdin;
if (rl_outstream == NULL) rl_outstream=stderr;
if (index==0)
Expand Down
Loading