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:
ailin-nemui 2018-11-25 13:41:46 +01:00
commit 7e6e3cd503
3 changed files with 20 additions and 1 deletions

View file

@ -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;