fix dialog plugin to work again
(fgets, unlike gets, does not strip \n)
This commit is contained in:
parent
6e294768dc
commit
c277c43a30
@ -226,11 +226,17 @@ static char *builtin_ask(MYSQL *mysql __attribute__((unused)),
|
|||||||
const char *prompt,
|
const char *prompt,
|
||||||
char *buf, int buf_len)
|
char *buf, int buf_len)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
fputs(prompt, stdout);
|
fputs(prompt, stdout);
|
||||||
fputc(' ', stdout);
|
fputc(' ', stdout);
|
||||||
if (fgets(buf, buf_len, stdin) == 0)
|
if (fgets(buf, buf_len, stdin) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
len= strlen(buf);
|
||||||
|
if (len && buf[len-1]=='\n')
|
||||||
|
buf[len-1]=0;
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user