1 This file is builtin.def, from which is created builtin.c.
2 It implements the builtin "builtin" in Bash.
4 Copyright (C) 1987-2002 Free Software Foundation, Inc.
6 This file is part of GNU Bash, the Bourne Again SHell.
8 Bash is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with Bash; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
25 $FUNCTION builtin_builtin
26 $SHORT_DOC builtin [shell-builtin [arg ...]]
27 Run a shell builtin. This is useful when you wish to rename a
28 shell builtin to be a function, but need the functionality of the
29 builtin within the function itself.
33 #if defined (HAVE_UNISTD_H)
35 # include <sys/types.h>
42 #include "bashgetopt.h"
44 extern char *this_command_name;
46 /* Run the command mentioned in list directly, without going through the
47 normal alias/function/builtin/filename lookup process. */
49 builtin_builtin (list)
52 sh_builtin_func_t *function;
53 register char *command;
55 if (no_options (list))
57 list = loptend; /* skip over possible `--' */
60 return (EXECUTION_SUCCESS);
62 command = list->word->word;
63 #if defined (DISABLED_BUILTINS)
64 function = builtin_address (command);
65 #else /* !DISABLED_BUILTINS */
66 function = find_shell_builtin (command);
67 #endif /* !DISABLED_BUILTINS */
71 sh_notbuiltin (command);
72 return (EXECUTION_FAILURE);
76 this_command_name = command;
78 return ((*function) (list));