- Timestamp:
- Mar 24, 2011, 4:00:33 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- f25df21
- Parents:
- 42ee1be
- git-author:
- David Benjamin <davidben@mit.edu> (03/08/11 14:44:30)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/24/11 16:00:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
util.c
r3472845 re56303f 98 98 } 99 99 100 void owl_parse_delete(char **argv, int argc) 101 { 102 g_strfreev(argv); 103 } 104 100 /* Break a command line up into argv, argc. The caller must free 101 the returned values with g_strfreev. If there is an error argc will be set 102 to -1, argv will be NULL and the caller does not need to free anything. The 103 returned vector is NULL-terminated. */ 105 104 char **owl_parseline(const char *line, int *argc) 106 105 { 107 /* break a command line up into argv, argc. The caller must free108 the returned values. If there is an error argc will be set to109 -1, argv will be NULL and the caller does not need to free110 anything. The returned vector is NULL-terminated. */111 112 106 GPtrArray *argv; 113 107 int i, len, between=1; … … 119 113 curarg = g_string_new(""); 120 114 quote='\0'; 121 *argc=0;115 if (argc) *argc=0; 122 116 for (i=0; i<len+1; i++) { 123 117 /* find the first real character */ … … 170 164 } 171 165 172 *argc = argv->len;166 if (argc) *argc = argv->len; 173 167 g_ptr_array_add(argv, NULL); 174 168 g_string_free(curarg, true); … … 180 174 g_ptr_array_foreach(argv, (GFunc)g_free, NULL); 181 175 g_ptr_array_free(argv, true); 182 *argc = -1;176 if (argc) *argc = -1; 183 177 return(NULL); 184 178 }
Note: See TracChangeset
for help on using the changeset viewer.