OpenCoverage

builtin.def

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/builtins/builtin.def
Source codeSwitch to Preprocessed file
LineSourceCount
1This file is builtin.def, from which is created builtin.c.-
2It implements the builtin "builtin" in Bash.-
3-
4Copyright (C) 1987-2017 Free Software Foundation, Inc.-
5-
6This file is part of GNU Bash, the Bourne Again SHell.-
7-
8Bash is free software: you can redistribute it and/or modify-
9it under the terms of the GNU General Public License as published by-
10the Free Software Foundation, either version 3 of the License, or-
11(at your option) any later version.-
12-
13Bash is distributed in the hope that it will be useful,-
14but WITHOUT ANY WARRANTY; without even the implied warranty of-
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
16GNU General Public License for more details.-
17-
18You should have received a copy of the GNU General Public License-
19along with Bash. If not, see <http://www.gnu.org/licenses/>.-
20-
21$PRODUCES builtin.c-
22-
23$BUILTIN builtin-
24$FUNCTION builtin_builtin-
25$SHORT_DOC builtin [shell-builtin [arg ...]]-
26Execute shell builtins.-
27-
28Execute SHELL-BUILTIN with arguments ARGs without performing command-
29lookup. This is useful when you wish to reimplement a shell builtin-
30as a shell function, but need to execute the builtin within the function.-
31-
32Exit Status:-
33Returns the exit status of SHELL-BUILTIN, or false if SHELL-BUILTIN is-
34not a shell builtin..-
35$END-
36#include <config.h>-
37-
38#if defined (HAVE_UNISTD_H)-
39# ifdef _MINIX-
40# include <sys/types.h>-
41# endif-
42# include <unistd.h>-
43#endif-
44-
45#include "../shell.h"-
46#include "../execute_cmd.h"-
47#include "common.h"-
48#include "bashgetopt.h"-
49-
50/* Run the command mentioned in list directly, without going through the-
51 normal alias/function/builtin/filename lookup process. */-
52int-
53builtin_builtin (list)-
54 WORD_LIST *list;-
55{-
56 sh_builtin_func_t *function;-
57 register char *command;-
58-
59 if (no_options (list))
no_options (list)Description
TRUEnever evaluated
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
0-48
60 return (EX_USAGE);
never executed: return (258);
0
61 list = loptend; /* skip over possible `--' */-
62-
63 if (list == 0)
list == 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 39 times by 1 test
Evaluated by:
  • Self test
9-39
64 return (EXECUTION_SUCCESS);
executed 9 times by 1 test: return (0);
Executed by:
  • Self test
9
65-
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 */-
72-
73 if (function == 0)
function == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38 times by 1 test
Evaluated by:
  • Self test
1-38
74 {-
75 sh_notbuiltin (command);-
76 return (EXECUTION_FAILURE);
executed 1 time by 1 test: return (1);
Executed by:
  • Self test
1
77 }-
78 else-
79 {-
80 this_command_name = command;-
81 this_shell_builtin = function; /* overwrite "builtin" as this builtin */-
82 list = list->next;-
83 return ((*function) (list));
executed 38 times by 1 test: return ((*function) (list));
Executed by:
  • Self test
38
84 }-
85}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2