Added function expand_escapes() which handles now escaping /EVAL and input

line if /SET expand_escapes is set. Supported escapes are \t, \r, \n, \e
(ESC), \x (HEX, \x1b), \c (CTRL char, \cA), \000 (octal, \033)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1727 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-08-08 20:00:25 +00:00 committed by cras
commit 98b82723a1
4 changed files with 68 additions and 20 deletions

View file

@ -703,6 +703,7 @@ static char *expand_escapes(const char *line, SERVER_REC *server,
WI_ITEM_REC *item)
{
char *ptr, *ret;
int chr;
ret = ptr = g_malloc(strlen(line)+1);
for (; *line != '\0'; line++) {
@ -726,16 +727,14 @@ static char *expand_escapes(const char *line, SERVER_REC *server,
signal_emit("send text", 3, ret, server, item);
ptr = ret;
break;
case 't':
*ptr++ = '\t';
break;
case '\\':
*ptr++ = '\\';
break;
default:
*ptr++ = '\\';
*ptr++ = *line;
break;
chr = expand_escape(&line);
if (chr != -1)
*ptr++ = chr;
else {
*ptr++ = '\\';
*ptr++ = *line;
}
}
}