59 #if defined(HAVE_TERMIOS_H)
60 struct termios t_orig,
87 termin = fopen(
"CONIN$",
"w+");
88 termout = fopen(
"CONOUT$",
"w+");
95 termin = fopen(
"/dev/tty",
"r");
96 termout = fopen(
"/dev/tty",
"w");
98 if (!termin || !termout
107 || (getenv(
"OSTYPE") && strcmp(getenv(
"OSTYPE"),
"msys") == 0)
121 #if defined(HAVE_TERMIOS_H)
123 tcgetattr(fileno(termin), &t);
126 tcsetattr(fileno(termin), TCSAFLUSH, &t);
129 t = (HANDLE) _get_osfhandle(_fileno(termin));
132 GetConsoleMode(t, &t_orig);
135 SetConsoleMode(t, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
141 fputs(
_(prompt), termout);
157 #if defined(HAVE_TERMIOS_H)
158 tcsetattr(fileno(termin), TCSAFLUSH, &t_orig);
159 fputs(
"\n", termout);
162 SetConsoleMode(t, t_orig);
163 fputs(
"\n", termout);
167 else if (prompt_ctx && prompt_ctx->
canceled)
170 fputs(
"\n", termout);
char * pg_strdup(const char *in)
static void const char fflush(stdout)
char * pg_get_line(FILE *stream, PromptInterruptContext *prompt_ctx)
char * simple_prompt_extended(const char *prompt, bool echo, PromptInterruptContext *prompt_ctx)
char * simple_prompt(const char *prompt, bool echo)
int pg_strip_crlf(char *str)