Lines Matching refs:cmd

575 get_history_event(const char *cmd, int *cindex, int qchar)  in get_history_event()  argument
584 if (cmd[idx++] != history_expansion_char) in get_history_event()
588 if (cmd[idx] == history_expansion_char || cmd[idx] == '\0') { in get_history_event()
591 *cindex = cmd[idx]? (idx + 1):idx; in get_history_event()
595 if (cmd[idx] == '-') { in get_history_event()
600 if ('0' <= cmd[idx] && cmd[idx] <= '9') { in get_history_event()
604 while (cmd[idx] && '0' <= cmd[idx] && cmd[idx] <= '9') { in get_history_event()
605 num = num * 10 + cmd[idx] - '0'; in get_history_event()
618 if (cmd[idx] == '?') { in get_history_event()
623 while (cmd[idx]) { in get_history_event()
624 if (cmd[idx] == '\n') in get_history_event()
626 if (sub && cmd[idx] == '?') in get_history_event()
628 if (!sub && (cmd[idx] == ':' || cmd[idx] == ' ' in get_history_event()
629 || cmd[idx] == '\t' || cmd[idx] == qchar)) in get_history_event()
634 if (sub && cmd[idx] == '?') in get_history_event()
643 (void)strlcpy(pat, cmd + begin, len + 1); in get_history_event()
695 const char *cmd = *cmdp; in getfrom() local
702 for (; *cmd && *cmd != delim; cmd++) { in getfrom()
703 if (*cmd == '\\' && cmd[1] == delim) in getfrom()
704 cmd++; in getfrom()
711 *cmdp = cmd; in getfrom()
717 what[len++] = *cmd; in getfrom()
721 *cmdp = cmd; in getfrom()
734 if (!*cmd) { in getfrom()
740 cmd++; /* shift after delim */ in getfrom()
741 *cmdp = cmd; in getfrom()
743 if (!*cmd) { in getfrom()
757 const char *cmd = *cmdp; in getto() local
763 for (; *cmd && *cmd != delim; cmd++) { in getto()
772 if (*cmd == '&') { in getto()
778 if (*cmd == '\\' && (*(cmd + 1) == delim || *(cmd + 1) == '&')) in getto()
779 cmd++; in getto()
780 with[len++] = *cmd; in getto()
782 if (!*cmd) in getto()
786 *cmdp = cmd; in getto()
792 *cmdp = cmd; in getto()
822 const char *ptr, *cmd; in _history_expand_command() local
876 cmd = command + offs + idx + 1; in _history_expand_command()
880 if (*cmd == '%') /* last word matched by ?pat? */ in _history_expand_command()
882 else if (strchr("^*$-0123456789", *cmd)) { in _history_expand_command()
884 if (*cmd == '^') in _history_expand_command()
885 start = end = 1, cmd++; in _history_expand_command()
886 else if (*cmd == '$') in _history_expand_command()
887 start = -1, cmd++; in _history_expand_command()
888 else if (*cmd == '*') in _history_expand_command()
889 start = 1, cmd++; in _history_expand_command()
890 else if (*cmd == '-' || isdigit((unsigned char) *cmd)) { in _history_expand_command()
892 while (*cmd && '0' <= *cmd && *cmd <= '9') in _history_expand_command()
893 start = start * 10 + *cmd++ - '0'; in _history_expand_command()
895 if (*cmd == '-') { in _history_expand_command()
896 if (isdigit((unsigned char) cmd[1])) { in _history_expand_command()
897 cmd++; in _history_expand_command()
899 while (*cmd && '0' <= *cmd && *cmd <= '9') in _history_expand_command()
900 end = end * 10 + *cmd++ - '0'; in _history_expand_command()
901 } else if (cmd[1] == '$') { in _history_expand_command()
902 cmd += 2; in _history_expand_command()
905 cmd++; in _history_expand_command()
908 } else if (*cmd == '*') in _history_expand_command()
909 end = -1, cmd++; in _history_expand_command()
927 if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) { in _history_expand_command()
932 for (; *cmd; cmd++) { in _history_expand_command()
933 switch (*cmd) { in _history_expand_command()
962 delim = *++cmd; in _history_expand_command()
963 if (delim == '\0' || *++cmd == '\0') in _history_expand_command()
965 if ((ev = getfrom(&cmd, &from, search, delim)) != 1) in _history_expand_command()
967 if ((ev = getto(&cmd, &to, from, delim)) != 1) in _history_expand_command()
975 cmd--; in _history_expand_command()