mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 17:12:51 +02:00
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:
parent
b667af72aa
commit
98b82723a1
4 changed files with 68 additions and 20 deletions
|
|
@ -471,7 +471,7 @@ char *parse_special_string(const char *cmd, SERVER_REC *server, void *item,
|
|||
{
|
||||
char code, **arglist, *ret;
|
||||
GString *str;
|
||||
int need_free;
|
||||
int need_free, chr;
|
||||
|
||||
g_return_val_if_fail(cmd != NULL, NULL);
|
||||
g_return_val_if_fail(data != NULL, NULL);
|
||||
|
|
@ -483,16 +483,17 @@ char *parse_special_string(const char *cmd, SERVER_REC *server, void *item,
|
|||
code = 0;
|
||||
str = g_string_new(NULL);
|
||||
while (*cmd != '\0') {
|
||||
if (code == '\\'){
|
||||
switch (*cmd) {
|
||||
case 't':
|
||||
g_string_append_c(str, '\t');
|
||||
break;
|
||||
case 'n':
|
||||
g_string_append_c(str, '\n');
|
||||
break;
|
||||
default:
|
||||
g_string_append_c(str, *cmd);
|
||||
if (code == '\\') {
|
||||
if (*cmd == ';')
|
||||
g_string_append_c(str, ';');
|
||||
else {
|
||||
chr = expand_escape(&cmd);
|
||||
if (chr != -1)
|
||||
g_string_append_c(str, chr);
|
||||
else {
|
||||
g_string_append_c(str, '\\');
|
||||
g_string_append_c(str, *cmd);
|
||||
}
|
||||
}
|
||||
code = 0;
|
||||
} else if (code == '$') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue