]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
merge in sep str changes from big brother
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 17 Nov 2007 01:42:45 +0000 (01:42 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 17 Nov 2007 01:42:45 +0000 (01:42 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@332 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/zap_io.c

index 30a9771beba370833b408c9f6fb6f307f2ff84e6..64b415adfb6e8db020f7e453e9bb0397fb394771 100644 (file)
@@ -2034,8 +2034,7 @@ uint32_t zap_separate_string(char *buf, char delim, char **array, int arraylen)
        int argc;
        char *ptr;
        int quot = 0;
-       char qc = '"';
-       char *e;
+       char qc = '\'';
        int x;
 
        if (!buf || !array || !arraylen) {
@@ -2066,13 +2065,21 @@ uint32_t zap_separate_string(char *buf, char delim, char **array, int arraylen)
                array[argc++] = ptr;
        }
 
-       /* strip quotes */
+       /* strip quotes and leading / trailing spaces */
        for (x = 0; x < argc; x++) {
-               if (*(array[x]) == qc) {
+               char *p;
+
+               while(*(array[x]) == ' ') {
                        (array[x])++;
-                       if ((e = strchr(array[x], qc))) {
-                               *e = '\0';
-                       }
+               }
+               p = array[x];
+               while((p = strchr(array[x], qc))) {
+                       memmove(p, p+1, strlen(p));
+                       p++;
+               }
+               p = array[x] + (strlen(array[x]) - 1);
+               while(*p == ' ') {
+                       *p-- = '\0';
                }
        }