Dan Pasanen | c6e3786 | 2014-10-02 14:08:59 -0500 | [diff] [blame] | 1 | /* builtin.c, created from builtin.def. */ |
| 2 | #line 22 "./builtin.def" |
| 3 | |
| 4 | #line 36 "./builtin.def" |
| 5 | #include <config.h> |
| 6 | |
| 7 | #if defined (HAVE_UNISTD_H) |
| 8 | # ifdef _MINIX |
| 9 | # include <sys/types.h> |
| 10 | # endif |
| 11 | # include <unistd.h> |
| 12 | #endif |
| 13 | |
| 14 | #include "../shell.h" |
| 15 | #include "common.h" |
| 16 | #include "bashgetopt.h" |
| 17 | |
| 18 | extern char *this_command_name; |
| 19 | |
| 20 | /* Run the command mentioned in list directly, without going through the |
| 21 | normal alias/function/builtin/filename lookup process. */ |
| 22 | int |
| 23 | builtin_builtin (list) |
| 24 | WORD_LIST *list; |
| 25 | { |
| 26 | sh_builtin_func_t *function; |
| 27 | register char *command; |
| 28 | |
| 29 | if (no_options (list)) |
| 30 | return (EX_USAGE); |
| 31 | list = loptend; /* skip over possible `--' */ |
| 32 | |
| 33 | if (list == 0) |
| 34 | return (EXECUTION_SUCCESS); |
| 35 | |
| 36 | command = list->word->word; |
| 37 | #if defined (DISABLED_BUILTINS) |
| 38 | function = builtin_address (command); |
| 39 | #else /* !DISABLED_BUILTINS */ |
| 40 | function = find_shell_builtin (command); |
| 41 | #endif /* !DISABLED_BUILTINS */ |
| 42 | |
| 43 | if (!function) |
| 44 | { |
| 45 | sh_notbuiltin (command); |
| 46 | return (EXECUTION_FAILURE); |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | this_command_name = command; |
| 51 | list = list->next; |
| 52 | return ((*function) (list)); |
| 53 | } |
| 54 | } |