Use g_timeout_add_seconds for some long timeouts
[platform/upstream/glib.git] / glib / gshell.c
index 205519e..2891206 100644 (file)
@@ -31,6 +31,7 @@
 #include "gstring.h"
 #include "gtestutils.h"
 #include "glibintl.h"
+#include "gthread.h"
 
 /**
  * SECTION:shell
  *
  * Error codes returned by shell functions.
  **/
-GQuark
-g_shell_error_quark (void)
-{
-  return g_quark_from_static_string ("g-shell-error-quark");
-}
+G_DEFINE_QUARK (g-shell-error-quark, g_shell_error)
 
 /* Single quotes preserve the literal string exactly. escape
  * sequences are not allowed; not even \' - if you want a '
@@ -521,12 +518,30 @@ tokenize_command_line (const gchar *command_line,
               g_string_append_c (current_token, *p);
 
               /* FALL THRU */
-              
-            case '#':
             case '\\':
               current_quote = *p;
               break;
 
+            case '#':
+              if (p == command_line)
+               { /* '#' was the first char */
+                  current_quote = *p;
+                  break;
+                }
+              switch(*(p-1))
+                {
+                  case ' ':
+                  case '\n':
+                  case '\0':
+                    current_quote = *p;
+                    break;
+                  default:
+                    ensure_token (&current_token);
+                    g_string_append_c (current_token, *p);
+                   break;
+                }
+              break;
+
             default:
               /* Combines rules 4) and 6) - if we have a token, append to it,
                * otherwise create a new token.