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