Disable history if envvar CLING_NOHISTORY is set - for fixed memory address.

This commit is contained in:
Axel Naumann 2014-02-06 17:34:56 +01:00 committed by sftnight
parent 2c2ada407e
commit c36da12a79

View File

@ -101,16 +101,18 @@ namespace cling {
PrintLogo(); PrintLogo();
} }
// History file is $HOME/.cling_history
static const char* histfile = ".cling_history";
llvm::SmallString<512> histfilePath; llvm::SmallString<512> histfilePath;
GetUserHomeDirectory(histfilePath); if (!getenv("CLING_NOHISTORY")) {
llvm::sys::path::append(histfilePath, histfile); // History file is $HOME/.cling_history
static const char* histfile = ".cling_history";
GetUserHomeDirectory(histfilePath);
llvm::sys::path::append(histfilePath, histfile);
}
using namespace textinput; using namespace textinput;
StreamReader* R = StreamReader::Create(); StreamReader* R = StreamReader::Create();
TerminalDisplay* D = TerminalDisplay::Create(); TerminalDisplay* D = TerminalDisplay::Create();
TextInput TI(*R, *D, histfilePath.c_str()); TextInput TI(*R, *D, histfilePath.empty() ? 0 : histfilePath.c_str());
TI.SetPrompt("[cling]$ "); TI.SetPrompt("[cling]$ ");
std::string line; std::string line;