OpenCoverage

print_cmd.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/print_cmd.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19-
20-
21-
22static int indentation;-
23static int indentation_amount = 4;-
24-
25-
26typedef void PFUNC (const char *, ...);-
27-
28static void cprintf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));-
29static void xprintf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));-
30-
31-
32-
33-
34-
35-
36static void reset_locals (void);-
37static void newline (char *);-
38static void indent (int);-
39static void semicolon (void);-
40static void the_printed_command_resize (int);-
41-
42static void make_command_string_internal (COMMAND *);-
43static void _print_word_list (WORD_LIST *, char *, PFUNC *);-
44static void command_print_word_list (WORD_LIST *, char *);-
45static void print_case_clauses (PATTERN_LIST *);-
46static void print_redirection_list (REDIRECT *);-
47static void print_redirection (REDIRECT *);-
48static void print_heredoc_header (REDIRECT *);-
49static void print_heredoc_body (REDIRECT *);-
50static void print_heredocs (REDIRECT *);-
51static void print_heredoc_bodies (REDIRECT *);-
52static void print_deferred_heredocs (const char *);-
53-
54static void print_for_command (FOR_COM *);-
55-
56static void print_arith_for_command (ARITH_FOR_COM *);-
57-
58-
59static void print_select_command (SELECT_COM *);-
60-
61static void print_group_command (GROUP_COM *);-
62static void print_case_command (CASE_COM *);-
63static void print_while_command (WHILE_COM *);-
64static void print_until_command (WHILE_COM *);-
65static void print_until_or_while (WHILE_COM *, char *);-
66static void print_if_command (IF_COM *);-
67-
68static void print_cond_node (COND_COM *);-
69-
70static void print_function_def (FUNCTION_DEF *);-
71-
72-
73-
74-
75char *the_printed_command = (char *)-
76 ((void *)0)-
77 ;-
78int the_printed_command_size = 0;-
79int command_string_index = 0;-
80-
81int xtrace_fd = -1;-
82FILE *xtrace_fp = 0;-
83static int inside_function_def;-
84static int skip_this_indent;-
85static int was_heredoc;-
86static int printing_connection;-
87static REDIRECT *deferred_heredocs;-
88-
89-
90-
91static int group_command_nesting;-
92-
93-
94static char *indirection_string = 0;-
95static int indirection_stringsiz = 0;-
96-
97-
98void-
99print_command (command)-
100 COMMAND *command;-
101{-
102 command_string_index = 0;-
103 printf ("%s", make_command_string (command));-
104}
never executed: end of block
0
105-
106-
107-
108-
109-
110char *-
111make_command_string (command)-
112 COMMAND *command;-
113{-
114 command_string_index = was_heredoc = 0;-
115 deferred_heredocs = 0;-
116 make_command_string_internal (command);-
117 return
executed 5886 times by 1 test: return (the_printed_command);
Executed by:
  • Self test
(the_printed_command);
executed 5886 times by 1 test: return (the_printed_command);
Executed by:
  • Self test
5886
118}-
119-
120-
121static void-
122make_command_string_internal (command)-
123 COMMAND *command;-
124{-
125 char s[3];-
126-
127 if (command == 0
command == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30519 times by 1 test
Evaluated by:
  • Self test
)
6-30519
128 cprintf ("");
executed 6 times by 1 test: cprintf ("");
Executed by:
  • Self test
6
129 else-
130 {-
131 if (skip_this_indent
skip_this_indentDescription
TRUEevaluated 19560 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10959 times by 1 test
Evaluated by:
  • Self test
)
10959-19560
132 skip_this_indent--;
executed 19560 times by 1 test: skip_this_indent--;
Executed by:
  • Self test
19560
133 else-
134 indent (indentation);
executed 10959 times by 1 test: indent (indentation);
Executed by:
  • Self test
10959
135-
136 if (command->flags & 0x80
command->flags & 0x80Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30513 times by 1 test
Evaluated by:
  • Self test
)
6-30513
137 {-
138 cprintf ("time ");-
139 if (command->flags & 0x100
command->flags & 0x100Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
1-5
140 cprintf ("-p ");
executed 5 times by 1 test: cprintf ("-p ");
Executed by:
  • Self test
5
141 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test
6
142-
143 if (command->flags & 0x04
command->flags & 0x04Description
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30370 times by 1 test
Evaluated by:
  • Self test
)
149-30370
144 cprintf ("! ");
executed 149 times by 1 test: cprintf ("! ");
Executed by:
  • Self test
149
145-
146 switch (command->type)-
147 {-
148 case
executed 19 times by 1 test: case cm_for:
Executed by:
  • Self test
cm_for:
executed 19 times by 1 test: case cm_for:
Executed by:
  • Self test
19
149 print_for_command (command->value.For);-
150 break;
executed 19 times by 1 test: break;
Executed by:
  • Self test
19
151-
152-
153 case
executed 1119 times by 1 test: case cm_arith_for:
Executed by:
  • Self test
cm_arith_for:
executed 1119 times by 1 test: case cm_arith_for:
Executed by:
  • Self test
1119
154 print_arith_for_command (command->value.ArithFor);-
155 break;
executed 1119 times by 1 test: break;
Executed by:
  • Self test
1119
156-
157-
158-
159 case
never executed: case cm_select:
cm_select:
never executed: case cm_select:
0
160 print_select_command (command->value.Select);-
161 break;
never executed: break;
0
162-
163-
164 case
executed 7 times by 1 test: case cm_case:
Executed by:
  • Self test
cm_case:
executed 7 times by 1 test: case cm_case:
Executed by:
  • Self test
7
165 print_case_command (command->value.Case);-
166 break;
executed 7 times by 1 test: break;
Executed by:
  • Self test
7
167-
168 case
executed 23 times by 1 test: case cm_while:
Executed by:
  • Self test
cm_while:
executed 23 times by 1 test: case cm_while:
Executed by:
  • Self test
23
169 print_while_command (command->value.While);-
170 break;
executed 23 times by 1 test: break;
Executed by:
  • Self test
23
171-
172 case
executed 5 times by 1 test: case cm_until:
Executed by:
  • Self test
cm_until:
executed 5 times by 1 test: case cm_until:
Executed by:
  • Self test
5
173 print_until_command (command->value.While);-
174 break;
executed 5 times by 1 test: break;
Executed by:
  • Self test
5
175-
176 case
executed 626 times by 1 test: case cm_if:
Executed by:
  • Self test
cm_if:
executed 626 times by 1 test: case cm_if:
Executed by:
  • Self test
626
177 print_if_command (command->value.If);-
178 break;
executed 626 times by 1 test: break;
Executed by:
  • Self test
626
179-
180-
181 case
executed 1222 times by 1 test: case cm_arith:
Executed by:
  • Self test
cm_arith:
executed 1222 times by 1 test: case cm_arith:
Executed by:
  • Self test
1222
182 print_arith_command (command->value.Arith->exp);-
183 break;
executed 1222 times by 1 test: break;
Executed by:
  • Self test
1222
184-
185-
186-
187 case
executed 10 times by 1 test: case cm_cond:
Executed by:
  • Self test
cm_cond:
executed 10 times by 1 test: case cm_cond:
Executed by:
  • Self test
10
188 print_cond_command (command->value.Cond);-
189 break;
executed 10 times by 1 test: break;
Executed by:
  • Self test
10
190-
191-
192 case
executed 13606 times by 1 test: case cm_simple:
Executed by:
  • Self test
cm_simple:
executed 13606 times by 1 test: case cm_simple:
Executed by:
  • Self test
13606
193 print_simple_command (command->value.Simple);-
194 break;
executed 13606 times by 1 test: break;
Executed by:
  • Self test
13606
195-
196 case
executed 7914 times by 1 test: case cm_connection:
Executed by:
  • Self test
cm_connection:
executed 7914 times by 1 test: case cm_connection:
Executed by:
  • Self test
7914
197-
198 skip_this_indent++;-
199 printing_connection++;-
200 make_command_string_internal (command->value.Connection->first);-
201-
202 switch (command->value.Connection->connector)-
203 {-
204 case
executed 100 times by 1 test: case '&':
Executed by:
  • Self test
'&':
executed 100 times by 1 test: case '&':
Executed by:
  • Self test
100
205 case
executed 39 times by 1 test: case '|':
Executed by:
  • Self test
'|':
executed 39 times by 1 test: case '|':
Executed by:
  • Self test
39
206 {-
207 char c = command->value.Connection->connector;-
208-
209 s[0] = ' ';-
210 s[1] = c;-
211 s[2] = '\0';-
212-
213 print_deferred_heredocs (s);-
214-
215 if (c != '&'
c != '&'Description
TRUEevaluated 39 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test
|| command->value.Connection->second
command->value...ection->secondDescription
TRUEevaluated 94 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
)
6-100
216 {-
217 cprintf (" ");-
218 skip_this_indent++;-
219 }
executed 133 times by 1 test: end of block
Executed by:
  • Self test
133
220 }-
221 break;
executed 139 times by 1 test: break;
Executed by:
  • Self test
139
222-
223 case
executed 17 times by 1 test: case 288:
Executed by:
  • Self test
288:
executed 17 times by 1 test: case 288:
Executed by:
  • Self test
17
224 print_deferred_heredocs (" && ");-
225 if (command->value.Connection->second
command->value...ection->secondDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-17
226 skip_this_indent++;
executed 17 times by 1 test: skip_this_indent++;
Executed by:
  • Self test
17
227 break;
executed 17 times by 1 test: break;
Executed by:
  • Self test
17
228-
229 case
executed 10 times by 1 test: case 289:
Executed by:
  • Self test
289:
executed 10 times by 1 test: case 289:
Executed by:
  • Self test
10
230 print_deferred_heredocs (" || ");-
231 if (command->value.Connection->second
command->value...ection->secondDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-10
232 skip_this_indent++;
executed 10 times by 1 test: skip_this_indent++;
Executed by:
  • Self test
10
233 break;
executed 10 times by 1 test: break;
Executed by:
  • Self test
10
234-
235 case
executed 7748 times by 1 test: case ';':
Executed by:
  • Self test
';':
executed 7748 times by 1 test: case ';':
Executed by:
  • Self test
7748
236 if (deferred_heredocs == 0
deferred_heredocs == 0Description
TRUEevaluated 7735 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test
)
13-7735
237 {-
238 if (was_heredoc == 0
was_heredoc == 0Description
TRUEevaluated 7722 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test
)
13-7722
239 cprintf (";");
executed 7722 times by 1 test: cprintf (";");
Executed by:
  • Self test
7722
240 else-
241 was_heredoc = 0;
executed 13 times by 1 test: was_heredoc = 0;
Executed by:
  • Self test
13
242 }-
243 else-
244 print_deferred_heredocs (inside_function_def ? "" : ";");
executed 13 times by 1 test: print_deferred_heredocs (inside_function_def ? "" : ";");
Executed by:
  • Self test
13
245-
246 if (inside_function_def
inside_function_defDescription
TRUEevaluated 2857 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4891 times by 1 test
Evaluated by:
  • Self test
)
2857-4891
247 cprintf ("\n");
executed 2857 times by 1 test: cprintf ("\n");
Executed by:
  • Self test
2857
248 else-
249 {-
250 cprintf (" ");-
251 if (command->value.Connection->second
command->value...ection->secondDescription
TRUEevaluated 4891 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-4891
252 skip_this_indent++;
executed 4891 times by 1 test: skip_this_indent++;
Executed by:
  • Self test
4891
253 }
executed 4891 times by 1 test: end of block
Executed by:
  • Self test
4891
254 break;
executed 7748 times by 1 test: break;
Executed by:
  • Self test
7748
255-
256 default
never executed: default:
:
never executed: default:
0
257 cprintf (-
258 dcgettext (((void *)0), -
259 "print_command: bad connector `%d'"-
260 , 5)-
261 ,-
262 command->value.Connection->connector);-
263 break;
never executed: break;
0
264 }-
265-
266 make_command_string_internal (command->value.Connection->second);-
267 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7898 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
executed 16 times by 1 test: print_deferred_heredocs ("");
Executed by:
  • Self test
} while (0);
16-7898
268 printing_connection--;-
269 break;
executed 7914 times by 1 test: break;
Executed by:
  • Self test
7914
270-
271 case
executed 11 times by 1 test: case cm_function_def:
Executed by:
  • Self test
cm_function_def:
executed 11 times by 1 test: case cm_function_def:
Executed by:
  • Self test
11
272 print_function_def (command->value.Function_def);-
273 break;
executed 11 times by 1 test: break;
Executed by:
  • Self test
11
274-
275 case
executed 734 times by 1 test: case cm_group:
Executed by:
  • Self test
cm_group:
executed 734 times by 1 test: case cm_group:
Executed by:
  • Self test
734
276 print_group_command (command->value.Group);-
277 break;
executed 734 times by 1 test: break;
Executed by:
  • Self test
734
278-
279 case
executed 5190 times by 1 test: case cm_subshell:
Executed by:
  • Self test
cm_subshell:
executed 5190 times by 1 test: case cm_subshell:
Executed by:
  • Self test
5190
280 cprintf ("( ");-
281 skip_this_indent++;-
282 make_command_string_internal (command->value.Subshell->command);-
283 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5188 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
executed 2 times by 1 test: print_deferred_heredocs ("");
Executed by:
  • Self test
} while (0);
2-5188
284 cprintf (" )");-
285 break;
executed 5190 times by 1 test: break;
Executed by:
  • Self test
5190
286-
287 case
executed 33 times by 1 test: case cm_coproc:
Executed by:
  • Self test
cm_coproc:
executed 33 times by 1 test: case cm_coproc:
Executed by:
  • Self test
33
288 cprintf ("coproc %s ", command->value.Coproc->name);-
289 skip_this_indent++;-
290 make_command_string_internal (command->value.Coproc->command);-
291 break;
executed 33 times by 1 test: break;
Executed by:
  • Self test
33
292-
293 default
never executed: default:
:
never executed: default:
0
294 command_error ("print_command", 1, command->type, 0);-
295 break;
never executed: break;
0
296 }-
297-
298-
299 if (command->redirects
command->redirectsDescription
TRUEevaluated 1672 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 28847 times by 1 test
Evaluated by:
  • Self test
)
1672-28847
300 {-
301 cprintf (" ");-
302 print_redirection_list (command->redirects);-
303 }
executed 1672 times by 1 test: end of block
Executed by:
  • Self test
1672
304 }
executed 30519 times by 1 test: end of block
Executed by:
  • Self test
30519
305}-
306-
307static void-
308_print_word_list (list, separator, pfunc)-
309 WORD_LIST *list;-
310 char *separator;-
311 PFUNC *pfunc;-
312{-
313 WORD_LIST *w;-
314-
315 for (w = list; w
wDescription
TRUEevaluated 113345661 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 76740485 times by 1 test
Evaluated by:
  • Self test
; w = w->next)
76740485-113345661
316 (*
executed 113345661 times by 1 test: (*pfunc) ("%s%s", w->word->word, w->next ? separator : "");
Executed by:
  • Self test
pfunc) ("%s%s", w->word->word, w->next ? separator : "");
executed 113345661 times by 1 test: (*pfunc) ("%s%s", w->word->word, w->next ? separator : "");
Executed by:
  • Self test
113345661
317}
executed 76740485 times by 1 test: end of block
Executed by:
  • Self test
76740485
318-
319void-
320print_word_list (list, separator)-
321 WORD_LIST *list;-
322 char *separator;-
323{-
324 _print_word_list (list, separator, xprintf);-
325}
never executed: end of block
0
326-
327void-
328xtrace_set (fd, fp)-
329 int fd;-
330 FILE *fp;-
331{-
332 if (fd >= 0
fd >= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
&& sh_validfd (fd) == 0
sh_validfd (fd) == 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
0-5432
333 {-
334 internal_error (-
335 dcgettext (((void *)0), -
336 "xtrace_set: %d: invalid file descriptor"-
337 , 5)-
338 , fd);-
339 return;
never executed: return;
0
340 }-
341 if (fp == 0
fp == 0Description
TRUEnever evaluated
FALSEevaluated 5433 times by 1 test
Evaluated by:
  • Self test
)
0-5433
342 {-
343 internal_error (-
344 dcgettext (((void *)0), -
345 "xtrace_set: NULL file pointer"-
346 , 5)-
347 );-
348 return;
never executed: return;
0
349 }-
350 if (fd >= 0
fd >= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
&& fileno (fp) != fd
fileno (fp) != fdDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
0-5432
351 internal_warning (
never executed: internal_warning ( dcgettext (((void *)0), "xtrace fd (%d) != fileno xtrace fp (%d)" , 5) , fd, fileno (fp));
0
352 dcgettext (((void *)0),
never executed: internal_warning ( dcgettext (((void *)0), "xtrace fd (%d) != fileno xtrace fp (%d)" , 5) , fd, fileno (fp));
0
353 "xtrace fd (%d) != fileno xtrace fp (%d)"
never executed: internal_warning ( dcgettext (((void *)0), "xtrace fd (%d) != fileno xtrace fp (%d)" , 5) , fd, fileno (fp));
0
354 , 5)
never executed: internal_warning ( dcgettext (((void *)0), "xtrace fd (%d) != fileno xtrace fp (%d)" , 5) , fd, fileno (fp));
0
355 , fd, fileno (fp));
never executed: internal_warning ( dcgettext (((void *)0), "xtrace fd (%d) != fileno xtrace fp (%d)" , 5) , fd, fileno (fp));
0
356-
357 xtrace_fd = fd;-
358 xtrace_fp = fp;-
359}
executed 5433 times by 1 test: end of block
Executed by:
  • Self test
5433
360-
361void-
362xtrace_init ()-
363{-
364 xtrace_set (-1, -
365 stderr-
366 );-
367}
executed 5432 times by 1 test: end of block
Executed by:
  • Self test
5432
368-
369void-
370xtrace_reset ()-
371{-
372 if (xtrace_fd >= 0
xtrace_fd >= 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
&& xtrace_fp
xtrace_fpDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-1
373 {-
374 fflush (xtrace_fp);-
375 fclose (xtrace_fp);-
376 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test
1
377 else if (xtrace_fd >= 0
xtrace_fd >= 0Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
0-1
378 close (xtrace_fd);
never executed: close (xtrace_fd);
0
379-
380 xtrace_fd = -1;-
381 xtrace_fp = -
382 stderr-
383 ;-
384}
executed 2 times by 1 test: end of block
Executed by:
  • Self test
2
385-
386void-
387xtrace_fdchk (fd)-
388 int fd;-
389{-
390 if (fd == xtrace_fd
fd == xtrace_fdDescription
TRUEnever evaluated
FALSEevaluated 666440 times by 1 test
Evaluated by:
  • Self test
)
0-666440
391 xtrace_reset ();
never executed: xtrace_reset ();
0
392}
executed 666440 times by 1 test: end of block
Executed by:
  • Self test
666440
393-
394-
395-
396char *-
397indirection_level_string ()-
398{-
399 register int i, j;-
400 char *ps4;-
401 char ps4_firstc[-
402 16-
403 +1];-
404 int ps4_firstc_len, ps4_len, ineed, old;-
405-
406 ps4 = get_string_value ("PS4");-
407 if (indirection_string == 0
indirection_string == 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 53 times by 1 test
Evaluated by:
  • Self test
)
6-53
408 indirection_string = sh_xmalloc((indirection_stringsiz = 100), "print_cmd.c", 429);
executed 6 times by 1 test: indirection_string = sh_xmalloc((indirection_stringsiz = 100), "print_cmd.c", 429);
Executed by:
  • Self test
6
409 indirection_string[0] = '\0';-
410-
411 if (ps4 == 0
ps4 == 0Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
|| *
*ps4 == '\0'Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
ps4 == '\0'
*ps4 == '\0'Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
)
0-59
412 return
never executed: return (indirection_string);
(indirection_string);
never executed: return (indirection_string);
0
413-
414 old = change_flag ('x', '+');-
415 ps4 = decode_prompt_string (ps4);-
416 if (old
oldDescription
TRUEevaluated 59 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-59
417 change_flag ('x', '-');
executed 59 times by 1 test: change_flag ('x', '-');
Executed by:
  • Self test
59
418-
419 if (ps4 == 0
ps4 == 0Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
|| *
*ps4 == '\0'Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
ps4 == '\0'
*ps4 == '\0'Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
)
0-59
420 return
never executed: return (indirection_string);
(indirection_string);
never executed: return (indirection_string);
0
421-
422-
423 ps4_len = strnlen (ps4, -
424 (__ctype_get_mb_cur_max ())-
425 );-
426 ps4_firstc_len = ((
( (__ctype_get...r_max ()) > 1)Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-59
427 (__ctype_get_mb_cur_max ())
( (__ctype_get...r_max ()) > 1)Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
0-59
428 > 1)
( (__ctype_get...r_max ()) > 1)Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? mblen ((ps4), (ps4_len)) : 1);
0-59
429 if (ps4_firstc_len == 1
ps4_firstc_len == 1Description
TRUEevaluated 59 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
|| ps4_firstc_len == 0
ps4_firstc_len == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| ps4_firstc_len < 0
ps4_firstc_len < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0-59
430 {-
431 ps4_firstc[0] = ps4[0];-
432 ps4_firstc[ps4_firstc_len = 1] = '\0';-
433 }
executed 59 times by 1 test: end of block
Executed by:
  • Self test
59
434 else-
435 memcpy (ps4_firstc, ps4, ps4_firstc_len);
never executed: memcpy (ps4_firstc, ps4, ps4_firstc_len);
0
436-
437-
438-
439-
440-
441-
442-
443 ineed = (ps4_firstc_len * indirection_level) + strlen (ps4);-
444 if (ineed > indirection_stringsiz - 1
ineed > indire..._stringsiz - 1Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
)
0-59
445 {-
446 indirection_stringsiz = ineed + 1;-
447 indirection_string = sh_xrealloc((indirection_string), (indirection_stringsiz), "print_cmd.c", 464);-
448 }
never executed: end of block
0
449-
450 for (i = j = 0; ps4_firstc[0]
ps4_firstc[0]Description
TRUEevaluated 119 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& j < indirection_level
j < indirection_levelDescription
TRUEevaluated 60 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
&& i < indirection_stringsiz - 1
i < indirection_stringsiz - 1Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
; i += ps4_firstc_len, j++)
0-119
451 {-
452 if (ps4_firstc_len == 1
ps4_firstc_len == 1Description
TRUEevaluated 60 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-60
453 indirection_string[i] = ps4_firstc[0];
executed 60 times by 1 test: indirection_string[i] = ps4_firstc[0];
Executed by:
  • Self test
60
454 else-
455 memcpy (indirection_string+i, ps4_firstc, ps4_firstc_len);
never executed: memcpy (indirection_string+i, ps4_firstc, ps4_firstc_len);
0
456 }-
457-
458 for (j = ps4_firstc_len; *
*ps4Description
TRUEevaluated 148 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
ps4
*ps4Description
TRUEevaluated 148 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& ps4[j]
ps4[j]Description
TRUEevaluated 89 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
&& i < indirection_stringsiz - 1
i < indirection_stringsiz - 1Description
TRUEevaluated 89 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
; i++, j++)
0-148
459 indirection_string[i] = ps4[j];
executed 89 times by 1 test: indirection_string[i] = ps4[j];
Executed by:
  • Self test
89
460-
461 indirection_string[i] = '\0';-
462 sh_xfree((ps4), "print_cmd.c", 479);-
463 return
executed 59 times by 1 test: return (indirection_string);
Executed by:
  • Self test
(indirection_string);
executed 59 times by 1 test: return (indirection_string);
Executed by:
  • Self test
59
464}-
465-
466void-
467xtrace_print_assignment (name, value, assign_list, xflags)-
468 char *name, *value;-
469 int assign_list, xflags;-
470{-
471 char *nval;-
472-
473 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? xtrace_fp :
0-12
474 stderr-
475 );-
476-
477 if (xflags
xflagsDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-12
478 fprintf (xtrace_fp, "%s", indirection_level_string ());
executed 12 times by 1 test: fprintf (xtrace_fp, "%s", indirection_level_string ());
Executed by:
  • Self test
12
479-
480-
481 if (*
*value == '\0'Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
value == '\0'
*value == '\0'Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
|| assign_list
assign_listDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
0-12
482 nval = value;
never executed: nval = value;
0
483 else if (sh_contains_shell_metas (value)
sh_contains_sh..._metas (value)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
0-12
484 nval = sh_single_quote (value);
never executed: nval = sh_single_quote (value);
0
485 else if (ansic_shouldquote (value)
ansic_shouldquote (value)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
0-12
486 nval = ansic_quote (value, 0, (int *)0);
never executed: nval = ansic_quote (value, 0, (int *)0);
0
487 else-
488 nval = value;
executed 12 times by 1 test: nval = value;
Executed by:
  • Self test
12
489-
490 if (assign_list
assign_listDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
0-12
491 fprintf (xtrace_fp, "%s=(%s)\n", name, nval);
never executed: fprintf (xtrace_fp, "%s=(%s)\n", name, nval);
0
492 else-
493 fprintf (xtrace_fp, "%s=%s\n", name, nval);
executed 12 times by 1 test: fprintf (xtrace_fp, "%s=%s\n", name, nval);
Executed by:
  • Self test
12
494-
495 if (nval != value
nval != valueDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
0-12
496 do { if (nval
nvalDescription
TRUEnever evaluated
FALSEnever evaluated
) sh_xfree((nval), "print_cmd.c", 511);
never executed: sh_xfree((nval), "print_cmd.c", 511);
}
never executed: end of block
while (0);
0
497-
498 fflush (xtrace_fp);-
499}
executed 12 times by 1 test: end of block
Executed by:
  • Self test
12
500-
501-
502-
503-
504-
505void-
506xtrace_print_word_list (list, xtflags)-
507 WORD_LIST *list;-
508 int xtflags;-
509{-
510 WORD_LIST *w;-
511 char *t, *x;-
512-
513 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? xtrace_fp :
0-32
514 stderr-
515 );-
516-
517 if (xtflags&1
xtflags&1Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8 times by 1 test
Evaluated by:
  • Self test
)
8-24
518 fprintf (xtrace_fp, "%s", indirection_level_string ());
executed 24 times by 1 test: fprintf (xtrace_fp, "%s", indirection_level_string ());
Executed by:
  • Self test
24
519-
520 for (w = list; w
wDescription
TRUEevaluated 82 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 32 times by 1 test
Evaluated by:
  • Self test
; w = w->next)
32-82
521 {-
522 t = w->word->word;-
523 if (t == 0
t == 0Description
TRUEnever evaluated
FALSEevaluated 82 times by 1 test
Evaluated by:
  • Self test
|| *
*t == '\0'Description
TRUEnever evaluated
FALSEevaluated 82 times by 1 test
Evaluated by:
  • Self test
t == '\0'
*t == '\0'Description
TRUEnever evaluated
FALSEevaluated 82 times by 1 test
Evaluated by:
  • Self test
)
0-82
524 fprintf (xtrace_fp, "''%s", w->next ? " " : "");
never executed: fprintf (xtrace_fp, "''%s", w->next ? " " : "");
0
525 else if (xtflags & 2
xtflags & 2Description
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
)
34-48
526 fprintf (xtrace_fp, "%s%s", t, w->next ? " " : "");
executed 34 times by 1 test: fprintf (xtrace_fp, "%s%s", t, w->next ? " " : "");
Executed by:
  • Self test
34
527 else if (sh_contains_shell_metas (t)
sh_contains_shell_metas (t)Description
TRUEnever evaluated
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test
)
0-48
528 {-
529 x = sh_single_quote (t);-
530 fprintf (xtrace_fp, "%s%s", x, w->next ? " " : "");-
531 sh_xfree((x), "print_cmd.c", 544);-
532 }
never executed: end of block
0
533 else if (ansic_shouldquote (t)
ansic_shouldquote (t)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 47 times by 1 test
Evaluated by:
  • Self test
)
1-47
534 {-
535 x = ansic_quote (t, 0, (int *)0);-
536 fprintf (xtrace_fp, "%s%s", x, w->next ? " " : "");-
537 sh_xfree((x), "print_cmd.c", 550);-
538 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test
1
539 else-
540 fprintf (xtrace_fp, "%s%s", t, w->next ? " " : "");
executed 47 times by 1 test: fprintf (xtrace_fp, "%s%s", t, w->next ? " " : "");
Executed by:
  • Self test
47
541 }-
542 fprintf (xtrace_fp, "\n");-
543 fflush (xtrace_fp);-
544}
executed 32 times by 1 test: end of block
Executed by:
  • Self test
32
545-
546static void-
547command_print_word_list (list, separator)-
548 WORD_LIST *list;-
549 char *separator;-
550{-
551 _print_word_list (list, separator, cprintf);-
552}
executed 76740485 times by 1 test: end of block
Executed by:
  • Self test
76740485
553-
554void-
555print_for_command_head (for_command)-
556 FOR_COM *for_command;-
557{-
558 cprintf ("for %s in ", for_command->name->word);-
559 command_print_word_list (for_command->map_list, " ");-
560}
executed 5456701 times by 1 test: end of block
Executed by:
  • Self test
5456701
561-
562void-
563xtrace_print_for_command_head (for_command)-
564 FOR_COM *for_command;-
565{-
566 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? xtrace_fp :
0-8
567 stderr-
568 );-
569 fprintf (xtrace_fp, "%s", indirection_level_string ());-
570 fprintf (xtrace_fp, "for %s in ", for_command->name->word);-
571 xtrace_print_word_list (for_command->map_list, 2);-
572}
executed 8 times by 1 test: end of block
Executed by:
  • Self test
8
573-
574static void-
575print_for_command (for_command)-
576 FOR_COM *for_command;-
577{-
578 print_for_command_head (for_command);-
579 cprintf (";");-
580 newline ("do\n");-
581-
582 indentation += indentation_amount;-
583 make_command_string_internal (for_command->action);-
584 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
executed 1 time by 1 test: print_deferred_heredocs ("");
Executed by:
  • Self test
} while (0);
1-18
585 semicolon ();-
586 indentation -= indentation_amount;-
587-
588 newline ("done");-
589}
executed 19 times by 1 test: end of block
Executed by:
  • Self test
19
590-
591-
592static void-
593print_arith_for_command (arith_for_command)-
594 ARITH_FOR_COM *arith_for_command;-
595{-
596 cprintf ("for ((");-
597 command_print_word_list (arith_for_command->init, " ");-
598 cprintf ("; ");-
599 command_print_word_list (arith_for_command->test, " ");-
600 cprintf ("; ");-
601 command_print_word_list (arith_for_command->step, " ");-
602 cprintf ("))");-
603 newline ("do\n");-
604 indentation += indentation_amount;-
605 make_command_string_internal (arith_for_command->action);-
606 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 1119 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-1119
607 semicolon ();-
608 indentation -= indentation_amount;-
609 newline ("done");-
610}
executed 1119 times by 1 test: end of block
Executed by:
  • Self test
1119
611-
612-
613-
614void-
615print_select_command_head (select_command)-
616 SELECT_COM *select_command;-
617{-
618 cprintf ("select %s in ", select_command->name->word);-
619 command_print_word_list (select_command->map_list, " ");-
620}
executed 9 times by 1 test: end of block
Executed by:
  • Self test
9
621-
622void-
623xtrace_print_select_command_head (select_command)-
624 SELECT_COM *select_command;-
625{-
626 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEnever evaluated
FALSEnever evaluated
? xtrace_fp :
0
627 stderr-
628 );-
629 fprintf (xtrace_fp, "%s", indirection_level_string ());-
630 fprintf (xtrace_fp, "select %s in ", select_command->name->word);-
631 xtrace_print_word_list (select_command->map_list, 2);-
632}
never executed: end of block
0
633-
634static void-
635print_select_command (select_command)-
636 SELECT_COM *select_command;-
637{-
638 print_select_command_head (select_command);-
639-
640 cprintf (";");-
641 newline ("do\n");-
642 indentation += indentation_amount;-
643 make_command_string_internal (select_command->action);-
644 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEnever evaluated
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0
645 semicolon ();-
646 indentation -= indentation_amount;-
647 newline ("done");-
648}
never executed: end of block
0
649-
650-
651static void-
652print_group_command (group_command)-
653 GROUP_COM *group_command;-
654{-
655 group_command_nesting++;-
656 cprintf ("{ ");-
657-
658 if (inside_function_def == 0
inside_function_def == 0Description
TRUEevaluated 718 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
)
16-718
659 skip_this_indent++;
executed 718 times by 1 test: skip_this_indent++;
Executed by:
  • Self test
718
660 else-
661 {-
662-
663-
664-
665 cprintf ("\n");-
666 indentation += indentation_amount;-
667 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test
16
668-
669 make_command_string_internal (group_command->command);-
670 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 732 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
executed 2 times by 1 test: print_deferred_heredocs ("");
Executed by:
  • Self test
} while (0);
2-732
671-
672 if (inside_function_def
inside_function_defDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 718 times by 1 test
Evaluated by:
  • Self test
)
16-718
673 {-
674 cprintf ("\n");-
675 indentation -= indentation_amount;-
676 indent (indentation);-
677 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test
16
678 else-
679 {-
680 semicolon ();-
681 cprintf (" ");-
682 }
executed 718 times by 1 test: end of block
Executed by:
  • Self test
718
683-
684 cprintf ("}");-
685-
686 group_command_nesting--;-
687}
executed 734 times by 1 test: end of block
Executed by:
  • Self test
734
688-
689void-
690print_case_command_head (case_command)-
691 CASE_COM *case_command;-
692{-
693 cprintf ("case %s in ", case_command->word->word);-
694}
executed 36947178 times by 1 test: end of block
Executed by:
  • Self test
36947178
695-
696void-
697xtrace_print_case_command_head (case_command)-
698 CASE_COM *case_command;-
699{-
700 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? xtrace_fp :
0-1
701 stderr-
702 );-
703 fprintf (xtrace_fp, "%s", indirection_level_string ());-
704 fprintf (xtrace_fp, "case %s in\n", case_command->word->word);-
705}
executed 1 time by 1 test: end of block
Executed by:
  • Self test
1
706-
707static void-
708print_case_command (case_command)-
709 CASE_COM *case_command;-
710{-
711 print_case_command_head (case_command);-
712-
713 if (case_command->clauses
case_command->clausesDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-7
714 print_case_clauses (case_command->clauses);
executed 7 times by 1 test: print_case_clauses (case_command->clauses);
Executed by:
  • Self test
7
715 newline ("esac");-
716}
executed 7 times by 1 test: end of block
Executed by:
  • Self test
7
717-
718static void-
719print_case_clauses (clauses)-
720 PATTERN_LIST *clauses;-
721{-
722 indentation += indentation_amount;-
723 while (clauses
clausesDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test
)
7-14
724 {-
725 newline ("");-
726 command_print_word_list (clauses->patterns, " | ");-
727 cprintf (")\n");-
728 indentation += indentation_amount;-
729 make_command_string_internal (clauses->action);-
730 indentation -= indentation_amount;-
731 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-14
732 if (clauses->flags & 0x01
clauses->flags & 0x01Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
)
0-14
733 newline (";&");
never executed: newline (";&");
0
734 else if (clauses->flags & 0x02
clauses->flags & 0x02Description
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
)
0-14
735 newline (";;&");
never executed: newline (";;&");
0
736 else-
737 newline (";;");
executed 14 times by 1 test: newline (";;");
Executed by:
  • Self test
14
738 clauses = clauses->next;-
739 }
executed 14 times by 1 test: end of block
Executed by:
  • Self test
14
740 indentation -= indentation_amount;-
741}
executed 7 times by 1 test: end of block
Executed by:
  • Self test
7
742-
743static void-
744print_while_command (while_command)-
745 WHILE_COM *while_command;-
746{-
747 print_until_or_while (while_command, "while");-
748}
executed 23 times by 1 test: end of block
Executed by:
  • Self test
23
749-
750static void-
751print_until_command (while_command)-
752 WHILE_COM *while_command;-
753{-
754 print_until_or_while (while_command, "until");-
755}
executed 5 times by 1 test: end of block
Executed by:
  • Self test
5
756-
757static void-
758print_until_or_while (while_command, which)-
759 WHILE_COM *while_command;-
760 char *which;-
761{-
762 cprintf ("%s ", which);-
763 skip_this_indent++;-
764 make_command_string_internal (while_command->test);-
765 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-28
766 semicolon ();-
767 cprintf (" do\n");-
768 indentation += indentation_amount;-
769 make_command_string_internal (while_command->action);-
770 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-28
771 indentation -= indentation_amount;-
772 semicolon ();-
773 newline ("done");-
774}
executed 28 times by 1 test: end of block
Executed by:
  • Self test
28
775-
776static void-
777print_if_command (if_command)-
778 IF_COM *if_command;-
779{-
780 cprintf ("if ");-
781 skip_this_indent++;-
782 make_command_string_internal (if_command->test);-
783 semicolon ();-
784 cprintf (" then\n");-
785 indentation += indentation_amount;-
786 make_command_string_internal (if_command->true_case);-
787 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 626 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-626
788 indentation -= indentation_amount;-
789-
790 if (if_command->false_case
if_command->false_caseDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 616 times by 1 test
Evaluated by:
  • Self test
)
10-616
791 {-
792 semicolon ();-
793 newline ("else\n");-
794 indentation += indentation_amount;-
795 make_command_string_internal (if_command->false_case);-
796 do { if (deferred_heredocs
deferred_heredocsDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test
) print_deferred_heredocs ("");
never executed: print_deferred_heredocs ("");
} while (0);
0-10
797 indentation -= indentation_amount;-
798 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test
10
799 semicolon ();-
800 newline ("fi");-
801}
executed 626 times by 1 test: end of block
Executed by:
  • Self test
626
802-
803-
804void-
805print_arith_command (arith_cmd_list)-
806 WORD_LIST *arith_cmd_list;-
807{-
808 cprintf ("((");-
809 command_print_word_list (arith_cmd_list, " ");-
810 cprintf ("))");-
811}
executed 6556553 times by 1 test: end of block
Executed by:
  • Self test
6556553
812-
813-
814-
815static void-
816print_cond_node (cond)-
817 COND_COM *cond;-
818{-
819 if (cond->flags & 0x04
cond->flags & 0x04Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2900 times by 1 test
Evaluated by:
  • Self test
)
2-2900
820 cprintf ("! ");
executed 2 times by 1 test: cprintf ("! ");
Executed by:
  • Self test
2
821-
822 if (cond->type == 6
cond->type == 6Description
TRUEevaluated 141 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2761 times by 1 test
Evaluated by:
  • Self test
)
141-2761
823 {-
824 cprintf ("( ");-
825 print_cond_node (cond->left);-
826 cprintf (" )");-
827 }
executed 141 times by 1 test: end of block
Executed by:
  • Self test
141
828 else if (cond->type == 1
cond->type == 1Description
TRUEevaluated 169 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2592 times by 1 test
Evaluated by:
  • Self test
)
169-2592
829 {-
830 print_cond_node (cond->left);-
831 cprintf (" && ");-
832 print_cond_node (cond->right);-
833 }
executed 169 times by 1 test: end of block
Executed by:
  • Self test
169
834 else if (cond->type == 2
cond->type == 2Description
TRUEevaluated 77 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2515 times by 1 test
Evaluated by:
  • Self test
)
77-2515
835 {-
836 print_cond_node (cond->left);-
837 cprintf (" || ");-
838 print_cond_node (cond->right);-
839 }
executed 77 times by 1 test: end of block
Executed by:
  • Self test
77
840 else if (cond->type == 3
cond->type == 3Description
TRUEevaluated 143 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2372 times by 1 test
Evaluated by:
  • Self test
)
143-2372
841 {-
842 cprintf ("%s", cond->op->word);-
843 cprintf (" ");-
844 print_cond_node (cond->left);-
845 }
executed 143 times by 1 test: end of block
Executed by:
  • Self test
143
846 else if (cond->type == 4
cond->type == 4Description
TRUEevaluated 743 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1629 times by 1 test
Evaluated by:
  • Self test
)
743-1629
847 {-
848 print_cond_node (cond->left);-
849 cprintf (" ");-
850 cprintf ("%s", cond->op->word);-
851 cprintf (" ");-
852 print_cond_node (cond->right);-
853 }
executed 743 times by 1 test: end of block
Executed by:
  • Self test
743
854 else if (cond->type == 5
cond->type == 5Description
TRUEevaluated 1629 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-1629
855 {-
856 cprintf ("%s", cond->op->word);-
857 }
executed 1629 times by 1 test: end of block
Executed by:
  • Self test
1629
858}
executed 2902 times by 1 test: end of block
Executed by:
  • Self test
2902
859-
860void-
861print_cond_command (cond)-
862 COND_COM *cond;-
863{-
864 cprintf ("[[ ");-
865 print_cond_node (cond);-
866 cprintf (" ]]");-
867}
executed 640 times by 1 test: end of block
Executed by:
  • Self test
640
868-
869-
870void-
871debug_print_word_list (s, list, sep)-
872 char *s;-
873 WORD_LIST *list;-
874 char *sep;-
875{-
876 WORD_LIST *w;-
877-
878 if (s
sDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
879 fprintf (
never executed: fprintf ( stderr , "%s: ", s);
0
880 stderr
never executed: fprintf ( stderr , "%s: ", s);
0
881 , "%s: ", s);
never executed: fprintf ( stderr , "%s: ", s);
0
882 for (w = list; w
wDescription
TRUEnever evaluated
FALSEnever evaluated
; w = w->next)
0
883 fprintf (
never executed: fprintf ( stderr , "%s%s", w->word->word, w->next ? sep : "");
0
884 stderr
never executed: fprintf ( stderr , "%s%s", w->word->word, w->next ? sep : "");
0
885 , "%s%s", w->word->word, w->next ? sep : "");
never executed: fprintf ( stderr , "%s%s", w->word->word, w->next ? sep : "");
0
886 fprintf (-
887 stderr-
888 , "\n");-
889}
never executed: end of block
0
890-
891void-
892debug_print_cond_command (cond)-
893 COND_COM *cond;-
894{-
895 fprintf (-
896 stderr-
897 , "DEBUG: ");-
898 command_string_index = 0;-
899 print_cond_command (cond);-
900 fprintf (-
901 stderr-
902 , "%s\n", the_printed_command);-
903}
never executed: end of block
0
904-
905-
906void-
907xtrace_print_cond_term (type, invert, op, arg1, arg2)-
908 int type, invert;-
909 WORD_DESC *op;-
910 char *arg1, *arg2;-
911{-
912 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEnever evaluated
FALSEnever evaluated
? xtrace_fp :
0
913 stderr-
914 );-
915 command_string_index = 0;-
916 fprintf (xtrace_fp, "%s", indirection_level_string ());-
917 fprintf (xtrace_fp, "[[ ");-
918 if (invert
invertDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
919 fprintf (xtrace_fp, "! ");
never executed: fprintf (xtrace_fp, "! ");
0
920-
921 if (type == 3
type == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
922 {-
923 fprintf (xtrace_fp, "%s ", op->word);-
924 fprintf (xtrace_fp, "%s", (arg1 && *arg1) ? arg1 : "''");-
925 }
never executed: end of block
0
926 else if (type == 4
type == 4Description
TRUEnever evaluated
FALSEnever evaluated
)
0
927 {-
928 fprintf (xtrace_fp, "%s", (arg1 && *arg1) ? arg1 : "''");-
929 fprintf (xtrace_fp, " %s ", op->word);-
930 fprintf (xtrace_fp, "%s", (arg2 && *arg2) ? arg2 : "''");-
931 }
never executed: end of block
0
932-
933 fprintf (xtrace_fp, " ]]\n");-
934-
935 fflush (xtrace_fp);-
936}
never executed: end of block
0
937-
938-
939-
940-
941void-
942xtrace_print_arith_cmd (list)-
943 WORD_LIST *list;-
944{-
945 WORD_LIST *w;-
946-
947 xtrace_fp = (xtrace_fp
xtrace_fpDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? xtrace_fp :
0-14
948 stderr-
949 );-
950 fprintf (xtrace_fp, "%s", indirection_level_string ());-
951 fprintf (xtrace_fp, "(( ");-
952 for (w = list; w
wDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
; w = w->next)
14
953 fprintf (xtrace_fp, "%s%s", w->word->word, w->next ? " " : "");
executed 14 times by 1 test: fprintf (xtrace_fp, "%s%s", w->word->word, w->next ? " " : "");
Executed by:
  • Self test
14
954 fprintf (xtrace_fp, " ))\n");-
955-
956 fflush (xtrace_fp);-
957}
executed 14 times by 1 test: end of block
Executed by:
  • Self test
14
958-
959-
960void-
961print_simple_command (simple_command)-
962 SIMPLE_COM *simple_command;-
963{-
964 command_print_word_list (simple_command->words, " ");-
965-
966 if (simple_command->redirects
simple_command->redirectsDescription
TRUEevaluated 14550 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 64709301 times by 1 test
Evaluated by:
  • Self test
)
14550-64709301
967 {-
968 cprintf (" ");-
969 print_redirection_list (simple_command->redirects);-
970 }
executed 14550 times by 1 test: end of block
Executed by:
  • Self test
14550
971}
executed 64723851 times by 1 test: end of block
Executed by:
  • Self test
64723851
972-
973static void-
974print_heredocs (heredocs)-
975 REDIRECT *heredocs;-
976{-
977 REDIRECT *hdtail;-
978-
979 cprintf (" ");-
980 for (hdtail = heredocs; hdtail
hdtailDescription
TRUEnever evaluated
FALSEnever evaluated
; hdtail = hdtail->next)
0
981 {-
982 print_redirection (hdtail);-
983 cprintf ("\n");-
984 }
never executed: end of block
0
985 was_heredoc = 1;-
986}
never executed: end of block
0
987-
988static void-
989print_heredoc_bodies (heredocs)-
990 REDIRECT *heredocs;-
991{-
992 REDIRECT *hdtail;-
993-
994 cprintf ("\n");-
995 for (hdtail = heredocs; hdtail
hdtailDescription
TRUEevaluated 1342 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1340 times by 1 test
Evaluated by:
  • Self test
; hdtail = hdtail->next)
1340-1342
996 {-
997 print_heredoc_body (hdtail);-
998 cprintf ("\n");-
999 }
executed 1342 times by 1 test: end of block
Executed by:
  • Self test
1342
1000 was_heredoc = 1;-
1001}
executed 1340 times by 1 test: end of block
Executed by:
  • Self test
1340
1002static void-
1003print_deferred_heredocs (cstring)-
1004 const char *cstring;-
1005{-
1006-
1007 if (cstring
cstringDescription
TRUEevaluated 200 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& cstring[0]
cstring[0]Description
TRUEevaluated 166 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34 times by 1 test
Evaluated by:
  • Self test
&& (cstring[0] != ';'
cstring[0] != ';'Description
TRUEevaluated 166 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
|| cstring[1]
cstring[1]Description
TRUEnever evaluated
FALSEnever evaluated
))
0-200
1008 cprintf ("%s", cstring);
executed 166 times by 1 test: cprintf ("%s", cstring);
Executed by:
  • Self test
166
1009 if (deferred_heredocs
deferred_heredocsDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 166 times by 1 test
Evaluated by:
  • Self test
)
34-166
1010 {-
1011 print_heredoc_bodies (deferred_heredocs);-
1012 if (cstring
cstringDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& cstring[0]
cstring[0]Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • Self test
&& (cstring[0] != ';'
cstring[0] != ';'Description
TRUEnever evaluated
FALSEnever evaluated
|| cstring[1]
cstring[1]Description
TRUEnever evaluated
FALSEnever evaluated
))
0-34
1013 cprintf (" ");
never executed: cprintf (" ");
0
1014 dispose_redirects (deferred_heredocs);-
1015 was_heredoc = 1;-
1016 }
executed 34 times by 1 test: end of block
Executed by:
  • Self test
34
1017 deferred_heredocs = (REDIRECT *)-
1018 ((void *)0)-
1019 ;-
1020}
executed 200 times by 1 test: end of block
Executed by:
  • Self test
200
1021-
1022static void-
1023print_redirection_list (redirects)-
1024 REDIRECT *redirects;-
1025{-
1026 REDIRECT *heredocs, *hdtail, *newredir;-
1027 char *rw;-
1028-
1029 heredocs = (REDIRECT *)-
1030 ((void *)0)-
1031 ;-
1032 hdtail = heredocs;-
1033-
1034 was_heredoc = 0;-
1035 while (redirects
redirectsDescription
TRUEevaluated 17606 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16246 times by 1 test
Evaluated by:
  • Self test
)
16246-17606
1036 {-
1037-
1038-
1039 if (redirects->instruction == r_reading_until
redirects->ins..._reading_untilDescription
TRUEevaluated 1334 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16272 times by 1 test
Evaluated by:
  • Self test
|| redirects->instruction == r_deblank_reading_until
redirects->ins..._reading_untilDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16264 times by 1 test
Evaluated by:
  • Self test
)
8-16272
1040 {-
1041 newredir = copy_redirect (redirects);-
1042 newredir->next = (REDIRECT *)-
1043 ((void *)0)-
1044 ;-
1045-
1046 print_heredoc_header (newredir);-
1047-
1048 if (heredocs
heredocsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1340 times by 1 test
Evaluated by:
  • Self test
)
2-1340
1049 {-
1050 hdtail->next = newredir;-
1051 hdtail = newredir;-
1052 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test
2
1053 else-
1054 hdtail = heredocs = newredir;
executed 1340 times by 1 test: hdtail = heredocs = newredir;
Executed by:
  • Self test
1340
1055 }-
1056 else if (redirects->instruction == r_duplicating_output_word
redirects->ins...ng_output_wordDescription
TRUEevaluated 113 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16151 times by 1 test
Evaluated by:
  • Self test
&& (
(redirects->flags & 0x01) == 0Description
TRUEevaluated 113 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
redirects->flags & 0x01) == 0
(redirects->flags & 0x01) == 0Description
TRUEevaluated 113 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& redirects->redirector.dest == 1
redirects->red...ctor.dest == 1Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
)
0-16151
1057 {-
1058-
1059 rw = redirects->redirectee.filename->word;-
1060 if (rw
rwDescription
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& *
*rw != '-'Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
rw != '-'
*rw != '-'Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& ((*
(*rw) >= '0'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
rw) >= '0'
(*rw) >= '0'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
&& (*
(*rw) <= '9'Description
TRUEnever evaluated
FALSEnever evaluated
rw) <= '9'
(*rw) <= '9'Description
TRUEnever evaluated
FALSEnever evaluated
) == 0
((*rw) >= '0' ...) <= '9') == 0Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& ((*
(*rw) == '{'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
rw) == '{'
(*rw) == '{'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
|| (*
(*rw) == '~'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
rw) == '~'
(*rw) == '~'Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
|| (*
(*rw) == '$'Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
rw) == '$'
(*rw) == '$'Description
TRUEevaluated 108 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
|| (*
(*rw) == '`'Description
TRUEnever evaluated
FALSEnever evaluated
rw) == '`'
(*rw) == '`'Description
TRUEnever evaluated
FALSEnever evaluated
) == 0
((*rw) == '{' ...) == '`') == 0Description
TRUEnever evaluated
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test
)
0-108
1061 redirects->instruction = r_err_and_out;
never executed: redirects->instruction = r_err_and_out;
0
1062 print_redirection (redirects);-
1063 redirects->instruction = r_duplicating_output_word;-
1064 }
executed 108 times by 1 test: end of block
Executed by:
  • Self test
108
1065 else-
1066 print_redirection (redirects);
executed 16156 times by 1 test: print_redirection (redirects);
Executed by:
  • Self test
16156
1067-
1068 redirects = redirects->next;-
1069 if (redirects
redirectsDescription
TRUEevaluated 1360 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16246 times by 1 test
Evaluated by:
  • Self test
)
1360-16246
1070 cprintf (" ");
executed 1360 times by 1 test: cprintf (" ");
Executed by:
  • Self test
1360
1071 }
executed 17606 times by 1 test: end of block
Executed by:
  • Self test
17606
1072-
1073-
1074-
1075-
1076 if (heredocs
heredocsDescription
TRUEevaluated 1340 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14906 times by 1 test
Evaluated by:
  • Self test
&& printing_connection
printing_connectionDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1306 times by 1 test
Evaluated by:
  • Self test
)
34-14906
1077 deferred_heredocs = heredocs;
executed 34 times by 1 test: deferred_heredocs = heredocs;
Executed by:
  • Self test
34
1078 else if (heredocs
heredocsDescription
TRUEevaluated 1306 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14906 times by 1 test
Evaluated by:
  • Self test
)
1306-14906
1079 {-
1080 print_heredoc_bodies (heredocs);-
1081 dispose_redirects (heredocs);-
1082 }
executed 1306 times by 1 test: end of block
Executed by:
  • Self test
1306
1083}
executed 16246 times by 1 test: end of block
Executed by:
  • Self test
16246
1084-
1085static void-
1086print_heredoc_header (redirect)-
1087 REDIRECT *redirect;-
1088{-
1089 int kill_leading;-
1090 char *x;-
1091-
1092 kill_leading = redirect->instruction == r_deblank_reading_until;-
1093-
1094-
1095 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1340 times by 1 test
Evaluated by:
  • Self test
)
2-1340
1096 cprintf ("{%s}", redirect->redirector.filename->word);
executed 2 times by 1 test: cprintf ("{%s}", redirect->redirector.filename->word);
Executed by:
  • Self test
2
1097 else if (redirect->redirector.dest != 0
redirect->redirector.dest != 0Description
TRUEnever evaluated
FALSEevaluated 1340 times by 1 test
Evaluated by:
  • Self test
)
0-1340
1098 cprintf ("%d", redirect->redirector.dest);
never executed: cprintf ("%d", redirect->redirector.dest);
0
1099-
1100-
1101 if (redirect->redirectee.filename->flags & 0x000002
redirect->redi...ags & 0x000002Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1285 times by 1 test
Evaluated by:
  • Self test
)
57-1285
1102 {-
1103 x = sh_single_quote (redirect->here_doc_eof);-
1104 cprintf ("<<%s%s", kill_leading ? "-" : "", x);-
1105 sh_xfree((x), "print_cmd.c", 1100);-
1106 }
executed 57 times by 1 test: end of block
Executed by:
  • Self test
57
1107 else-
1108 cprintf ("<<%s%s", kill_leading ? "-" : "", redirect->here_doc_eof);
executed 1285 times by 1 test: cprintf ("<<%s%s", kill_leading ? "-" : "", redirect->here_doc_eof);
Executed by:
  • Self test
1285
1109}-
1110-
1111static void-
1112print_heredoc_body (redirect)-
1113 REDIRECT *redirect;-
1114{-
1115-
1116 cprintf ("%s%s", redirect->redirectee.filename->word, redirect->here_doc_eof);-
1117}
executed 1342 times by 1 test: end of block
Executed by:
  • Self test
1342
1118-
1119static void-
1120print_redirection (redirect)-
1121 REDIRECT *redirect;-
1122{-
1123 int redirector, redir_fd;-
1124 WORD_DESC *redirectee, *redir_word;-
1125-
1126 redirectee = redirect->redirectee.filename;-
1127 redir_fd = redirect->redirectee.dest;-
1128-
1129 redir_word = redirect->redirector.filename;-
1130 redirector = redirect->redirector.dest;-
1131-
1132 switch (redirect->instruction)-
1133 {-
1134 case
executed 1457 times by 1 test: case r_input_direction:
Executed by:
  • Self test
r_input_direction:
executed 1457 times by 1 test: case r_input_direction:
Executed by:
  • Self test
1457
1135 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1452 times by 1 test
Evaluated by:
  • Self test
)
5-1452
1136 cprintf ("{%s}", redir_word->word);
executed 5 times by 1 test: cprintf ("{%s}", redir_word->word);
Executed by:
  • Self test
5
1137 else if (redirector != 0
redirector != 0Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1405 times by 1 test
Evaluated by:
  • Self test
)
47-1405
1138 cprintf ("%d", redirector);
executed 47 times by 1 test: cprintf ("%d", redirector);
Executed by:
  • Self test
47
1139 cprintf ("< %s", redirectee->word);-
1140 break;
executed 1457 times by 1 test: break;
Executed by:
  • Self test
1457
1141-
1142 case
executed 12607 times by 1 test: case r_output_direction:
Executed by:
  • Self test
r_output_direction:
executed 12607 times by 1 test: case r_output_direction:
Executed by:
  • Self test
12607
1143 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 12597 times by 1 test
Evaluated by:
  • Self test
)
10-12597
1144 cprintf ("{%s}", redir_word->word);
executed 10 times by 1 test: cprintf ("{%s}", redir_word->word);
Executed by:
  • Self test
10
1145 else if (redirector != 1
redirector != 1Description
TRUEevaluated 4036 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 8561 times by 1 test
Evaluated by:
  • Self test
)
4036-8561
1146 cprintf ("%d", redirector);
executed 4036 times by 1 test: cprintf ("%d", redirector);
Executed by:
  • Self test
4036
1147 cprintf ("> %s", redirectee->word);-
1148 break;
executed 12607 times by 1 test: break;
Executed by:
  • Self test
12607
1149-
1150 case
never executed: case r_inputa_direction:
r_inputa_direction:
never executed: case r_inputa_direction:
0
1151 cprintf ("&");-
1152 break;
never executed: break;
0
1153-
1154 case
executed 19 times by 1 test: case r_output_force:
Executed by:
  • Self test
r_output_force:
executed 19 times by 1 test: case r_output_force:
Executed by:
  • Self test
19
1155 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • Self test
)
0-19
1156 cprintf ("{%s}", redir_word->word);
never executed: cprintf ("{%s}", redir_word->word);
0
1157 else if (redirector != 1
redirector != 1Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • Self test
)
0-19
1158 cprintf ("%d", redirector);
never executed: cprintf ("%d", redirector);
0
1159 cprintf (">| %s", redirectee->word);-
1160 break;
executed 19 times by 1 test: break;
Executed by:
  • Self test
19
1161-
1162 case
executed 40 times by 1 test: case r_appending_to:
Executed by:
  • Self test
r_appending_to:
executed 40 times by 1 test: case r_appending_to:
Executed by:
  • Self test
40
1163 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • Self test
)
0-40
1164 cprintf ("{%s}", redir_word->word);
never executed: cprintf ("{%s}", redir_word->word);
0
1165 else if (redirector != 1
redirector != 1Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • Self test
)
0-40
1166 cprintf ("%d", redirector);
never executed: cprintf ("%d", redirector);
0
1167 cprintf (">> %s", redirectee->word);-
1168 break;
executed 40 times by 1 test: break;
Executed by:
  • Self test
40
1169-
1170 case
executed 18 times by 1 test: case r_input_output:
Executed by:
  • Self test
r_input_output:
executed 18 times by 1 test: case r_input_output:
Executed by:
  • Self test
18
1171 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test
)
0-18
1172 cprintf ("{%s}", redir_word->word);
never executed: cprintf ("{%s}", redir_word->word);
0
1173 else if (redirector != 1
redirector != 1Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-18
1174 cprintf ("%d", redirector);
executed 18 times by 1 test: cprintf ("%d", redirector);
Executed by:
  • Self test
18
1175 cprintf ("<> %s", redirectee->word);-
1176 break;
executed 18 times by 1 test: break;
Executed by:
  • Self test
18
1177-
1178 case
never executed: case r_deblank_reading_until:
r_deblank_reading_until:
never executed: case r_deblank_reading_until:
0
1179 case
never executed: case r_reading_until:
r_reading_until:
never executed: case r_reading_until:
0
1180 print_heredoc_header (redirect);-
1181 cprintf ("\n");-
1182 print_heredoc_body (redirect);-
1183 break;
never executed: break;
0
1184-
1185 case
executed 56 times by 1 test: case r_reading_string:
Executed by:
  • Self test
r_reading_string:
executed 56 times by 1 test: case r_reading_string:
Executed by:
  • Self test
56
1186 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
)
0-56
1187 cprintf ("{%s}", redir_word->word);
never executed: cprintf ("{%s}", redir_word->word);
0
1188 else if (redirector != 0
redirector != 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
)
0-56
1189 cprintf ("%d", redirector);
never executed: cprintf ("%d", redirector);
0
1190 cprintf ("<<< %s", redirect->redirectee.filename->word);-
1191 break;
executed 56 times by 1 test: break;
Executed by:
  • Self test
56
1192-
1193 case
executed 35 times by 1 test: case r_duplicating_input:
Executed by:
  • Self test
r_duplicating_input:
executed 35 times by 1 test: case r_duplicating_input:
Executed by:
  • Self test
35
1194 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 31 times by 1 test
Evaluated by:
  • Self test
)
4-31
1195 cprintf ("{%s}<&%d", redir_word->word, redir_fd);
executed 4 times by 1 test: cprintf ("{%s}<&%d", redir_word->word, redir_fd);
Executed by:
  • Self test
4
1196 else-
1197 cprintf ("%d<&%d", redirector, redir_fd);
executed 31 times by 1 test: cprintf ("%d<&%d", redirector, redir_fd);
Executed by:
  • Self test
31
1198 break;
executed 35 times by 1 test: break;
Executed by:
  • Self test
35
1199-
1200 case
executed 811 times by 1 test: case r_duplicating_output:
Executed by:
  • Self test
r_duplicating_output:
executed 811 times by 1 test: case r_duplicating_output:
Executed by:
  • Self test
811
1201 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 806 times by 1 test
Evaluated by:
  • Self test
)
5-806
1202 cprintf ("{%s}>&%d", redir_word->word, redir_fd);
executed 5 times by 1 test: cprintf ("{%s}>&%d", redir_word->word, redir_fd);
Executed by:
  • Self test
5
1203 else-
1204 cprintf ("%d>&%d", redirector, redir_fd);
executed 806 times by 1 test: cprintf ("%d>&%d", redirector, redir_fd);
Executed by:
  • Self test
806
1205 break;
executed 811 times by 1 test: break;
Executed by:
  • Self test
811
1206-
1207 case
executed 22 times by 1 test: case r_duplicating_input_word:
Executed by:
  • Self test
r_duplicating_input_word:
executed 22 times by 1 test: case r_duplicating_input_word:
Executed by:
  • Self test
22
1208 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 20 times by 1 test
Evaluated by:
  • Self test
)
2-20
1209 cprintf ("{%s}<&%s", redir_word->word, redirectee->word);
executed 2 times by 1 test: cprintf ("{%s}<&%s", redir_word->word, redirectee->word);
Executed by:
  • Self test
2
1210 else-
1211 cprintf ("%d<&%s", redirector, redirectee->word);
executed 20 times by 1 test: cprintf ("%d<&%s", redirector, redirectee->word);
Executed by:
  • Self test
20
1212 break;
executed 22 times by 1 test: break;
Executed by:
  • Self test
22
1213-
1214 case
executed 113 times by 1 test: case r_duplicating_output_word:
Executed by:
  • Self test
r_duplicating_output_word:
executed 113 times by 1 test: case r_duplicating_output_word:
Executed by:
  • Self test
113
1215 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 111 times by 1 test
Evaluated by:
  • Self test
)
2-111
1216 cprintf ("{%s}>&%s", redir_word->word, redirectee->word);
executed 2 times by 1 test: cprintf ("{%s}>&%s", redir_word->word, redirectee->word);
Executed by:
  • Self test
2
1217 else-
1218 cprintf ("%d>&%s", redirector, redirectee->word);
executed 111 times by 1 test: cprintf ("%d>&%s", redirector, redirectee->word);
Executed by:
  • Self test
111
1219 break;
executed 113 times by 1 test: break;
Executed by:
  • Self test
113
1220-
1221 case
executed 3 times by 1 test: case r_move_input:
Executed by:
  • Self test
r_move_input:
executed 3 times by 1 test: case r_move_input:
Executed by:
  • Self test
3
1222 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test
)
0-3
1223 cprintf ("{%s}<&%d-", redir_word->word, redir_fd);
never executed: cprintf ("{%s}<&%d-", redir_word->word, redir_fd);
0
1224 else-
1225 cprintf ("%d<&%d-", redirector, redir_fd);
executed 3 times by 1 test: cprintf ("%d<&%d-", redirector, redir_fd);
Executed by:
  • Self test
3
1226 break;
executed 3 times by 1 test: break;
Executed by:
  • Self test
3
1227-
1228 case
never executed: case r_move_output:
r_move_output:
never executed: case r_move_output:
0
1229 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1230 cprintf ("{%s}>&%d-", redir_word->word, redir_fd);
never executed: cprintf ("{%s}>&%d-", redir_word->word, redir_fd);
0
1231 else-
1232 cprintf ("%d>&%d-", redirector, redir_fd);
never executed: cprintf ("%d>&%d-", redirector, redir_fd);
0
1233 break;
never executed: break;
0
1234-
1235 case
executed 5 times by 1 test: case r_move_input_word:
Executed by:
  • Self test
r_move_input_word:
executed 5 times by 1 test: case r_move_input_word:
Executed by:
  • Self test
5
1236 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
1-4
1237 cprintf ("{%s}<&%s-", redir_word->word, redirectee->word);
executed 4 times by 1 test: cprintf ("{%s}<&%s-", redir_word->word, redirectee->word);
Executed by:
  • Self test
4
1238 else-
1239 cprintf ("%d<&%s-", redirector, redirectee->word);
executed 1 time by 1 test: cprintf ("%d<&%s-", redirector, redirectee->word);
Executed by:
  • Self test
1
1240 break;
executed 5 times by 1 test: break;
Executed by:
  • Self test
5
1241-
1242 case
executed 5 times by 1 test: case r_move_output_word:
Executed by:
  • Self test
r_move_output_word:
executed 5 times by 1 test: case r_move_output_word:
Executed by:
  • Self test
5
1243 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test
)
1-4
1244 cprintf ("{%s}>&%s-", redir_word->word, redirectee->word);
executed 4 times by 1 test: cprintf ("{%s}>&%s-", redir_word->word, redirectee->word);
Executed by:
  • Self test
4
1245 else-
1246 cprintf ("%d>&%s-", redirector, redirectee->word);
executed 1 time by 1 test: cprintf ("%d>&%s-", redirector, redirectee->word);
Executed by:
  • Self test
1
1247 break;
executed 5 times by 1 test: break;
Executed by:
  • Self test
5
1248-
1249 case
executed 1054 times by 1 test: case r_close_this:
Executed by:
  • Self test
r_close_this:
executed 1054 times by 1 test: case r_close_this:
Executed by:
  • Self test
1054
1250 if (redirect->rflags & 0x01
redirect->rflags & 0x01Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1047 times by 1 test
Evaluated by:
  • Self test
)
7-1047
1251 cprintf ("{%s}>&-", redir_word->word);
executed 7 times by 1 test: cprintf ("{%s}>&-", redir_word->word);
Executed by:
  • Self test
7
1252 else-
1253 cprintf ("%d>&-", redirector);
executed 1047 times by 1 test: cprintf ("%d>&-", redirector);
Executed by:
  • Self test
1047
1254 break;
executed 1054 times by 1 test: break;
Executed by:
  • Self test
1054
1255-
1256 case
executed 15 times by 1 test: case r_err_and_out:
Executed by:
  • Self test
r_err_and_out:
executed 15 times by 1 test: case r_err_and_out:
Executed by:
  • Self test
15
1257 cprintf ("&> %s", redirectee->word);-
1258 break;
executed 15 times by 1 test: break;
Executed by:
  • Self test
15
1259-
1260 case
executed 4 times by 1 test: case r_append_err_and_out:
Executed by:
  • Self test
r_append_err_and_out:
executed 4 times by 1 test: case r_append_err_and_out:
Executed by:
  • Self test
4
1261 cprintf ("&>> %s", redirectee->word);-
1262 break;
executed 4 times by 1 test: break;
Executed by:
  • Self test
4
1263 }-
1264}
executed 16264 times by 1 test: end of block
Executed by:
  • Self test
16264
1265-
1266static void-
1267reset_locals ()-
1268{-
1269 inside_function_def = 0;-
1270 indentation = 0;-
1271 printing_connection = 0;-
1272 deferred_heredocs = 0;-
1273}
never executed: end of block
0
1274-
1275static void-
1276print_function_def (func)-
1277 FUNCTION_DEF *func;-
1278{-
1279 COMMAND *cmdcopy;-
1280 REDIRECT *func_redirects;-
1281-
1282 func_redirects = -
1283 ((void *)0)-
1284 ;-
1285-
1286 if (posixly_correct == 0
posixly_correct == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-11
1287 cprintf ("function %s () \n", func->name->word);
executed 11 times by 1 test: cprintf ("function %s () \n", func->name->word);
Executed by:
  • Self test
11
1288 else-
1289 cprintf ("%s () \n", func->name->word);
never executed: cprintf ("%s () \n", func->name->word);
0
1290 add_unwind_protect (reset_locals, 0);-
1291-
1292 indent (indentation);-
1293 cprintf ("{ \n");-
1294-
1295 inside_function_def++;-
1296 indentation += indentation_amount;-
1297-
1298 cmdcopy = copy_command (func->command);-
1299 if (cmdcopy->type == cm_group
cmdcopy->type == cm_groupDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-11
1300 {-
1301 func_redirects = cmdcopy->redirects;-
1302 cmdcopy->redirects = (REDIRECT *)-
1303 ((void *)0)-
1304 ;-
1305 }
executed 11 times by 1 test: end of block
Executed by:
  • Self test
11
1306 make_command_string_internal (cmdcopy->type == cm_group-
1307 ? cmdcopy->value.Group->command-
1308 : cmdcopy);-
1309-
1310-
1311 remove_unwind_protect ();-
1312 indentation -= indentation_amount;-
1313 inside_function_def--;-
1314-
1315 if (func_redirects
func_redirectsDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-11
1316 {-
1317 newline ("} ");-
1318 print_redirection_list (func_redirects);-
1319 cmdcopy->redirects = func_redirects;-
1320 }
executed 11 times by 1 test: end of block
Executed by:
  • Self test
11
1321 else-
1322 newline ("}");
never executed: newline ("}");
0
1323-
1324 dispose_command (cmdcopy);-
1325}
executed 11 times by 1 test: end of block
Executed by:
  • Self test
11
1326-
1327-
1328-
1329-
1330-
1331-
1332-
1333char *-
1334named_function_string (name, command, flags)-
1335 char *name;-
1336 COMMAND *command;-
1337 int flags;-
1338{-
1339 char *result;-
1340 int old_indent, old_amount;-
1341 COMMAND *cmdcopy;-
1342 REDIRECT *func_redirects;-
1343-
1344 old_indent = indentation;-
1345 old_amount = indentation_amount;-
1346 command_string_index = was_heredoc = 0;-
1347 deferred_heredocs = 0;-
1348-
1349 if (name
nameDescription
TRUEevaluated 304 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 69 times by 1 test
Evaluated by:
  • Self test
&& *
*nameDescription
TRUEevaluated 304 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
name
*nameDescription
TRUEevaluated 304 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-304
1350 {-
1351 if (find_reserved_word (name) >= 0
find_reserved_word (name) >= 0Description
TRUEnever evaluated
FALSEevaluated 304 times by 1 test
Evaluated by:
  • Self test
)
0-304
1352 cprintf ("function ");
never executed: cprintf ("function ");
0
1353 cprintf ("%s ", name);-
1354 }
executed 304 times by 1 test: end of block
Executed by:
  • Self test
304
1355-
1356 cprintf ("() ");-
1357-
1358 if ((
(flags & 0x01) == 0Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 312 times by 1 test
Evaluated by:
  • Self test
flags & 0x01) == 0
(flags & 0x01) == 0Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 312 times by 1 test
Evaluated by:
  • Self test
)
61-312
1359 {-
1360 indentation = 1;-
1361 indentation_amount = 0;-
1362 }
executed 61 times by 1 test: end of block
Executed by:
  • Self test
61
1363 else-
1364 {-
1365 cprintf ("\n");-
1366 indentation += indentation_amount;-
1367 }
executed 312 times by 1 test: end of block
Executed by:
  • Self test
312
1368-
1369 inside_function_def++;-
1370-
1371 cprintf ((flags & 0x01) ? "{ \n" : "{ ");-
1372-
1373 cmdcopy = copy_command (command);-
1374-
1375-
1376 func_redirects = (REDIRECT *)-
1377 ((void *)0)-
1378 ;-
1379 if (cmdcopy->type == cm_group
cmdcopy->type == cm_groupDescription
TRUEevaluated 361 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test
)
12-361
1380 {-
1381 func_redirects = cmdcopy->redirects;-
1382 cmdcopy->redirects = (REDIRECT *)-
1383 ((void *)0)-
1384 ;-
1385 }
executed 361 times by 1 test: end of block
Executed by:
  • Self test
361
1386 make_command_string_internal (cmdcopy->type == cm_group-
1387 ? cmdcopy->value.Group->command-
1388 : cmdcopy);-
1389-
1390-
1391 indentation = old_indent;-
1392 indentation_amount = old_amount;-
1393 inside_function_def--;-
1394-
1395 if (func_redirects
func_redirectsDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 360 times by 1 test
Evaluated by:
  • Self test
)
13-360
1396 {-
1397 newline ("} ");-
1398 print_redirection_list (func_redirects);-
1399 cmdcopy->redirects = func_redirects;-
1400 }
executed 13 times by 1 test: end of block
Executed by:
  • Self test
13
1401 else-
1402 newline ("}");
executed 360 times by 1 test: newline ("}");
Executed by:
  • Self test
360
1403-
1404 result = the_printed_command;-
1405-
1406 if ((
(flags & 0x01) == 0Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 312 times by 1 test
Evaluated by:
  • Self test
flags & 0x01) == 0
(flags & 0x01) == 0Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 312 times by 1 test
Evaluated by:
  • Self test
)
61-312
1407 {-
1408 if (result[2] == '\n'
result[2] == '\n'Description
TRUEnever evaluated
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
)
0-61
1409 memmove (result + 2, result + 3, strlen (result) - 2);
never executed: memmove (result + 2, result + 3, strlen (result) - 2);
0
1410-
1411 }
executed 61 times by 1 test: end of block
Executed by:
  • Self test
61
1412-
1413 dispose_command (cmdcopy);-
1414-
1415 if (flags & 0x02
flags & 0x02Description
TRUEevaluated 312 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
)
61-312
1416 result = remove_quoted_escapes (result);
executed 312 times by 1 test: result = remove_quoted_escapes (result);
Executed by:
  • Self test
312
1417-
1418 return
executed 373 times by 1 test: return (result);
Executed by:
  • Self test
(result);
executed 373 times by 1 test: return (result);
Executed by:
  • Self test
373
1419}-
1420-
1421static void-
1422newline (string)-
1423 char *string;-
1424{-
1425 cprintf ("\n");-
1426 indent (indentation);-
1427 if (string
stringDescription
TRUEevaluated 3359 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& *
*stringDescription
TRUEevaluated 3345 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
string
*stringDescription
TRUEevaluated 3345 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
)
0-3359
1428 cprintf ("%s", string);
executed 3345 times by 1 test: cprintf ("%s", string);
Executed by:
  • Self test
3345
1429}
executed 3359 times by 1 test: end of block
Executed by:
  • Self test
3359
1430-
1431static char *indentation_string;-
1432static int indentation_size;-
1433-
1434static void-
1435indent (amount)-
1436 int amount;-
1437{-
1438 register int i;-
1439-
1440 do { if ((
(0) + (amount)...dentation_sizeDescription
TRUEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10825 times by 1 test
Evaluated by:
  • Self test
0) + (amount) >= indentation_size
(0) + (amount)...dentation_sizeDescription
TRUEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10825 times by 1 test
Evaluated by:
  • Self test
) { while ((
(0) + (amount)...dentation_sizeDescription
TRUEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
0) + (amount) >= indentation_size
(0) + (amount)...dentation_sizeDescription
TRUEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3520 times by 1 test
Evaluated by:
  • Self test
) indentation_size += (16);
executed 3520 times by 1 test: indentation_size += (16);
Executed by:
  • Self test
indentation_string = sh_xrealloc((indentation_string), (indentation_size), "print_cmd.c", 1449); }
executed 3520 times by 1 test: end of block
Executed by:
  • Self test
} while (0);
3520-10825
1441-
1442 for (i = 0; amount > 0
amount > 0Description
TRUEevaluated 47659 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14345 times by 1 test
Evaluated by:
  • Self test
; amount--)
14345-47659
1443 indentation_string[i++] = ' ';
executed 47659 times by 1 test: indentation_string[i++] = ' ';
Executed by:
  • Self test
47659
1444 indentation_string[i] = '\0';-
1445 cprintf ("%s", indentation_string);-
1446}
executed 14345 times by 1 test: end of block
Executed by:
  • Self test
14345
1447-
1448static void-
1449semicolon ()-
1450{-
1451 if (command_string_index > 0
command_string_index > 0Description
TRUEevaluated 3174 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&&
0-3174
1452 (the_printed_command[command_string_index - 1] == '&'
the_printed_co...ex - 1] == '&'Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3172 times by 1 test
Evaluated by:
  • Self test
||
2-3172
1453 the_printed_command[command_string_index - 1] == '\n'
the_printed_co...x - 1] == '\n'Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3171 times by 1 test
Evaluated by:
  • Self test
))
1-3171
1454 return;
executed 3 times by 1 test: return;
Executed by:
  • Self test
3
1455 cprintf (";");-
1456}
executed 3171 times by 1 test: end of block
Executed by:
  • Self test
3171
1457-
1458-
1459static void-
1460-
1461cprintf (const char *control, ...)-
1462-
1463-
1464-
1465-
1466-
1467{-
1468 register const char *s;-
1469 char char_arg[2], *argp, intbuf[((sizeof (int) * 8 - (! ((int) 0 < (int) -1))) * 302 / 1000 + 1 + (! ((int) 0 < (int) -1))) + 1];-
1470 int digit_arg, arg_len, c;-
1471 va_list args;-
1472-
1473 -
1474 __builtin_va_start(-
1475 args-
1476 ,-
1477 control-
1478 )-
1479 ;-
1480-
1481 arg_len = strlen (control);-
1482 the_printed_command_resize (arg_len + 1);-
1483-
1484 char_arg[1] = '\0';-
1485 s = control;-
1486 while (s
sDescription
TRUEevaluated 840651695 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& *
*sDescription
TRUEevaluated 671679769 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 168971926 times by 1 test
Evaluated by:
  • Self test
s
*sDescription
TRUEevaluated 671679769 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 168971926 times by 1 test
Evaluated by:
  • Self test
)
0-840651695
1487 {-
1488 c = *s++;-
1489 argp = (char *)-
1490 ((void *)0)-
1491 ;-
1492 if (c != '%'
c != '%'Description
TRUEevaluated 402537068 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 269142701 times by 1 test
Evaluated by:
  • Self test
|| !*s
!*sDescription
TRUEnever evaluated
FALSEevaluated 269142701 times by 1 test
Evaluated by:
  • Self test
)
0-402537068
1493 {-
1494 char_arg[0] = c;-
1495 argp = char_arg;-
1496 arg_len = 1;-
1497 }
executed 402537068 times by 1 test: end of block
Executed by:
  • Self test
402537068
1498 else-
1499 {-
1500 c = *s++;-
1501 switch (c)-
1502 {-
1503 case
never executed: case '%':
'%':
never executed: case '%':
0
1504 char_arg[0] = c;-
1505 argp = char_arg;-
1506 arg_len = 1;-
1507 break;
never executed: break;
0
1508-
1509 case
executed 269135731 times by 1 test: case 's':
Executed by:
  • Self test
's':
executed 269135731 times by 1 test: case 's':
Executed by:
  • Self test
269135731
1510 argp = -
1511 __builtin_va_arg(-
1512 args-
1513 ,-
1514 char *-
1515 )-
1516 ;-
1517 arg_len = strlen (argp);-
1518 break;
executed 269135731 times by 1 test: break;
Executed by:
  • Self test
269135731
1519-
1520 case
executed 6970 times by 1 test: case 'd':
Executed by:
  • Self test
'd':
executed 6970 times by 1 test: case 'd':
Executed by:
  • Self test
6970
1521-
1522-
1523-
1524-
1525 digit_arg = -
1526 __builtin_va_arg(-
1527 args-
1528 ,-
1529 int-
1530 )-
1531 ;-
1532 if (digit_arg < 0
digit_arg < 0Description
TRUEnever evaluated
FALSEevaluated 6970 times by 1 test
Evaluated by:
  • Self test
)
0-6970
1533 {-
1534 sprintf (intbuf, "%u", (unsigned)-1);-
1535 argp = intbuf;-
1536 }
never executed: end of block
0
1537 else-
1538 argp = inttostr (digit_arg, intbuf, sizeof (intbuf));
executed 6970 times by 1 test: argp = inttostr (digit_arg, intbuf, sizeof (intbuf));
Executed by:
  • Self test
6970
1539 arg_len = strlen (argp);-
1540 break;
executed 6970 times by 1 test: break;
Executed by:
  • Self test
6970
1541-
1542 case
never executed: case 'c':
'c':
never executed: case 'c':
0
1543 char_arg[0] = -
1544 __builtin_va_arg(-
1545 args-
1546 ,-
1547 int-
1548 )-
1549 ;-
1550 argp = char_arg;-
1551 arg_len = 1;-
1552 break;
never executed: break;
0
1553-
1554 default
never executed: default:
:
never executed: default:
0
1555 programming_error (-
1556 dcgettext (((void *)0), -
1557 "cprintf: `%c': invalid format character"-
1558 , 5)-
1559 , c);-
1560-
1561 }
never executed: end of block
0
1562 }-
1563-
1564 if (argp
argpDescription
TRUEevaluated 671679769 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& arg_len
arg_lenDescription
TRUEevaluated 594931490 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 76748279 times by 1 test
Evaluated by:
  • Self test
)
0-671679769
1565 {-
1566 the_printed_command_resize (arg_len + 1);-
1567 __builtin_memcpy ((the_printed_command + command_string_index), (argp), (arg_len));-
1568 command_string_index += arg_len;-
1569 }
executed 594931490 times by 1 test: end of block
Executed by:
  • Self test
594931490
1570 }
executed 671679769 times by 1 test: end of block
Executed by:
  • Self test
671679769
1571-
1572 -
1573 __builtin_va_end(-
1574 args-
1575 )-
1576 ;-
1577-
1578 the_printed_command[command_string_index] = '\0';-
1579}
executed 168971926 times by 1 test: end of block
Executed by:
  • Self test
168971926
1580-
1581-
1582-
1583static void-
1584the_printed_command_resize (length)-
1585 int length;-
1586{-
1587 if (the_printed_command == 0
the_printed_command == 0Description
TRUEevaluated 5419 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 763897997 times by 1 test
Evaluated by:
  • Self test
)
5419-763897997
1588 {-
1589 the_printed_command_size = (length + 64 - 1) & ~(64 - 1);-
1590 the_printed_command = (char *)sh_xmalloc((the_printed_command_size), "print_cmd.c", 1565);-
1591 command_string_index = 0;-
1592 }
executed 5419 times by 1 test: end of block
Executed by:
  • Self test
5419
1593 else if ((
(command_strin...d_command_sizeDescription
TRUEevaluated 4307 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 763893690 times by 1 test
Evaluated by:
  • Self test
command_string_index + length) >= the_printed_command_size
(command_strin...d_command_sizeDescription
TRUEevaluated 4307 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 763893690 times by 1 test
Evaluated by:
  • Self test
)
4307-763893690
1594 {-
1595 int new;-
1596 new = command_string_index + length + 1;-
1597-
1598-
1599 new = (new + 128 - 1) & ~(128 - 1);-
1600 the_printed_command_size = new;-
1601-
1602 the_printed_command = (char *)sh_xrealloc((the_printed_command), (the_printed_command_size), "print_cmd.c", 1577);-
1603 }
executed 4307 times by 1 test: end of block
Executed by:
  • Self test
4307
1604}
executed 763903416 times by 1 test: end of block
Executed by:
  • Self test
763903416
1605-
1606-
1607-
1608-
1609-
1610static void-
1611-
1612xprintf (const char *format, ...)-
1613-
1614-
1615-
1616-
1617-
1618{-
1619 va_list args;-
1620-
1621 -
1622 __builtin_va_start(-
1623 args-
1624 ,-
1625 format-
1626 )-
1627 ;-
1628-
1629 vfprintf (-
1630 stdout-
1631 , format, args);-
1632 -
1633 __builtin_va_end(-
1634 args-
1635 )-
1636 ;-
1637}
never executed: end of block
0
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2