}
BT_HIDDEN
-GString *bt_common_shell_quote(const char *input)
+GString *bt_common_shell_quote(const char *input, bool with_single_quotes)
{
GString *output = g_string_new(NULL);
const char *ch;
}
if (strlen(input) == 0) {
- g_string_assign(output, "''");
+ if (with_single_quotes) {
+ g_string_assign(output, "''");
+ }
+
goto end;
}
goto end;
}
- g_string_assign(output, "'");
+ if (with_single_quotes) {
+ g_string_assign(output, "'");
+ }
for (ch = input; *ch != '\0'; ch++) {
if (*ch == '\'') {
}
}
- g_string_append_c(output, '\'');
+ if (with_single_quotes) {
+ g_string_append_c(output, '\'');
+ }
end:
return output;