OpenCoverage

trap.def

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/builtins/trap.def
Source codeSwitch to Preprocessed file
LineSourceCount
1This file is trap.def, from which is created trap.c.-
2It implements the builtin "trap" in Bash.-
3-
4Copyright (C) 1987-2015 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 trap.c-
22-
23$BUILTIN trap-
24$FUNCTION trap_builtin-
25$SHORT_DOC trap [-lp] [[arg] signal_spec ...]-
26Trap signals and other events.-
27-
28Defines and activates handlers to be run when the shell receives signals-
29or other conditions.-
30-
31ARG is a command to be read and executed when the shell receives the-
32signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC-
33is supplied) or `-', each specified signal is reset to its original-
34value. If ARG is the null string each SIGNAL_SPEC is ignored by the-
35shell and by the commands it invokes.-
36-
37If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. If-
38a SIGNAL_SPEC is DEBUG, ARG is executed before every simple command. If-
39a SIGNAL_SPEC is RETURN, ARG is executed each time a shell function or a-
40script run by the . or source builtins finishes executing. A SIGNAL_SPEC-
41of ERR means to execute ARG each time a command's failure would cause the-
42shell to exit when the -e option is enabled.-
43-
44If no arguments are supplied, trap prints the list of commands associated-
45with each signal.-
46-
47Options:-
48 -l print a list of signal names and their corresponding numbers-
49 -p display the trap commands associated with each SIGNAL_SPEC-
50-
51Each SIGNAL_SPEC is either a signal name in <signal.h> or a signal number.-
52Signal names are case insensitive and the SIG prefix is optional. A-
53signal may be sent to the shell with "kill -signal $$".-
54-
55Exit Status:-
56Returns success unless a SIGSPEC is invalid or an invalid option is given.-
57$END-
58-
59#include <config.h>-
60-
61#if defined (HAVE_UNISTD_H)-
62# ifdef _MINIX-
63# include <sys/types.h>-
64# endif-
65# include <unistd.h>-
66#endif-
67-
68#include "../bashtypes.h"-
69#include <signal.h>-
70#include <stdio.h>-
71#include "../bashansi.h"-
72-
73#include "../shell.h"-
74#include "../trap.h"-
75#include "common.h"-
76#include "bashgetopt.h"-
77-
78static void showtrap __P((int));-
79static int display_traps __P((WORD_LIST *));-
80-
81/* The trap command:-
82-
83 trap <arg> <signal ...>-
84 trap <signal ...>-
85 trap -l-
86 trap -p [sigspec ...]-
87 trap [--]-
88-
89 Set things up so that ARG is executed when SIGNAL(s) N is received.-
90 If ARG is the empty string, then ignore the SIGNAL(s). If there is-
91 no ARG, then set the trap for SIGNAL(s) to its original value. Just-
92 plain "trap" means to print out the list of commands associated with-
93 each signal number. Single arg of "-l" means list the signal names. */-
94-
95/* Possible operations to perform on the list of signals.*/-
96#define SET 0 /* Set this signal to first_arg. */-
97#define REVERT 1 /* Revert to this signals original value. */-
98#define IGNORE 2 /* Ignore this signal. */-
99-
100int-
101trap_builtin (list)-
102 WORD_LIST *list;-
103{-
104 int list_signal_names, display, result, opt;-
105-
106 list_signal_names = display = 0;-
107 result = EXECUTION_SUCCESS;-
108-
109 reset_internal_getopt ();-
110 while ((opt = internal_getopt (list, "lp")) != -1)
(opt = interna..., "lp")) != -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 250 times by 1 test
Evaluated by:
  • Self test
6-250
111 {-
112 switch (opt)-
113 {-
114 case 'l':
executed 1 time by 1 test: case 'l':
Executed by:
  • Self test
1
115 list_signal_names++;-
116 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
1
117 case 'p':
executed 4 times by 1 test: case 'p':
Executed by:
  • Self test
4
118 display++;-
119 break;
executed 4 times by 1 test: break;
Executed by:
  • Self test
4
120 CASE_HELPOPT;
never executed: return (258);
never executed: case -99:
0
121 default:
executed 1 time by 1 test: default:
Executed by:
  • Self test
1
122 builtin_usage ();-
123 return (EX_USAGE);
executed 1 time by 1 test: return (258);
Executed by:
  • Self test
1
124 }-
125 }-
126 list = loptend;-
127-
128 opt = DSIG_NOCASE|DSIG_SIGPREFIX; /* flags for decode_signal */-
129-
130 if (list_signal_names)
list_signal_namesDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 249 times by 1 test
Evaluated by:
  • Self test
1-249
131 return (sh_chkwrite (display_signal_list ((WORD_LIST *)NULL, 1)));
executed 1 time by 1 test: return (sh_chkwrite (display_signal_list ((WORD_LIST *) ((void *)0) , 1)));
Executed by:
  • Self test
1
132 else if (display || list == 0)
displayDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 246 times by 1 test
Evaluated by:
  • Self test
list == 0Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 206 times by 1 test
Evaluated by:
  • Self test
3-246
133 {-
134 initialize_terminating_signals ();-
135 get_all_original_signals ();-
136 return (sh_chkwrite (display_traps (list)));
executed 43 times by 1 test: return (sh_chkwrite (display_traps (list)));
Executed by:
  • Self test
43
137 }-
138 else-
139 {-
140 char *first_arg;-
141 int operation, sig, first_signal;-
142-
143 operation = SET;-
144 first_arg = list->word->word;-
145 first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
first_argDescription
TRUEevaluated 206 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
*first_argDescription
TRUEevaluated 183 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 23 times by 1 test
Evaluated by:
  • Self test
all_digits (first_arg)Description
TRUEnever evaluated
FALSEevaluated 183 times by 1 test
Evaluated by:
  • Self test
(decode_signal...rg,opt) != -1)Description
TRUEnever evaluated
FALSEnever evaluated
0-206
146-
147 /* Backwards compatibility. XXX - question about whether or not we-
148 should throw an error if an all-digit argument doesn't correspond-
149 to a valid signal number (e.g., if it's `50' on a system with only-
150 32 signals). */-
151 if (first_signal)
first_signalDescription
TRUEnever evaluated
FALSEevaluated 206 times by 1 test
Evaluated by:
  • Self test
0-206
152 operation = REVERT;
never executed: operation = 1;
0
153 /* When in posix mode, the historical behavior of looking for a-
154 missing first argument is disabled. To revert to the original-
155 signal handling disposition, use `-' as the first argument. */-
156 else if (posixly_correct == 0 && first_arg && *first_arg &&
posixly_correct == 0Description
TRUEevaluated 205 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
first_argDescription
TRUEevaluated 205 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
*first_argDescription
TRUEevaluated 182 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 23 times by 1 test
Evaluated by:
  • Self test
0-205
157 (*first_arg != '-' || first_arg[1]) &&
*first_arg != '-'Description
TRUEevaluated 158 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24 times by 1 test
Evaluated by:
  • Self test
first_arg[1]Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • Self test
0-158
158 signal_object_p (first_arg, opt) && list->next == 0)
(decode_signal...rg,opt) != -1)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 152 times by 1 test
Evaluated by:
  • Self test
list->next == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-152
159 operation = REVERT;
executed 6 times by 1 test: operation = 1;
Executed by:
  • Self test
6
160 else-
161 {-
162 list = list->next;-
163 if (list == 0)
list == 0Description
TRUEnever evaluated
FALSEevaluated 200 times by 1 test
Evaluated by:
  • Self test
0-200
164 {-
165 builtin_usage ();-
166 return (EX_USAGE);
never executed: return (258);
0
167 }-
168 else if (*first_arg == '\0')
*first_arg == '\0'Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 177 times by 1 test
Evaluated by:
  • Self test
23-177
169 operation = IGNORE;
executed 23 times by 1 test: operation = 2;
Executed by:
  • Self test
23
170 else if (first_arg[0] == '-' && !first_arg[1])
first_arg[0] == '-'Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 153 times by 1 test
Evaluated by:
  • Self test
!first_arg[1]Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-153
171 operation = REVERT;
executed 24 times by 1 test: operation = 1;
Executed by:
  • Self test
24
172 }
executed 200 times by 1 test: end of block
Executed by:
  • Self test
200
173-
174 /* If we're in a command substitution, we haven't freed the trap strings-
175 (though we reset the signal handlers). If we're setting a trap to-
176 handle a signal here, free the rest of the trap strings since they-
177 don't apply any more. */-
178 if (subshell_environment & SUBSHELL_RESETTRAP)
subshell_environment & 0x80Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 180 times by 1 test
Evaluated by:
  • Self test
26-180
179 {-
180 free_trap_strings ();-
181 subshell_environment &= ~SUBSHELL_RESETTRAP;-
182 }
executed 26 times by 1 test: end of block
Executed by:
  • Self test
26
183-
184 while (list)
listDescription
TRUEevaluated 270 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 206 times by 1 test
Evaluated by:
  • Self test
206-270
185 {-
186 sig = decode_signal (list->word->word, opt);-
187-
188 if (sig == NO_SIG)
sig == -1Description
TRUEnever evaluated
FALSEevaluated 270 times by 1 test
Evaluated by:
  • Self test
0-270
189 {-
190 sh_invalidsig (list->word->word);-
191 result = EXECUTION_FAILURE;-
192 }
never executed: end of block
0
193 else-
194 {-
195 switch (operation)-
196 {-
197 case SET:
executed 215 times by 1 test: case 0:
Executed by:
  • Self test
215
198 set_signal (sig, first_arg);-
199 break;
executed 215 times by 1 test: break;
Executed by:
  • Self test
215
200-
201 case REVERT:
executed 32 times by 1 test: case 1:
Executed by:
  • Self test
32
202 restore_default_signal (sig);-
203-
204 /* Signals that the shell treats specially need special-
205 handling. */-
206 switch (sig)-
207 {-
208 case SIGINT:
executed 1 time by 1 test: case 2 :
Executed by:
  • Self test
1
209 /* XXX - should we do this if original disposition-
210 was SIG_IGN? */-
211 if (interactive)
interactiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
0-1
212 set_signal_handler (SIGINT, sigint_sighandler);
never executed: set_signal_handler ( 2 , sigint_sighandler);
0
213 /* special cases for interactive == 0 */-
214 else if (interactive_shell && (sourcelevel||running_trap))
interactive_shellDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
sourcelevelDescription
TRUEnever evaluated
FALSEnever evaluated
running_trapDescription
TRUEnever evaluated
FALSEnever evaluated
0-1
215 set_signal_handler (SIGINT, sigint_sighandler);
never executed: set_signal_handler ( 2 , sigint_sighandler);
0
216 else-
217 set_signal_handler (SIGINT, termsig_sighandler);
executed 1 time by 1 test: set_signal_handler ( 2 , termsig_sighandler);
Executed by:
  • Self test
1
218 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
1
219-
220 case SIGQUIT:
executed 1 time by 1 test: case 3 :
Executed by:
  • Self test
1
221 /* Always ignore SIGQUIT. */-
222 set_signal_handler (SIGQUIT, SIG_IGN);-
223 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
1
224 case SIGTERM:
executed 1 time by 1 test: case 15 :
Executed by:
  • Self test
1
225#if defined (JOB_CONTROL)-
226 case SIGTTIN:
never executed: case 21 :
0
227 case SIGTTOU:
never executed: case 22 :
0
228 case SIGTSTP:
never executed: case 20 :
0
229#endif /* JOB_CONTROL */-
230 if (interactive)
interactiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
0-1
231 set_signal_handler (sig, SIG_IGN);
never executed: set_signal_handler (sig, ((__sighandler_t) 1) );
0
232 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
1
233 }-
234 break;
executed 32 times by 1 test: break;
Executed by:
  • Self test
32
235-
236 case IGNORE:
executed 23 times by 1 test: case 2:
Executed by:
  • Self test
23
237 ignore_signal (sig);-
238 break;
executed 23 times by 1 test: break;
Executed by:
  • Self test
23
239 }-
240 }
executed 270 times by 1 test: end of block
Executed by:
  • Self test
270
241 list = list->next;-
242 }
executed 270 times by 1 test: end of block
Executed by:
  • Self test
270
243 }
executed 206 times by 1 test: end of block
Executed by:
  • Self test
206
244-
245 return (result);
executed 206 times by 1 test: return (result);
Executed by:
  • Self test
206
246}-
247-
248static void-
249showtrap (i)-
250 int i;-
251{-
252 char *t, *p, *sn;-
253-
254 p = trap_list[i];-
255 if (p == (char *)DEFAULT_SIG && signal_is_hard_ignored (i) == 0)
p == (char *) ...ghandler_t) 0)Description
TRUEevaluated 2484 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 238 times by 1 test
Evaluated by:
  • Self test
signal_is_hard...nored (i) == 0Description
TRUEevaluated 2443 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 41 times by 1 test
Evaluated by:
  • Self test
41-2484
256 return;
executed 2443 times by 1 test: return;
Executed by:
  • Self test
2443
257 else if (signal_is_hard_ignored (i))
signal_is_hard_ignored (i)Description
TRUEevaluated 41 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 238 times by 1 test
Evaluated by:
  • Self test
41-238
258 t = (char *)NULL;
executed 41 times by 1 test: t = (char *) ((void *)0) ;
Executed by:
  • Self test
41
259 else-
260 t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p);
executed 238 times by 1 test: t = (p == (char *) ((__sighandler_t) 1) ) ? (char *) ((void *)0) : sh_single_quote (p);
Executed by:
  • Self test
(p == (char *)...andler_t) 1) )Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 226 times by 1 test
Evaluated by:
  • Self test
12-238
261-
262 sn = signal_name (i);-
263 /* Make sure that signals whose names are unknown (for whatever reason)-
264 are printed as signal numbers. */-
265 if (STREQN (sn, "SIGJUNK", 7) || STREQN (sn, "unknown", 7))
never executed: __result = (((const unsigned char *) (const char *) ( sn ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "SIGJUNK" ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( sn ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "unknown" ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
(7 == 0)Description
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
(7 == 0)Description
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
((7 == 0) ? (1..., 7 ))) == 0))Description
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
(sn)[0] == ("SIGJUNK")[0]Description
TRUEevaluated 221 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 58 times by 1 test
Evaluated by:
  • Self test
(__extension__..." , 7 ))) == 0Description
TRUEnever evaluated
FALSEevaluated 221 times by 1 test
Evaluated by:
  • Self test
__builtin_constant_p ( 7 )Description
TRUEevaluated 221 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
__builtin_constant_p ( sn )Description
TRUEnever evaluated
FALSEevaluated 221 times by 1 test
Evaluated by:
  • Self test
strlen ( sn ) ...size_t) ( 7 ))Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons... ( "SIGJUNK" )Description
TRUEevaluated 221 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
strlen ( "SIGJ...size_t) ( 7 ))Description
TRUEnever evaluated
FALSEevaluated 221 times by 1 test
Evaluated by:
  • Self test
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
((7 == 0) ? (1..., 7 ))) == 0))Description
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
(sn)[0] == ("unknown")[0]Description
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
(__extension__..." , 7 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( 7 )Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( sn )Description
TRUEnever evaluated
FALSEnever evaluated
strlen ( sn ) ...size_t) ( 7 ))Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons... ( "unknown" )Description
TRUEnever evaluated
FALSEnever evaluated
strlen ( "unkn...size_t) ( 7 ))Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-279
266 printf ("trap -- %s %d\n", t ? t : "''", i);
never executed: printf ("trap -- %s %d\n", t ? t : "''", i);
0
267 else if (posixly_correct)
posixly_correctDescription
TRUEnever evaluated
FALSEevaluated 279 times by 1 test
Evaluated by:
  • Self test
0-279
268 {-
269 if (STREQN (sn, "SIG", 3))
never executed: __result = (((const unsigned char *) (const char *) ( sn ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "SIG" ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
((3 == 0) ? (1..., 3 ))) == 0))Description
TRUEnever evaluated
FALSEnever evaluated
(3 == 0)Description
TRUEnever evaluated
FALSEnever evaluated
(sn)[0] == ("SIG")[0]Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 3 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( 3 )Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( sn )Description
TRUEnever evaluated
FALSEnever evaluated
strlen ( sn ) ...size_t) ( 3 ))Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( "SIG" )Description
TRUEnever evaluated
FALSEnever evaluated
strlen ( "SIG"...size_t) ( 3 ))Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
270 printf ("trap -- %s %s\n", t ? t : "''", sn+3);
never executed: printf ("trap -- %s %s\n", t ? t : "''", sn+3);
0
271 else-
272 printf ("trap -- %s %s\n", t ? t : "''", sn);
never executed: printf ("trap -- %s %s\n", t ? t : "''", sn);
0
273 }-
274 else-
275 printf ("trap -- %s %s\n", t ? t : "''", sn);
executed 279 times by 1 test: printf ("trap -- %s %s\n", t ? t : "''", sn);
Executed by:
  • Self test
279
276-
277 FREE (t);
executed 226 times by 1 test: sh_xfree((t), "./trap.def", 277);
Executed by:
  • Self test
tDescription
TRUEevaluated 226 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 53 times by 1 test
Evaluated by:
  • Self test
53-226
278}
executed 279 times by 1 test: end of block
Executed by:
  • Self test
279
279-
280static int-
281display_traps (list)-
282 WORD_LIST *list;-
283{-
284 int result, i;-
285-
286 if (list == 0)
list == 0Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
3-40
287 {-
288 for (i = 0; i < BASH_NSIG; i++)
i < 65 +3Description
TRUEevaluated 2720 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 40 times by 1 test
Evaluated by:
  • Self test
40-2720
289 showtrap (i);
executed 2720 times by 1 test: showtrap (i);
Executed by:
  • Self test
2720
290 return (EXECUTION_SUCCESS);
executed 40 times by 1 test: return (0);
Executed by:
  • Self test
40
291 }-
292-
293 for (result = EXECUTION_SUCCESS; list; list = list->next)
listDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
3
294 {-
295 i = decode_signal (list->word->word, DSIG_NOCASE|DSIG_SIGPREFIX);-
296 if (i == NO_SIG)
i == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
1-2
297 {-
298 sh_invalidsig (list->word->word);-
299 result = EXECUTION_FAILURE;-
300 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test
1
301 else-
302 showtrap (i);
executed 2 times by 1 test: showtrap (i);
Executed by:
  • Self test
2
303 }-
304-
305 return (result);
executed 3 times by 1 test: return (result);
Executed by:
  • Self test
3
306}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2