fix dialog plugin to work again

(fgets, unlike gets, does not strip \n)
This commit is contained in:
Sergei Golubchik 2010-04-08 15:58:04 +02:00
parent 6e294768dc
commit c277c43a30

View File

@ -226,11 +226,17 @@ static char *builtin_ask(MYSQL *mysql __attribute__((unused)),
const char *prompt,
char *buf, int buf_len)
{
int len;
fputs(prompt, stdout);
fputc(' ', stdout);
if (fgets(buf, buf_len, stdin) == 0)
return 0;
len= strlen(buf);
if (len && buf[len-1]=='\n')
buf[len-1]=0;
return buf;
}