Added special handling for entering ' in Inputboxes.

This commit is contained in:
Fritz Elfert 1997-03-10 09:50:14 +00:00
parent 9e9c64d9be
commit f497e625d1
1 changed files with 20 additions and 2 deletions

View File

@ -204,8 +204,26 @@ j_inputbox (const char *t, int ac, const char * const * av)
{
int ret = dialog_inputbox (t, av[2], atoi (av[3]), atoi (av[4]),
ac == 6 ? av[5] : (char *) NULL);
if (ret == 0)
fputs(dialog_input_result, stderr);
if (ret == 0) {
unsigned char escaped_result[MAX_LEN+1];
unsigned char *p = escaped_result;
unsigned char *q = dialog_input_result;
while (*q) {
if (*q == '\'') {
*p++ = '\\';
*p++ = '"';
*p++ = '0';
*p++ = '4';
*p++ = '7';
*p++ = '"';
q++;
} else
*p++ = *q++;
};
*p = '\0';
fputs(escaped_result, stderr);
}
return ret;
}