Lines Matching refs:cmd
78 static int MatchCommand(const struct ngcmd *cmd, const char *s);
450 const struct ngcmd *cmd;
455 if ((cmd = FindCommand(av[0])) == NULL)
457 if ((rtn = (*cmd->func)(ac, av)) == CMDRTN_USAGE)
458 warnx("usage: %s", cmd->cmd);
487 * See if string matches a prefix of "cmd" (or an alias) case insensitively
490 MatchCommand(const struct ngcmd *cmd, const char *s)
495 if (strlen(s) <= strcspn(cmd->cmd, WHITESPACE)) {
496 if (strncasecmp(s, cmd->cmd, strlen(s)) == 0)
501 for (a = 0; a < MAX_CMD_ALIAS && cmd->aliases[a] != NULL; a++) {
502 if (strlen(cmd->aliases[a]) >= strlen(s)) {
503 if (strncasecmp(s, cmd->aliases[a], strlen(s)) == 0)
545 const struct ngcmd *cmd;
556 cmd = cmds[k];
557 snprintf(buf, sizeof(buf), "%s", cmd->cmd);
560 printf(" %-10s %s\n", buf, cmd->desc);
565 if ((cmd = FindCommand(av[1])) != NULL) {
566 printf("usage: %s\n", cmd->cmd);
567 if (cmd->aliases[0] != NULL) {
572 printf("%s", cmd->aliases[a++]);
574 || cmd->aliases[a] == NULL) {
581 printf("Summary: %s\n", cmd->desc);
582 if (cmd->help != NULL) {
588 for (s = cmd->help; *s != '\0'; s += len) {