From 62fd3ac1804d5d45bc2302ceac9ee9c7ef372e1a Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Mon, 6 Mar 2017 11:27:55 +0100 Subject: Revert "Quote the filename when dcc requests are auto accepted." --- src/core/misc.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/core/misc.c') diff --git a/src/core/misc.c b/src/core/misc.c index 03fcce59..1cfa15b6 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -724,20 +724,18 @@ int expand_escape(const char **data) } } -/* Escape all the characters in `what' with a backslash */ -char *escape_string(const char *str, const char *what) +/* Escape all '"', "'" and '\' chars with '\' */ +char *escape_string(const char *str) { - const char *p; - char *ret; + char *ret, *p; - ret = g_malloc(strlen(str) * 2 + 1); - for (p = str; *p != '\0'; p++, ret++) { - if (strchr(what, *p) != NULL) { - *ret++ = '\\'; - } - *ret = *p; + p = ret = g_malloc(strlen(str)*2+1); + while (*str != '\0') { + if (*str == '"' || *str == '\'' || *str == '\\') + *p++ = '\\'; + *p++ = *str++; } - *ret = '\0'; + *p = '\0'; return ret; } -- cgit v1.2.3