Lines Matching refs:cmd
86 extern struct cmd __start___cmd;
87 extern struct cmd __stop___cmd;
91 _cmd = (const struct cmd *)((char *)_cmd + cmd_size))
94 static void __usage_cmd(const struct cmd *cmd, char *indent, bool full) in __usage_cmd() argument
100 switch (cmd->idby) { in __usage_cmd()
113 if (cmd->parent && cmd->parent->name) in __usage_cmd()
114 printf("%s ", cmd->parent->name); in __usage_cmd()
115 printf("%s", cmd->name); in __usage_cmd()
117 if (cmd->args) { in __usage_cmd()
119 start = cmd->args; in __usage_cmd()
126 if (start != cmd->args) { in __usage_cmd()
128 switch (cmd->idby) { in __usage_cmd()
141 if (cmd->parent && cmd->parent->name) in __usage_cmd()
142 printf("%s ", cmd->parent->name); in __usage_cmd()
143 printf("%s ", cmd->name); in __usage_cmd()
151 if (!full || !cmd->help) in __usage_cmd()
161 start = cmd->help; in __usage_cmd()
185 const struct cmd *section, *cmd; in usage() local
210 for_each_cmd(cmd) { in usage()
211 if (section != cmd->parent) in usage()
213 if (!cmd->handler || cmd->hidden) in usage()
215 if (cmd_filt && strcmp(cmd->name, cmd_filt)) in usage()
217 __usage_cmd(cmd, "\t", full); in usage()
242 static void usage_cmd(const struct cmd *cmd) in usage_cmd() argument
245 __usage_cmd(cmd, "", true); in usage_cmd()
297 int argc, char **argv, const struct cmd **cmdout) in __handle_cmd()
299 const struct cmd *cmd, *match = NULL, *sectcmd; in __handle_cmd() local
374 for_each_cmd(cmd) { in __handle_cmd()
375 if (!cmd->handler) in __handle_cmd()
377 if (cmd->parent != sectcmd) in __handle_cmd()
383 if (cmd->idby != command_idby && in __handle_cmd()
384 !(cmd->idby == CIB_NETDEV && in __handle_cmd()
387 if (strcmp(cmd->name, command)) in __handle_cmd()
389 if (argc > 1 && !cmd->args) in __handle_cmd()
391 match = cmd; in __handle_cmd()
402 cmd = match; in __handle_cmd()
405 cmd = sectcmd; in __handle_cmd()
406 if (argc && !cmd->args) in __handle_cmd()
408 if (cmd->idby != command_idby && in __handle_cmd()
409 !(cmd->idby == CIB_NETDEV && command_idby == CIB_WDEV)) in __handle_cmd()
411 if (!cmd->handler) in __handle_cmd()
415 if (cmd->selector) { in __handle_cmd()
416 cmd = cmd->selector(argc, argv); in __handle_cmd()
417 if (!cmd) in __handle_cmd()
422 *cmdout = cmd; in __handle_cmd()
424 if (!cmd->cmd) { in __handle_cmd()
427 return cmd->handler(state, NULL, NULL, argc, argv, idby); in __handle_cmd()
445 cmd->nl_msg_flags, cmd->cmd, 0); in __handle_cmd()
461 err = cmd->handler(state, cb, msg, argc, argv, idby); in __handle_cmd()
499 const struct cmd *cmd = NULL; in main() local
531 err = __handle_cmd(&nlstate, II_NETDEV, argc, argv, &cmd); in main()
536 err = __handle_cmd(&nlstate, II_PHY_NAME, argc, argv, &cmd); in main()
538 err = __handle_cmd(&nlstate, II_PHY_IDX, argc, argv, &cmd); in main()
544 err = __handle_cmd(&nlstate, II_WDEV, argc, argv, &cmd); in main()
553 err = __handle_cmd(&nlstate, idby, argc, argv, &cmd); in main()
557 if (cmd) in main()
558 usage_cmd(cmd); in main()