OpenCoverage

findcmd.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/findcmd.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17static char *_find_user_command_internal (const char *, int);-
18static char *find_user_command_internal (const char *, int);-
19static char *find_user_command_in_path (const char *, char *, int);-
20static char *find_in_path_element (const char *, char *, int, int, struct stat *);-
21static char *find_absolute_program (const char *, int);-
22-
23static char *get_next_path_element (char *, int *);-
24-
25-
26-
27-
28-
29-
30static char *file_to_lose_on;-
31-
32-
33-
34int check_hashed_filenames = 0;-
35-
36-
37-
38-
39-
40int dot_found_in_search = 0;-
41-
42-
43-
44static struct ignorevar execignore =-
45{-
46 "EXECIGNORE",-
47 -
48 ((void *)0)-
49 ,-
50 0,-
51 -
52 ((void *)0)-
53 ,-
54 -
55 ((void *)0)-
56-
57};-
58-
59void-
60setup_exec_ignore (varname)-
61 char *varname;-
62{-
63 setup_ignore_patterns (&execignore);-
64}
never executed: end of block
0
65-
66static int-
67exec_name_should_ignore (name)-
68 const char *name;-
69{-
70 struct ign *p;-
71-
72 for (p = execignore.ignores; p
pDescription
TRUEnever evaluated
FALSEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
&& p->val
p->valDescription
TRUEnever evaluated
FALSEnever evaluated
; p++)
0-15553
73 if (strmatch (p->val, (char *)name, (extended_glob ? (1 << 5) : 0)|(1 << 4)) != 1
strmatch (p->v...(1 << 4)) != 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
74 return
never executed: return 1;
1;
never executed: return 1;
0
75 return
executed 15553 times by 1 test: return 0;
Executed by:
  • Self test
0;
executed 15553 times by 1 test: return 0;
Executed by:
  • Self test
15553
76}-
77-
78-
79-
80-
81-
82int-
83file_status (name)-
84 const char *name;-
85{-
86 struct stat finfo;-
87 int r;-
88-
89-
90 if (stat (name, &finfo) < 0
stat (name, &finfo) < 0Description
TRUEevaluated 42002 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
)
15553-42002
91 return
executed 42002 times by 1 test: return (0);
Executed by:
  • Self test
(0);
executed 42002 times by 1 test: return (0);
Executed by:
  • Self test
42002
92-
93-
94-
95 if (-
96 ((((
(((( finfo.st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
0-15553
97 finfo.st_mode
(((( finfo.st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
0-15553
98 )) & 0170000) == (0040000))
(((( finfo.st_... == (0040000))Description
TRUEnever evaluated
FALSEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
0-15553
99 )-
100 return
never executed: return (0x1|0x10);
(0x1|0x10);
never executed: return (0x1|0x10);
0
101-
102 r = 0x1;-
103-
104-
105-
106-
107-
108-
109 if (exec_name_should_ignore (name) == 0
exec_name_shou...re (name) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& eaccess (name,
eaccess (name, 1 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-15553
110 1
eaccess (name, 1 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-15553
111 ) == 0
eaccess (name, 1 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-15553
112 r |= 0x2;
executed 15553 times by 1 test: r |= 0x2;
Executed by:
  • Self test
15553
113 if (eaccess (name,
eaccess (name, 4 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-15553
114 4
eaccess (name, 4 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-15553
115 ) == 0
eaccess (name, 4 ) == 0Description
TRUEevaluated 15553 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-15553
116 r |= 0x40;
executed 15553 times by 1 test: r |= 0x40;
Executed by:
  • Self test
15553
117-
118 return
executed 15553 times by 1 test: return r;
Executed by:
  • Self test
r;
executed 15553 times by 1 test: return r;
Executed by:
  • Self test
15553
119}-
120-
121-
122-
123-
124-
125int-
126executable_file (file)-
127 const char *file;-
128{-
129 int s;-
130-
131 s = file_status (file);-
132-
133 if (s & 0x10
s & 0x10Description
TRUEnever evaluated
FALSEevaluated 21481 times by 1 test
Evaluated by:
  • Self test
)
0-21481
134 -
135 (*
never executed: (*__errno_location ()) = 21 ;
__errno_location ())
never executed: (*__errno_location ()) = 21 ;
0
136 =
never executed: (*__errno_location ()) = 21 ;
0
137 21
never executed: (*__errno_location ()) = 21 ;
0
138 ;
never executed: (*__errno_location ()) = 21 ;
0
139-
140 return
executed 21481 times by 1 test: return ((s & 0x2) && ((s & 0x10) == 0));
Executed by:
  • Self test
((s & 0x2) && ((s & 0x10) == 0));
executed 21481 times by 1 test: return ((s & 0x2) && ((s & 0x10) == 0));
Executed by:
  • Self test
21481
141}-
142-
143int-
144is_directory (file)-
145 const char *file;-
146{-
147 return
executed 5309 times by 1 test: return (file_status (file) & 0x10);
Executed by:
  • Self test
(file_status (file) & 0x10);
executed 5309 times by 1 test: return (file_status (file) & 0x10);
Executed by:
  • Self test
5309
148}-
149-
150int-
151executable_or_directory (file)-
152 const char *file;-
153{-
154 int s;-
155-
156 s = file_status (file);-
157 return
never executed: return ((s & 0x2) || (s & 0x10));
((s & 0x2) || (s & 0x10));
never executed: return ((s & 0x2) || (s & 0x10));
0
158}-
159-
160-
161-
162-
163-
164-
165char *-
166find_user_command (name)-
167 const char *name;-
168{-
169 return
executed 49 times by 1 test: return (find_user_command_internal (name, 0x4|0x20));
Executed by:
  • Self test
(find_user_command_internal (name, 0x4|0x20));
executed 49 times by 1 test: return (find_user_command_internal (name, 0x4|0x20));
Executed by:
  • Self test
49
170}-
171-
172-
173-
174-
175-
176-
177char *-
178find_path_file (name)-
179 const char *name;-
180{-
181 return
executed 1 time by 1 test: return (find_user_command_internal (name, 0x40));
Executed by:
  • Self test
(find_user_command_internal (name, 0x40));
executed 1 time by 1 test: return (find_user_command_internal (name, 0x40));
Executed by:
  • Self test
1
182}-
183-
184static char *-
185_find_user_command_internal (name, flags)-
186 const char *name;-
187 int flags;-
188{-
189 char *path_list, *cmd;-
190 SHELL_VAR *var;-
191-
192-
193-
194 if (var = find_variable_tempenv ("PATH")
var = find_var...mpenv ("PATH")Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-50
195 path_list = ((var)->value);
executed 50 times by 1 test: path_list = ((var)->value);
Executed by:
  • Self test
50
196 else-
197 path_list = (char *)
never executed: path_list = (char *) ((void *)0) ;
0
198 ((void *)0)
never executed: path_list = (char *) ((void *)0) ;
0
199 ;
never executed: path_list = (char *) ((void *)0) ;
0
200-
201 if (path_list == 0
path_list == 0Description
TRUEnever evaluated
FALSEevaluated 50 times by 1 test
Evaluated by:
  • Self test
|| *
*path_list == '\0'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
path_list == '\0'
*path_list == '\0'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
)
0-50
202 return
executed 2 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 275), (name)));
Executed by:
  • Self test
((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 275), (name)));
executed 2 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 275), (name)));
Executed by:
  • Self test
2
203-
204 cmd = find_user_command_in_path (name, path_list, flags);-
205-
206 return
executed 48 times by 1 test: return (cmd);
Executed by:
  • Self test
(cmd);
executed 48 times by 1 test: return (cmd);
Executed by:
  • Self test
48
207}-
208-
209static char *-
210find_user_command_internal (name, flags)-
211 const char *name;-
212 int flags;-
213{-
214 return
executed 50 times by 1 test: return (_find_user_command_internal (name, flags));
Executed by:
  • Self test
(_find_user_command_internal (name, flags));
executed 50 times by 1 test: return (_find_user_command_internal (name, flags));
Executed by:
  • Self test
50
215-
216}-
217-
218-
219-
220-
221-
222static char *-
223get_next_path_element (path_list, path_index_pointer)-
224 char *path_list;-
225 int *path_index_pointer;-
226{-
227 char *path;-
228-
229 path = extract_colon_unit (path_list, path_index_pointer);-
230-
231 if (path == 0
path == 0Description
TRUEnever evaluated
FALSEevaluated 30723 times by 1 test
Evaluated by:
  • Self test
)
0-30723
232 return
never executed: return (path);
(path);
never executed: return (path);
0
233-
234 if (*
*path == '\0'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30711 times by 1 test
Evaluated by:
  • Self test
path == '\0'
*path == '\0'Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30711 times by 1 test
Evaluated by:
  • Self test
)
12-30711
235 {-
236 sh_xfree((path), "findcmd.c", 321);-
237 path = (char *)strcpy (sh_xmalloc((1 + strlen (".")), "findcmd.c", 322), ("."));-
238 }
executed 12 times by 1 test: end of block
Executed by:
  • Self test
12
239-
240 return
executed 30723 times by 1 test: return (path);
Executed by:
  • Self test
(path);
executed 30723 times by 1 test: return (path);
Executed by:
  • Self test
30723
241}-
242char *-
243search_for_command (pathname, flags)-
244 const char *pathname;-
245 int flags;-
246{-
247 char *hashed_file, *command, *path_list;-
248 int temp_path, st;-
249 SHELL_VAR *path;-
250-
251 hashed_file = command = (char *)-
252 ((void *)0)-
253 ;-
254-
255-
256-
257 path = find_variable_tempenv ("PATH");-
258 temp_path = path
pathDescription
TRUEevaluated 27738 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 69 times by 1 test
Evaluated by:
  • Self test
&& ((((
((((path)->att... (0x0100000)))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 27737 times by 1 test
Evaluated by:
  • Self test
path)->attributes) & (0x0100000)))
((((path)->att... (0x0100000)))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 27737 times by 1 test
Evaluated by:
  • Self test
;
1-27738
259-
260-
261-
262-
263 if (temp_path == 0
temp_path == 0Description
TRUEevaluated 27806 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
&& absolute_program (pathname) == 0
absolute_progr...pathname) == 0Description
TRUEevaluated 26821 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 985 times by 1 test
Evaluated by:
  • Self test
)
1-27806
264 hashed_file = phash_search (pathname);
executed 26821 times by 1 test: hashed_file = phash_search (pathname);
Executed by:
  • Self test
26821
265-
266-
267-
268-
269-
270 if (hashed_file
hashed_fileDescription
TRUEevaluated 21477 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6330 times by 1 test
Evaluated by:
  • Self test
&& (posixly_correct
posixly_correctDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 21466 times by 1 test
Evaluated by:
  • Self test
|| check_hashed_filenames
check_hashed_filenamesDescription
TRUEnever evaluated
FALSEevaluated 21466 times by 1 test
Evaluated by:
  • Self test
))
0-21477
271 {-
272 st = file_status (hashed_file);-
273 if ((
(st & (0x1|0x2)) != (0x1|0x2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
st & (0x1|0x2)) != (0x1|0x2)
(st & (0x1|0x2)) != (0x1|0x2)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
)
0-11
274 {-
275 phash_remove (pathname);-
276 sh_xfree((hashed_file), "findcmd.c", 367);-
277 hashed_file = (char *)-
278 ((void *)0)-
279 ;-
280 }
never executed: end of block
0
281 }
executed 11 times by 1 test: end of block
Executed by:
  • Self test
11
282-
283 if (hashed_file
hashed_fileDescription
TRUEevaluated 21477 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6330 times by 1 test
Evaluated by:
  • Self test
)
6330-21477
284 command = hashed_file;
executed 21477 times by 1 test: command = hashed_file;
Executed by:
  • Self test
21477
285 else if (absolute_program (pathname)
absolute_program (pathname)Description
TRUEevaluated 986 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5344 times by 1 test
Evaluated by:
  • Self test
)
986-5344
286-
287-
288 command = (char *)strcpy (sh_xmalloc((1 + strlen (pathname)), "findcmd.c", 377), (pathname));
executed 986 times by 1 test: command = (char *)strcpy (sh_xmalloc((1 + strlen (pathname)), "findcmd.c", 377), (pathname));
Executed by:
  • Self test
986
289 else-
290 {-
291 if (flags & 0x02
flags & 0x02Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5323 times by 1 test
Evaluated by:
  • Self test
)
21-5323
292 path_list = conf_standard_path ();
executed 21 times by 1 test: path_list = conf_standard_path ();
Executed by:
  • Self test
21
293 else if (temp_path
temp_pathDescription
TRUEnever evaluated
FALSEevaluated 5323 times by 1 test
Evaluated by:
  • Self test
|| path
pathDescription
TRUEevaluated 5323 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5323
294 path_list = ((path)->value);
executed 5323 times by 1 test: path_list = ((path)->value);
Executed by:
  • Self test
5323
295 else-
296 path_list = 0;
never executed: path_list = 0;
0
297-
298 command = find_user_command_in_path (pathname, path_list, 0x4|0x20);-
299-
300 if (command
commandDescription
TRUEevaluated 5291 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 53 times by 1 test
Evaluated by:
  • Self test
&& hashing_enabled
hashing_enabledDescription
TRUEevaluated 5291 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& temp_path == 0
temp_path == 0Description
TRUEevaluated 5291 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& (
(flags & 0x01)Description
TRUEevaluated 5291 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 0x01)
(flags & 0x01)Description
TRUEevaluated 5291 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5291
301 {-
302-
303-
304-
305 if (((
(command)[0] == (pathname)[0]Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5274 times by 1 test
Evaluated by:
  • Self test
command)[0] == (pathname)[0]
(command)[0] == (pathname)[0]Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5274 times by 1 test
Evaluated by:
  • Self test
&&
17-5274
306 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
307 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
308 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
309 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
310 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
311 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
312 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
313 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
314 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
315 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
316 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
317 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
318 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
319 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
320 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
321 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
322 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
323 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
324 ,
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
325 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
326 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
327 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
328 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
329 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
330 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
331 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
332 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
333 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
334 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
335 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
336 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
337 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
338 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
339 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
340 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
341 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
342 ,
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
343 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
344 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
345 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
346 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
347 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
348 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
349 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
350 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
351 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
352 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]);
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
353 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]);
0-17
354 ))[3] - __s2[3]);
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]);
}
never executed: end of block
}
never executed: end of block
__result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
355 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
356 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
357 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
358 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
359 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
360 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
361 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
362 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
363 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
364 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
365 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
366 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
367 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
368 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
369 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
370 ,
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
371 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
372 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
373 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
374 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
375 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
376 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
377 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
378 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
379 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
380 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( pathname ))[3] - __s2[3]);
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
381 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( pathname ))[3] - __s2[3]);
0-17
382 ))[3] - __s2[3]);
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( pathname ))[3] - __s2[3]);
}
never executed: end of block
}
never executed: end of block
__result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
383 command
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
384 ,
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
385 pathname
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
386 )))); })
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-17
387 == 0
__extension__ ... )))); }) == 0Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
))
0-17
388 {-
389 st = file_status (command);-
390 if (st & 0x2
st & 0x2Description
TRUEnever evaluated
FALSEevaluated 17 times by 1 test
Evaluated by:
  • Self test
)
0-17
391 phash_insert ((char *)pathname, command, dot_found_in_search, 1);
never executed: phash_insert ((char *)pathname, command, dot_found_in_search, 1);
0
392 }
executed 17 times by 1 test: end of block
Executed by:
  • Self test
17
393 else-
394 phash_insert ((char *)pathname, command, dot_found_in_search, 1);
executed 5274 times by 1 test: phash_insert ((char *)pathname, command, dot_found_in_search, 1);
Executed by:
  • Self test
5274
395 }-
396-
397 if (flags & 0x02
flags & 0x02Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5323 times by 1 test
Evaluated by:
  • Self test
)
21-5323
398 sh_xfree((path_list), "findcmd.c", 405);
executed 21 times by 1 test: sh_xfree((path_list), "findcmd.c", 405);
Executed by:
  • Self test
21
399 }
executed 5344 times by 1 test: end of block
Executed by:
  • Self test
5344
400-
401 return
executed 27807 times by 1 test: return (command);
Executed by:
  • Self test
(command);
executed 27807 times by 1 test: return (command);
Executed by:
  • Self test
27807
402}-
403-
404char *-
405user_command_matches (name, flags, state)-
406 const char *name;-
407 int flags, state;-
408{-
409 register int i;-
410 int path_index, name_len;-
411 char *path_list, *path_element, *match;-
412 struct stat dotinfo;-
413 static char **match_list = -
414 ((void *)0)-
415 ;-
416 static int match_list_size = 0;-
417 static int match_index = 0;-
418-
419 if (state == 0
state == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-2
420 {-
421-
422 if (match_list == 0
match_list == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-2
423 {-
424 match_list_size = 5;-
425 match_list = strvec_create (match_list_size);-
426 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test
2
427-
428-
429 for (i = 0; i < match_list_size
i < match_list_sizeDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
; i++)
2-10
430 match_list[i] = 0;
executed 10 times by 1 test: match_list[i] = 0;
Executed by:
  • Self test
10
431-
432-
433 match_index = 0;-
434-
435 if (absolute_program (name)
absolute_program (name)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
)
0-2
436 {-
437 match_list[0] = find_absolute_program (name, flags);-
438 match_list[1] = (char *)-
439 ((void *)0)-
440 ;-
441 path_list = (char *)-
442 ((void *)0)-
443 ;-
444 }
never executed: end of block
0
445 else-
446 {-
447 name_len = strlen (name);-
448 file_to_lose_on = (char *)-
449 ((void *)0)-
450 ;-
451 dot_found_in_search = 0;-
452 if (stat (".", &dotinfo) < 0
stat (".", &dotinfo) < 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
)
0-2
453 dotinfo.st_dev = dotinfo.st_ino = 0;
never executed: dotinfo.st_dev = dotinfo.st_ino = 0;
0
454 path_list = get_string_value ("PATH");-
455 path_index = 0;-
456 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test
2
457-
458 while (path_list
path_listDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& path_list[path_index]
path_list[path_index]Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
)
0-18
459 {-
460 path_element = get_next_path_element (path_list, &path_index);-
461-
462 if (path_element == 0
path_element == 0Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
)
0-16
463 break;
never executed: break;
0
464-
465 match = find_in_path_element (name, path_element, flags, name_len, &dotinfo);-
466-
467 sh_xfree((path_element), "findcmd.c", 466);-
468-
469 if (match == 0
match == 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-16
470 continue;
executed 16 times by 1 test: continue;
Executed by:
  • Self test
16
471-
472 if (match_index + 1 == match_list_size
match_index + ...atch_list_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
473 {-
474 match_list_size += 10;-
475 match_list = strvec_resize (match_list, (match_list_size + 1));-
476 }
never executed: end of block
0
477-
478 match_list[match_index++] = match;-
479 match_list[match_index] = (char *)-
480 ((void *)0)-
481 ;-
482 do { if (file_to_lose_on
file_to_lose_onDescription
TRUEnever evaluated
FALSEnever evaluated
) sh_xfree((file_to_lose_on), "findcmd.c", 479);
never executed: sh_xfree((file_to_lose_on), "findcmd.c", 479);
} while (0);
0
483 file_to_lose_on = (char *)-
484 ((void *)0)-
485 ;-
486 }
never executed: end of block
0
487-
488-
489 match_index = 0;-
490 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test
2
491-
492 match = match_list[match_index];-
493-
494 if (match
matchDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test
)
0-2
495 match_index++;
never executed: match_index++;
0
496-
497 return
executed 2 times by 1 test: return (match);
Executed by:
  • Self test
(match);
executed 2 times by 1 test: return (match);
Executed by:
  • Self test
2
498}-
499-
500static char *-
501find_absolute_program (name, flags)-
502 const char *name;-
503 int flags;-
504{-
505 int st;-
506-
507 st = file_status (name);-
508-
509-
510 if ((
(st & 0x1) == 0Description
TRUEnever evaluated
FALSEnever evaluated
st & 0x1) == 0
(st & 0x1) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
511 return
never executed: return ((char *) ((void *)0) );
((char *)
never executed: return ((char *) ((void *)0) );
0
512 ((void *)0)
never executed: return ((char *) ((void *)0) );
0
513 );
never executed: return ((char *) ((void *)0) );
0
514-
515-
516-
517-
518 if ((
(flags & 0x1)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x1)
(flags & 0x1)Description
TRUEnever evaluated
FALSEnever evaluated
|| ((
(flags & 0x8)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x8)
(flags & 0x8)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(st & 0x2)Description
TRUEnever evaluated
FALSEnever evaluated
st & 0x2)
(st & 0x2)Description
TRUEnever evaluated
FALSEnever evaluated
))
0
519 return
never executed: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 512), (name)));
((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 512), (name)));
never executed: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 512), (name)));
0
520-
521 return
never executed: return ( ((void *)0) );
(
never executed: return ( ((void *)0) );
0
522 ((void *)0)
never executed: return ( ((void *)0) );
0
523 );
never executed: return ( ((void *)0) );
0
524}-
525-
526static char *-
527find_in_path_element (name, path, flags, name_len, dotinfop)-
528 const char *name;-
529 char *path;-
530 int flags, name_len;-
531 struct stat *dotinfop;-
532{-
533 int status;-
534 char *full_path, *xpath;-
535-
536 xpath = (posixly_correct == 0
posixly_correct == 0Description
TRUEevaluated 30672 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 51 times by 1 test
Evaluated by:
  • Self test
&& *
*path == '~'Description
TRUEnever evaluated
FALSEevaluated 30672 times by 1 test
Evaluated by:
  • Self test
path == '~'
*path == '~'Description
TRUEnever evaluated
FALSEevaluated 30672 times by 1 test
Evaluated by:
  • Self test
) ? bash_tilde_expand (path, 0) : path;
0-30672
537-
538-
539-
540 if (dot_found_in_search == 0
dot_found_in_search == 0Description
TRUEevaluated 5767 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24956 times by 1 test
Evaluated by:
  • Self test
&& *
*xpath == '.'Description
TRUEevaluated 5255 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 512 times by 1 test
Evaluated by:
  • Self test
xpath == '.'
*xpath == '.'Description
TRUEevaluated 5255 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 512 times by 1 test
Evaluated by:
  • Self test
)
512-24956
541 dot_found_in_search = same_file (".", xpath, dotinfop, (struct stat *)
executed 5255 times by 1 test: dot_found_in_search = same_file (".", xpath, dotinfop, (struct stat *) ((void *)0) );
Executed by:
  • Self test
5255
542 ((void *)0)
executed 5255 times by 1 test: dot_found_in_search = same_file (".", xpath, dotinfop, (struct stat *) ((void *)0) );
Executed by:
  • Self test
5255
543 );
executed 5255 times by 1 test: dot_found_in_search = same_file (".", xpath, dotinfop, (struct stat *) ((void *)0) );
Executed by:
  • Self test
5255
544-
545 full_path = sh_makepath (xpath, name, 0);-
546-
547 status = file_status (full_path);-
548-
549 if (xpath != path
xpath != pathDescription
TRUEnever evaluated
FALSEevaluated 30723 times by 1 test
Evaluated by:
  • Self test
)
0-30723
550 sh_xfree((xpath), "findcmd.c", 539);
never executed: sh_xfree((xpath), "findcmd.c", 539);
0
551-
552 if ((
(status & 0x1) == 0Description
TRUEevaluated 25420 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
status & 0x1) == 0
(status & 0x1) == 0Description
TRUEevaluated 25420 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
)
5303-25420
553 {-
554 sh_xfree((full_path), "findcmd.c", 543);-
555 return
executed 25420 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
((char *)
executed 25420 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
25420
556 ((void *)0)
executed 25420 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
25420
557 );
executed 25420 times by 1 test: return ((char *) ((void *)0) );
Executed by:
  • Self test
25420
558 }-
559-
560-
561 if (flags & 0x1
flags & 0x1Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
)
0-5303
562 return
never executed: return (full_path);
(full_path);
never executed: return (full_path);
0
563-
564-
565-
566 if ((
(flags & 0x40)Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
flags & 0x40)
(flags & 0x40)Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
&& (
(status & 0x40)Description
TRUEnever evaluated
FALSEnever evaluated
status & 0x40)
(status & 0x40)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-5303
567 return
never executed: return (full_path);
(full_path);
never executed: return (full_path);
0
568-
569-
570-
571 if ((
(status & 0x2)Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
status & 0x2)
(status & 0x2)Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& (
(flags & (0x8|0x4))Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & (0x8|0x4))
(flags & (0x8|0x4))Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&&
0-5303
572 (((
((flags & 0x20) == 0)Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
flags & 0x20) == 0)
((flags & 0x20) == 0)Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
|| ((
((status & 0x10) == 0)Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
status & 0x10) == 0)
((status & 0x10) == 0)Description
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
))
0-5303
573 {-
574 do { if (file_to_lose_on
file_to_lose_onDescription
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
) sh_xfree((file_to_lose_on), "findcmd.c", 561);
never executed: sh_xfree((file_to_lose_on), "findcmd.c", 561);
} while (0);
0-5303
575 file_to_lose_on = (char *)-
576 ((void *)0)-
577 ;-
578 return
executed 5303 times by 1 test: return (full_path);
Executed by:
  • Self test
(full_path);
executed 5303 times by 1 test: return (full_path);
Executed by:
  • Self test
5303
579 }-
580-
581-
582-
583-
584 if ((
(flags & 0x4)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x4)
(flags & 0x4)Description
TRUEnever evaluated
FALSEnever evaluated
&& file_to_lose_on == 0
file_to_lose_on == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& exec_name_should_ignore (full_path) == 0
exec_name_shou...ull_path) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
585 file_to_lose_on = (char *)strcpy (sh_xmalloc((1 + strlen (full_path)), "findcmd.c", 570), (full_path));
never executed: file_to_lose_on = (char *)strcpy (sh_xmalloc((1 + strlen (full_path)), "findcmd.c", 570), (full_path));
0
586-
587-
588-
589-
590 if ((
(flags & (0x8|0x4))Description
TRUEnever evaluated
FALSEnever evaluated
flags & (0x8|0x4))
(flags & (0x8|0x4))Description
TRUEnever evaluated
FALSEnever evaluated
||
0
591 ((
(flags & 0x20)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x20)
(flags & 0x20)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(status & 0x10)Description
TRUEnever evaluated
FALSEnever evaluated
status & 0x10)
(status & 0x10)Description
TRUEnever evaluated
FALSEnever evaluated
) ||
0
592 ((
(flags & 0x40)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x40)
(flags & 0x40)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(status & 0x40) == 0Description
TRUEnever evaluated
FALSEnever evaluated
status & 0x40) == 0
(status & 0x40) == 0Description
TRUEnever evaluated
FALSEnever evaluated
))
0
593 {-
594 sh_xfree((full_path), "findcmd.c", 579);-
595 return
never executed: return ((char *) ((void *)0) );
((char *)
never executed: return ((char *) ((void *)0) );
0
596 ((void *)0)
never executed: return ((char *) ((void *)0) );
0
597 );
never executed: return ((char *) ((void *)0) );
0
598 }-
599 else-
600 return
never executed: return (full_path);
(full_path);
never executed: return (full_path);
0
601}-
602static char *-
603find_user_command_in_path (name, path_list, flags)-
604 const char *name;-
605 char *path_list;-
606 int flags;-
607{-
608 char *full_path, *path;-
609 int path_index, name_len;-
610 struct stat dotinfo;-
611-
612-
613-
614 dot_found_in_search = 0;-
615-
616 if (absolute_program (name)
absolute_program (name)Description
TRUEnever evaluated
FALSEevaluated 5398 times by 1 test
Evaluated by:
  • Self test
)
0-5398
617 {-
618 full_path = find_absolute_program (name, flags);-
619 return
never executed: return (full_path);
(full_path);
never executed: return (full_path);
0
620 }-
621-
622 if (path_list == 0
path_list == 0Description
TRUEnever evaluated
FALSEevaluated 5398 times by 1 test
Evaluated by:
  • Self test
|| *
*path_list == '\0'Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5381 times by 1 test
Evaluated by:
  • Self test
path_list == '\0'
*path_list == '\0'Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5381 times by 1 test
Evaluated by:
  • Self test
)
0-5398
623 return
executed 17 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 619), (name)));
Executed by:
  • Self test
((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 619), (name)));
executed 17 times by 1 test: return ((char *)strcpy (sh_xmalloc((1 + strlen (name)), "findcmd.c", 619), (name)));
Executed by:
  • Self test
17
624-
625 file_to_lose_on = (char *)-
626 ((void *)0)-
627 ;-
628 name_len = strlen (name);-
629 if (stat (".", &dotinfo) < 0
stat (".", &dotinfo) < 0Description
TRUEnever evaluated
FALSEevaluated 5381 times by 1 test
Evaluated by:
  • Self test
)
0-5381
630 dotinfo.st_dev = dotinfo.st_ino = 0;
never executed: dotinfo.st_dev = dotinfo.st_ino = 0;
0
631 path_index = 0;-
632-
633 while (path_list[path_index]
path_list[path_index]Description
TRUEevaluated 30707 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 78 times by 1 test
Evaluated by:
  • Self test
)
78-30707
634 {-
635-
636 do { if (terminating_signal
terminating_signalDescription
TRUEnever evaluated
FALSEevaluated 30707 times by 1 test
Evaluated by:
  • Self test
) termsig_handler (terminating_signal);
never executed: termsig_handler (terminating_signal);
if (interrupt_state
interrupt_stateDescription
TRUEnever evaluated
FALSEevaluated 30707 times by 1 test
Evaluated by:
  • Self test
) throw_to_top_level ();
never executed: throw_to_top_level ();
} while (0);
0-30707
637-
638 path = get_next_path_element (path_list, &path_index);-
639 if (path == 0
path == 0Description
TRUEnever evaluated
FALSEevaluated 30707 times by 1 test
Evaluated by:
  • Self test
)
0-30707
640 break;
never executed: break;
0
641-
642-
643-
644 full_path = find_in_path_element (name, path, flags, name_len, &dotinfo);-
645 sh_xfree((path), "findcmd.c", 639);-
646-
647-
648-
649 if (full_path
full_pathDescription
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 25404 times by 1 test
Evaluated by:
  • Self test
&& is_directory (full_path)
is_directory (full_path)Description
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
)
0-25404
650 {-
651 sh_xfree((full_path), "findcmd.c", 645);-
652 continue;
never executed: continue;
0
653 }-
654-
655 if (full_path
full_pathDescription
TRUEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 25404 times by 1 test
Evaluated by:
  • Self test
)
5303-25404
656 {-
657 do { if (file_to_lose_on
file_to_lose_onDescription
TRUEnever evaluated
FALSEevaluated 5303 times by 1 test
Evaluated by:
  • Self test
) sh_xfree((file_to_lose_on), "findcmd.c", 651);
never executed: sh_xfree((file_to_lose_on), "findcmd.c", 651);
} while (0);
0-5303
658 return
executed 5303 times by 1 test: return (full_path);
Executed by:
  • Self test
(full_path);
executed 5303 times by 1 test: return (full_path);
Executed by:
  • Self test
5303
659 }-
660 }
executed 25404 times by 1 test: end of block
Executed by:
  • Self test
25404
661-
662-
663-
664-
665-
666-
667-
668 if (file_to_lose_on
file_to_lose_onDescription
TRUEnever evaluated
FALSEevaluated 78 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x20)Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x20)
(flags & 0x20)Description
TRUEnever evaluated
FALSEnever evaluated
&& is_directory (file_to_lose_on)
is_directory (file_to_lose_on)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-78
669 {-
670 sh_xfree((file_to_lose_on), "findcmd.c", 664);-
671 file_to_lose_on = (char *)-
672 ((void *)0)-
673 ;-
674 }
never executed: end of block
0
675-
676 return
executed 78 times by 1 test: return (file_to_lose_on);
Executed by:
  • Self test
(file_to_lose_on);
executed 78 times by 1 test: return (file_to_lose_on);
Executed by:
  • Self test
78
677}-
678-
679-
680-
681char *-
682find_in_path (name, path_list, flags)-
683 const char *name;-
684 char *path_list;-
685 int flags;-
686{-
687 return
executed 6 times by 1 test: return (find_user_command_in_path (name, path_list, flags));
Executed by:
  • Self test
(find_user_command_in_path (name, path_list, flags));
executed 6 times by 1 test: return (find_user_command_in_path (name, path_list, flags));
Executed by:
  • Self test
6
688}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2