FACT++  1.0
bool Readline::PromptEOF ( std::string &  str)
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. The result is returned in the given argument containing the prompt. Before the function returns Shutdown() is called (as opposed to Startup when readline starts)

Parameters
strThe prompt which is to be shown by the readline libarary. it is directly given to the call to readline. The result of the readline call is returned in this string.
Returns
true if the call succeeded as usual, false if EOF was detected by the readline call.

Definition at line 1250 of file Readline.cc.

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

Referenced by GetUpdatePrompt().

1251 {
1252  char *buf = readline(str.c_str());
1253  Shutdown(buf);
1254 
1255  // Happens when EOF is encountered
1256  if (!buf)
1257  return false;
1258 
1259  str = Tools::Trim(buf);
1260 
1261  free(buf);
1262 
1263  return true;
1264 }
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: