Lines Matching refs:parse
32 mi_parse_argv (char *args, struct mi_parse *parse) in mi_parse_argv() argument
48 parse->argv = argv; in mi_parse_argv()
49 parse->argc = argc; in mi_parse_argv()
133 mi_parse_free (struct mi_parse *parse) in mi_parse_free() argument
135 if (parse == NULL) in mi_parse_free()
137 if (parse->command != NULL) in mi_parse_free()
138 xfree (parse->command); in mi_parse_free()
139 if (parse->token != NULL) in mi_parse_free()
140 xfree (parse->token); in mi_parse_free()
141 if (parse->args != NULL) in mi_parse_free()
142 xfree (parse->args); in mi_parse_free()
143 if (parse->argv != NULL) in mi_parse_free()
144 freeargv (parse->argv); in mi_parse_free()
145 xfree (parse); in mi_parse_free()
153 struct mi_parse *parse = XMALLOC (struct mi_parse); in mi_parse() local
154 memset (parse, 0, sizeof (*parse)); in mi_parse()
163 parse->token = xmalloc ((chp - cmd + 1) * sizeof (char *)); in mi_parse()
164 memcpy (parse->token, cmd, (chp - cmd)); in mi_parse()
165 parse->token[chp - cmd] = '\0'; in mi_parse()
172 parse->command = xstrdup (chp); in mi_parse()
173 parse->op = CLI_COMMAND; in mi_parse()
174 return parse; in mi_parse()
182 parse->command = xmalloc ((chp - tmp + 1) * sizeof (char *)); in mi_parse()
183 memcpy (parse->command, tmp, chp - tmp); in mi_parse()
184 parse->command[chp - tmp] = '\0'; in mi_parse()
188 parse->cmd = mi_lookup (parse->command); in mi_parse()
189 if (parse->cmd == NULL) in mi_parse()
195 parse->token, parse->command); in mi_parse()
196 mi_parse_free (parse); in mi_parse()
206 if (parse->cmd->argv_func != NULL) in mi_parse()
208 mi_parse_argv (chp, parse); in mi_parse()
209 if (parse->argv == NULL) in mi_parse()
215 parse->token, parse->command, chp); in mi_parse()
216 mi_parse_free (parse); in mi_parse()
224 if (parse->cmd->args_func != NULL in mi_parse()
225 || parse->cmd->cli.cmd != NULL) in mi_parse()
227 parse->args = xstrdup (chp); in mi_parse()
231 parse->op = MI_COMMAND; in mi_parse()
232 return parse; in mi_parse()