Original patch as attached on the bugreport

This commit is contained in:
Patrick Winnertz 2009-01-06 22:00:18 +01:00
parent d731741110
commit b0e39cc68d

View File

@ -1527,48 +1527,3 @@ Q_ (const char *s)
return (sep != NULL) ? sep + 1 : result;
}
/* Unescape paths or other strings for e.g the internal cd */
char *
unescape_string(const char *in) {
GString *str;
const char * src;
char *result;
str = g_string_new("");
for (src = in; *src != '\0'; src++) {
if (src[0] == '\\' && strchr(" !#$%&'()*;<>?[]`{|}~", src[1])) {
g_string_append_c(str, src[1]);
src++;
} else {
g_string_append_c(str, src[0]);
}
}
result = str->str;
g_string_free(str, FALSE);
return result;
}
/* To be compatible with the general posix command lines we have to escape *
* strings for the command line */
char *
escape_string ( const char * in ) {
GString *str;
const char * src;
char *result;
str = g_string_new("");
for (src = in;src[0] != '\0';src++) {
if ( (src[-1] != '\\') && strchr(" !#$%&'()*;<>?[]`{|}~",src[0])) {
g_string_append_c(str,'\\');
g_string_append_c(str,src[0]);
} else {
g_string_append_c(str,src[0]);
}
}
result = str->str;
g_string_free(str, FALSE);
return result;
}