diff options
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-shell.c | 66 | ||||
-rw-r--r-- | dbus/dbus-shell.h | 1 |
2 files changed, 0 insertions, 67 deletions
diff --git a/dbus/dbus-shell.c b/dbus/dbus-shell.c index 90284245..65038b11 100644 --- a/dbus/dbus-shell.c +++ b/dbus/dbus-shell.c @@ -140,72 +140,6 @@ unquote_string_inplace (char* str, char** end) return FALSE; } -/** - * Quotes a string so that the shell (/bin/sh) will interpret the - * quoted string to mean @unquoted_string. If you pass a filename to - * the shell, for example, you should first quote it with this - * function. The return value must be freed with dbus_free(). The - * quoting style used is undefined (single or double quotes may be - * used). - * - * @unquoted_string: a literal string - **/ -char* -_dbus_shell_quote (const char *unquoted_string) -{ - /* We always use single quotes, because the algorithm is cheesier. - * We could use double if we felt like it, that might be more - * human-readable. - */ - - const char *p; - char *ret; - DBusString dest; - - _dbus_string_init (&dest); - - p = unquoted_string; - - /* could speed this up a lot by appending chunks of text at a - * time. - */ - while (*p) - { - /* Replace literal ' with a close ', a \', and a open ' */ - if (*p == '\'') - { - if (!_dbus_string_append (&dest, "'\\''")) - { - _dbus_string_free (&dest); - return NULL; - } - } - else - { - if (!_dbus_string_append_byte (&dest, *p)) - { - _dbus_string_free (&dest); - return NULL; - } - } - - ++p; - } - - /* close the quote */ - if (_dbus_string_append_byte (&dest, '\'')) - { - ret = _dbus_strdup (_dbus_string_get_data (&dest)); - _dbus_string_free (&dest); - - return ret; - } - - _dbus_string_free (&dest); - - return NULL; -} - /** * Unquotes a string as the shell (/bin/sh) would. Only handles * quotes; if a string contains file globs, arithmetic operators, diff --git a/dbus/dbus-shell.h b/dbus/dbus-shell.h index 9ecdf06e..5316d511 100644 --- a/dbus/dbus-shell.h +++ b/dbus/dbus-shell.h @@ -28,7 +28,6 @@ DBUS_BEGIN_DECLS -char* _dbus_shell_quote (const char *unquoted_string); char* _dbus_shell_unquote (const char *quoted_string); dbus_bool_t _dbus_shell_parse_argv (const char *command_line, int *argcp, |