Changeset e56303f
- 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)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cmd.c
r3472845 re56303f 85 85 char **argv; 86 86 int argc; 87 char *tmpbuff;88 87 char *retval = NULL; 89 88 90 tmpbuff=g_strdup(cmdbuff); 91 argv=owl_parseline(tmpbuff, &argc); 92 if (argc < 0) { 93 g_free(tmpbuff); 89 argv = owl_parseline(cmdbuff, &argc); 90 if (argv == NULL) { 94 91 owl_function_makemsg("Unbalanced quotes"); 95 92 return NULL; … … 97 94 98 95 if (argc < 1) { 99 owl_parse_delete(argv, argc); 100 g_free(tmpbuff); 96 g_strfreev(argv); 101 97 return NULL; 102 98 } … … 104 100 retval = _owl_cmddict_execute(cd, ctx, strs(argv), argc, cmdbuff); 105 101 106 owl_parse_delete(argv, argc); 107 g_free(tmpbuff); 102 g_strfreev(argv); 108 103 return retval; 109 104 } -
filter.c
rd4927a7 re56303f 10 10 argv = owl_parseline(string, &argc); 11 11 f = owl_filter_new(name, argc, strs(argv)); 12 owl_parse_delete(argv, argc);12 g_strfreev(argv); 13 13 14 14 return f; -
tester.c
r42ee1be re56303f 188 188 FAIL_UNLESS(desc " - parsed", \ 189 189 !strcmp(__argv[0], unquoted)); \ 190 owl_parse_delete(__argv, __argc);\190 g_strfreev(__argv); \ 191 191 g_free(__quoted); \ 192 192 } while (0) -
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 } -
zwrite.c
r3472845 re56303f 123 123 } 124 124 125 owl_parse_delete(argv, argc);125 g_strfreev(argv); 126 126 127 127 if (badargs) {
Note: See TracChangeset
for help on using the changeset viewer.