return line_read;
return string();
}
-
-static int silent_getch ( void )
-{
- int ch;
- struct termios oldt, newt;
-
- tcgetattr ( STDIN_FILENO, &oldt );
- newt = oldt;
- newt.c_lflag &= ~( ICANON | ECHO );
- tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
- ch = getchar();
- tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
-
- return ch;
-}
-
-/** FIXME is there really not some nice standard library call for this???
- * is it possible to get this from readline? */
-/** \todo restore old terminal settings on interrupt */
-string get_password()
-{
- int ch;
- char pw[20];
- unsigned i = 0;
-
- while ((ch = silent_getch()) != EOF
- && ch != '\n'
- && ch != '\r'
- && i < sizeof(pw) - 1)
- {
- if (i && (ch == '\b' || ch == 127 /* DEL */))
- {
-// printf("\b \b"); // does not work for me :O(
-// fflush(stdout);
- pw[--i] = '\0';
- }
- else if (isalnum(ch))
- {
-// putchar('*');
- pw[i++] = (char)ch;
- }
- }
-
- pw[i] = '\0';
- cout << endl;
-
- return pw;
-}
*/
std::string get_text(const std::string & prompt, const std::string & prefilled = "");
-/**
- * Get text from user without showing the typed text on the terminal.
- * Uses getchar(), not suitable for machines.
- */
-std::string get_password();
-
/*
enum Error {
NO_ERROR,