Exemplo n.º 1
0
int execuser(char *line)
{
    char **args;
    int n;

    args = parseline(line);

    if(args[0] == NULL)
        return 5;

    for(n = 0; table[n].command != NULL; n++)
        if(strcmp(table[n].command, args[0]) == 0)
            break;

    if(table[n].command == NULL)
        return 6;

    return table[n].func(countargs(args), args);
}
Exemplo n.º 2
0
/* a common prompt routine */
static void
common(char *string, struct wordlist *wl, struct comm *command)
{

    struct wordlist *w;
    char *buf;

    if (!countargs(wl)) {
      outmenuprompt(string);
      if ((buf = prompt(cp_in)) == NULL) /* prompt aborted */
        return;               /* don't execute command */
      /* do something with the wordlist */
      w = alloc(struct wordlist);
      w->wl_word = buf;
      w->wl_next = NULL;

      w = process(w);
      /* O.K. now call fn */
      (*command->co_func) (w);
    }