Go to the source code of this file.
◆ simple_prompt()
char* simple_prompt |
( |
const char * |
prompt, |
|
|
bool |
echo |
|
) |
| |
Definition at line 38 of file sprompt.c.
References _, pg_get_line(), pg_strdup(), and pg_strip_crlf().
Referenced by connectDatabase(), ConnectDatabase(), doConnect(), exec_command_password(), exec_command_prompt(), get_su_pwd(), GetConnection(), main(), prompt_for_password(), sql_conn(), vacuumlo(), and yesno_prompt().
43 #if defined(HAVE_TERMIOS_H) 44 struct termios t_orig,
71 termin = fopen(
"CONIN$",
"w+");
72 termout = fopen(
"CONOUT$",
"w+");
79 termin = fopen(
"/dev/tty",
"r");
80 termout = fopen(
"/dev/tty",
"w");
82 if (!termin || !termout
91 || (getenv(
"OSTYPE") && strcmp(getenv(
"OSTYPE"),
"msys") == 0)
105 #if defined(HAVE_TERMIOS_H) 107 tcgetattr(fileno(termin), &t);
110 tcsetattr(fileno(termin), TCSAFLUSH, &t);
113 t = (HANDLE) _get_osfhandle(_fileno(termin));
116 GetConsoleMode(t, &t_orig);
119 SetConsoleMode(t, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
125 fputs(
_(prompt), termout);
141 #if defined(HAVE_TERMIOS_H) 142 tcsetattr(fileno(termin), TCSAFLUSH, &t_orig);
143 fputs(
"\n", termout);
146 SetConsoleMode(t, t_orig);
147 fputs(
"\n", termout);
int pg_strip_crlf(char *str)
char * pg_strdup(const char *in)
char * pg_get_line(FILE *stream)