FACT++  1.0
string Readline::Prompt ( const std::string &  prompt)
virtual

This function is a wrapper around the call to readline. It encapsultes the return buffer into a std::string and deletes the memory allocated by readline. Furthermore, it removes leading and trailing whitespaces before return the result. Before the function returns Shutdown() is called (as opposed to Startup when readline starts)

Parameters
promptThe prompt which is to be shown by the readline libarary. it is directly given to the call to readline.
Returns
The result of the readline call

Definition at line 1281 of file Readline.cc.

References Memory::free(), Shutdown(), str, and Tools::Trim().

Referenced by GetUpdatePrompt(), and Run().

1282 {
1283  char *buf = readline(prompt.c_str());
1284 
1285  Shutdown(buf ? buf : "");
1286 
1287  const string str = !buf || (rl_done && rl_pending_input==4)
1288  ? ".q" : Tools::Trim(buf);
1289 
1290  free(buf);
1291 
1292  return str;
1293 }
char str[80]
Definition: test_client.c:7
virtual void Shutdown(const char *buf)
Definition: Readline.cc:353
void free(void *mem)
std::string Trim(const std::string &str)
Definition: tools.cc:68

+ Here is the call graph for this function:

+ Here is the caller graph for this function: