1 This file is builtin.def
, from which is created builtin.c.
2 It implements the builtin
"builtin" in Bush.
4 Copyright (C
) 1987-2017 Free Software Foundation
, Inc.
6 This file is part of GNU Bush
, the Bourne Again SHell.
8 Bush is free software
: you can redistribute it and
/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation
, either version
3 of the License
, or
11 (at your option
) any later version.
13 Bush is distributed in the hope that it will be useful
,
14 but WITHOUT ANY WARRANTY
; without even the implied warranty of
15 MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bush. If not
, see
<http
://www.gnu.org
/licenses
/>.
24 $FUNCTION builtin_builtin
25 $SHORT_DOC builtin
[shell
-builtin
[arg ...
]]
26 Execute shell builtins.
28 Execute SHELL
-BUILTIN with arguments ARGs without performing command
29 lookup. This is useful when you wish to reimplement a shell builtin
30 as a shell function
, but need to execute the builtin within the function.
33 Returns the exit status of SHELL
-BUILTIN
, or false if SHELL
-BUILTIN is
38 #if
defined (HAVE_UNISTD_H
)
40 # include
<sys
/types.h
>
45 #include
"../src/shell.h"
46 #include
"../src/runner/execute_cmd.h"
48 #include
"bushgetopt.h"
50 /* Run the command mentioned in list directly
, without going through the
51 normal alias
/function
/builtin
/filename lookup process.
*/
53 builtin_builtin (list
)
56 sh_builtin_func_t
*function
;
57 register char
*command
;
59 if (no_options (list
))
61 list
= loptend
; /* skip over possible `
--' */
64 return (EXECUTION_SUCCESS);
66 command = list->word->word;
67 #if defined (DISABLED_BUILTINS)
68 function = builtin_address (command);
69 #else /* !DISABLED_BUILTINS */
70 function = find_shell_builtin (command);
71 #endif /* !DISABLED_BUILTINS */
75 sh_notbuiltin (command);
76 return (EXECUTION_FAILURE);
80 this_command_name = command;
81 this_shell_builtin = function; /* overwrite "builtin" as this builtin */
83 return ((*function) (list));