[daemon-fix] fixed querying about name information
[platform/upstream/dbus.git] / dbus / dbus-shell.c
index 9028424..2384961 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
+#include <config.h>
 #include <string.h>
 #include "dbus-internals.h"
 #include "dbus-list.h"
@@ -140,72 +141,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,
@@ -215,7 +150,7 @@ _dbus_shell_quote (const char *unquoted_string)
  * through literally instead of being expanded). This function is
  * guaranteed to succeed if applied to the result of
  * _dbus_shell_quote(). If it fails, it returns %NULL.
- * The @quoted_string need not actually contain quoted or
+ * The @quoted_string need not actually contain quoted or
  * escaped text; _dbus_shell_unquote() simply goes through the string and
  * unquotes/unescapes anything that the shell would. Both single and
  * double quotes are handled, as are escapes including escaped
@@ -228,7 +163,7 @@ _dbus_shell_quote (const char *unquoted_string)
  * be escaped with backslash. Otherwise double quotes preserve things
  * literally.
  *
- * @quoted_string: shell-quoted string
+ * @param quoted_string shell-quoted string
  **/
 char*
 _dbus_shell_unquote (const char *quoted_string)
@@ -609,10 +544,10 @@ tokenize_command_line (const char *command_line, DBusError *error)
  * does contain such expansions, they are passed through
  * literally. Free the returned vector with dbus_free_string_array().
  * 
- * @command_line: command line to parse
- * @argcp: return location for number of args
- * @argvp: return location for array of args
- * @error: error information
+ * @param command_line command line to parse
+ * @param argcp return location for number of args
+ * @param argvp return location for array of args
+ * @param error error information
  **/
 dbus_bool_t
 _dbus_shell_parse_argv (const char *command_line,