diff mcabber/src/utils.c @ 554:2424bbf0a6db

Some more work on do_room()
author Mikael Berthe <mikael@lilotux.net>
date Tue, 29 Nov 2005 23:25:01 +0100
parents b1d71f5107a1
children c4fee1a2c478
line wrap: on
line diff
--- a/mcabber/src/utils.c	Tue Nov 29 22:12:05 2005 +0100
+++ b/mcabber/src/utils.c	Tue Nov 29 23:25:01 2005 +0100
@@ -354,7 +354,7 @@
 // Remove quotes and backslashes before an escaped quote
 // Only quotes need a backslash
 // Ex.: ["a b"] -> [a b]; [a\"b] -> [a"b]
-static void strip_arg_special_chars(char *s)
+void strip_arg_special_chars(char *s)
 {
   int instring = FALSE;
   int escape = FALSE;
@@ -383,12 +383,12 @@
   }
 }
 
-//  split_arg(arg, n)
+//  split_arg(arg, n, preservelast)
 // Split the string arg into a maximum of n pieces, taking care of
 // double quotes.
 // Return a null-terminated array of strings.  This array should be freed
 // be the caller after use, for example with free_arg_lst().
-char **split_arg(const char *arg, unsigned int n)
+char **split_arg(const char *arg, unsigned int n, int dontstriplast)
 {
   char **arglst;
   const char *p, *start, *end;
@@ -426,7 +426,8 @@
 
   if (start < end) {
     *(arglst+i) = g_strndup(start, end-start);
-    strip_arg_special_chars(*(arglst+i));
+    if (!dontstriplast)
+      strip_arg_special_chars(*(arglst+i));
   }
 
   return arglst;