mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
Add escape_string_escape function for expand_escapes
To avoid expanding, tab completion escapes the completion list. But the escape_string function escapes too much for the expand_escapes code. Add a function that only escapes the backslashes.
This commit is contained in:
parent
257cb2f5f9
commit
7e6e3cd503
3 changed files with 20 additions and 1 deletions
|
|
@ -757,6 +757,22 @@ char *escape_string(const char *str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Escape all '\' chars with '\' */
|
||||
char *escape_string_escape(const char *str)
|
||||
{
|
||||
char *ret, *p;
|
||||
|
||||
p = ret = g_malloc(strlen(str)*2+1);
|
||||
while (*str != '\0') {
|
||||
if (*str == '\\')
|
||||
*p++ = '\\';
|
||||
*p++ = *str++;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int nearest_power(int num)
|
||||
{
|
||||
int n = 1;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ char *ascii_strdown(char *str);
|
|||
/* Escape all '"', "'" and '\' chars with '\' */
|
||||
char *escape_string(const char *str);
|
||||
|
||||
/* Escape all '\' chars with '\' */
|
||||
char *escape_string_escape(const char *str);
|
||||
|
||||
/* convert all low-ascii (<32) to ^<A..> combinations */
|
||||
char *show_lowascii(const char *str);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue