Fix a small bug in split_arg()
authorMikael Berthe <mikael@lilotux.net>
Thu, 01 Dec 2005 23:47:16 +0100
changeset 559 4eb579399613
parent 558 db019a5f874f
child 560 64cb4de94972
Fix a small bug in split_arg()
mcabber/src/utils.c
--- a/mcabber/src/utils.c	Thu Dec 01 23:37:15 2005 +0100
+++ b/mcabber/src/utils.c	Thu Dec 01 23:47:16 2005 +0100
@@ -388,6 +388,8 @@
 // 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().
+// If dontstriplast is true, the Nth argument isn't stripped (i.e. no
+// processing of quote chars)
 char **split_arg(const char *arg, unsigned int n, int dontstriplast)
 {
   char **arglst;
@@ -426,7 +428,7 @@
 
   if (start < end) {
     *(arglst+i) = g_strndup(start, end-start);
-    if (!dontstriplast)
+    if (!dontstriplast || i+1 < n)
       strip_arg_special_chars(*(arglst+i));
   }