18 #include <readline/readline.h> 19 #include <readline/history.h> 32 if (
char * line_read = ::readline( prompt_r.c_str() ) )
37 ::add_history( line_read );
50 if ( !::isatty(STDOUT_FILENO) )
55 const char *cols_env = getenv(
"COLUMNS");
57 width = ::atoi( cols_env );
62 ::rl_get_screen_size( NULL, &width );
77 std::ifstream stm(
"/dev/tty" );
79 while (stm.good() && stm.readsome(s, 8));
unsigned get_screen_width()
Reads COLUMNS environment variable or gets the screen width from readline, in that order...
void clear_keyboard_buffer()
Clear the keyboard buffer.
std::string readline_getline(std::string prompt_r)
Use readline to get line of input.