OpenCoverage

sum.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/sum.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3static -
4 _Bool -
5 have_read_stdin;-
6-
7static struct option const longopts[] =-
8{-
9 {"sysv", -
10 0-
11 , -
12 ((void *)0)-
13 , 's'},-
14 {"help", -
15 0-
16 , -
17 ((void *)0)-
18 , GETOPT_HELP_CHAR},-
19 {"version", -
20 0-
21 , -
22 ((void *)0)-
23 , GETOPT_VERSION_CHAR},-
24 {-
25 ((void *)0)-
26 , 0, -
27 ((void *)0)-
28 , 0}-
29};-
30-
31void-
32usage (int status)-
33{-
34 if (status !=
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 6 times by 1 test
Evaluated by:
  • sum
3-6
35 0
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 6 times by 1 test
Evaluated by:
  • sum
3-6
36 )-
37 do { fprintf (-
38 stderr-
39 , -
40 dcgettext (((void *)0), -
41 "Try '%s --help' for more information.\n"-
42 , 5)-
43 , program_name); }
executed 3 times by 1 test: end of block
Executed by:
  • sum
while (0);
3
44 else-
45 {-
46 printf (-
47 dcgettext (((void *)0), -
48 "Usage: %s [OPTION]... [FILE]...\n"-
49 , 5)-
50-
51 -
52 ,-
53 program_name);-
54 fputs_unlocked (-
55 dcgettext (((void *)0), -
56 "Print checksum and block counts for each FILE.\n"-
57 , 5)-
58 ,-
59 stdout-
60 )-
61-
62 ;-
63-
64 emit_stdin_note ();-
65-
66 fputs_unlocked (-
67 dcgettext (((void *)0), -
68 "\n -r use BSD sum algorithm, use 1K blocks\n -s, --sysv use System V sum algorithm, use 512 bytes blocks\n"-
69 , 5)-
70 ,-
71 stdout-
72 )-
73-
74-
75-
76 ;-
77 fputs_unlocked (-
78 dcgettext (((void *)0), -
79 " --help display this help and exit\n"-
80 , 5)-
81 ,-
82 stdout-
83 );-
84 fputs_unlocked (-
85 dcgettext (((void *)0), -
86 " --version output version information and exit\n"-
87 , 5)-
88 ,-
89 stdout-
90 );-
91 emit_ancillary_info ("sum");-
92 }
executed 6 times by 1 test: end of block
Executed by:
  • sum
6
93 exit (status);
executed 9 times by 1 test: exit (status);
Executed by:
  • sum
9
94}-
95-
96-
97-
98-
99-
100-
101-
102static -
103 _Bool-
104-
105bsd_sum_file (const char *file, int print_name)-
106{-
107 FILE *fp;-
108 int checksum = 0;-
109 uintmax_t total_bytes = 0;-
110 int ch;-
111 char hbuf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * (-
112 16 -
113 + 1) - -
114 16 -
115 + 1 + 3) + 1];-
116 -
117 _Bool -
118 is_stdin = (-
119 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (-
120 file-
121 ) && __builtin_constant_p (-
122 "-"-
123 ) && (__s1_len = __builtin_strlen (-
124 file-
125 ), __s2_len = __builtin_strlen (-
126 "-"-
127 ), (!((size_t)(const void *)((-
128 file-
129 ) + 1) - (size_t)(const void *)(-
130 file-
131 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((-
132 "-"-
133 ) + 1) - (size_t)(const void *)(-
134 "-"-
135 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (-
136 file-
137 , -
138 "-"-
139 ) : (__builtin_constant_p (-
140 file-
141 ) && ((size_t)(const void *)((-
142 file-
143 ) + 1) - (size_t)(const void *)(-
144 file-
145 ) == 1) && (__s1_len = __builtin_strlen (-
146 file-
147 ), __s1_len < 4) ? (__builtin_constant_p (-
148 "-"-
149 ) && ((size_t)(const void *)((-
150 "-"-
151 ) + 1) - (size_t)(const void *)(-
152 "-"-
153 ) == 1) ? __builtin_strcmp (-
154 file-
155 , -
156 "-"-
157 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (-
158 "-"-
159 ); int __result = (((const unsigned char *) (const char *) (-
160 file-
161 ))[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 *) (
0
162 file-
163 ))[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 *) (
0
164 file-
165 ))[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 *) ( file ))[3] - __s2[3]);
0
166 file
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]);
0
167 ))[3] - __s2[3]);
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]);
}
never executed: end of block
}
never executed: end of block
__result; }))) : (__builtin_constant_p (
0
168 "-"-
169 ) && ((size_t)(const void *)((-
170 "-"-
171 ) + 1) - (size_t)(const void *)(-
172 "-"-
173 ) == 1) && (__s2_len = __builtin_strlen (-
174 "-"-
175 ), __s2_len < 4) ? (__builtin_constant_p (-
176 file-
177 ) && ((size_t)(const void *)((-
178 file-
179 ) + 1) - (size_t)(const void *)(-
180 file-
181 ) == 1) ? __builtin_strcmp (-
182 file-
183 , -
184 "-"-
185 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (-
186 file-
187 ); int __result = (((const unsigned char *) (const char *) (-
188 "-"-
189 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • sum
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
) { __result = (((const unsigned char *) (const char *) (
0-11
190 "-"-
191 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • sum
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
0-2
192 "-"-
193 ))[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 *) ( "-" ))[3] - __s2[3]);
0
194 "-"
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
0
195 ))[3] - __s2[3]);
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
}
never executed: end of block
}
executed 2 times by 1 test: end of block
Executed by:
  • sum
__result; }))) : __builtin_strcmp (
0-2
196 file-
197 , -
198 "-"-
199 )))); }) -
200 == 0);-
201-
202 if (is_stdin
is_stdinDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
)
2-9
203 {-
204 fp = -
205 stdin-
206 ;-
207 have_read_stdin = -
208 1-
209 ;-
210 xset_binary_mode (-
211 0-
212 , -
213 0-
214 );-
215 }
executed 2 times by 1 test: end of block
Executed by:
  • sum
2
216 else-
217 {-
218 fp = fopen (file, (-
219 0 -
220 ? "rb" : "r"));-
221 if (fp ==
fp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
0-9
222 ((void *)0)
fp == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
0-9
223 )-
224 {-
225 error (0, -
226 (*__errno_location ())-
227 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
228 return
never executed: return 0 ;
never executed: return 0 ;
0
229 0
never executed: return 0 ;
0
230 ;
never executed: return 0 ;
0
231 }-
232 }
executed 9 times by 1 test: end of block
Executed by:
  • sum
9
233-
234 fadvise (fp, FADVISE_SEQUENTIAL);-
235-
236 while ((
(ch = getc_unl... (fp)) != (-1)Description
TRUEevaluated 3275 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 11 times by 1 test
Evaluated by:
  • sum
ch = getc_unlocked (fp)) !=
(ch = getc_unl... (fp)) != (-1)Description
TRUEevaluated 3275 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 11 times by 1 test
Evaluated by:
  • sum
11-3275
237 (-1)
(ch = getc_unl... (fp)) != (-1)Description
TRUEevaluated 3275 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 11 times by 1 test
Evaluated by:
  • sum
11-3275
238 )-
239 {-
240 total_bytes++;-
241 checksum = (checksum >> 1) + ((checksum & 1) << 15);-
242 checksum += ch;-
243 checksum &= 0xffff;-
244 }
executed 3275 times by 1 test: end of block
Executed by:
  • sum
3275
245-
246 if (ferror_unlocked (fp)
ferror_unlocked (fp)Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • sum
)
0-11
247 {-
248 error (0, -
249 (*__errno_location ())-
250 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
251 if (!is_stdin
!is_stdinDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
252 -
253 rpl_fclose
never executed: rpl_fclose (fp);
0
254 (fp);
never executed: rpl_fclose (fp);
0
255 return
never executed: return 0 ;
never executed: return 0 ;
0
256 0
never executed: return 0 ;
0
257 ;
never executed: return 0 ;
0
258 }-
259-
260 if (!is_stdin
!is_stdinDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 2 times by 1 test
Evaluated by:
  • sum
&&
2-9
261 rpl_fclose
rpl_fclose (fp) != 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
0-9
262 (fp) != 0
rpl_fclose (fp) != 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
)
0-9
263 {-
264 error (0, -
265 (*__errno_location ())-
266 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
267 return
never executed: return 0 ;
never executed: return 0 ;
0
268 0
never executed: return 0 ;
0
269 ;
never executed: return 0 ;
0
270 }-
271-
272 printf ("%05d %5s", checksum,-
273 human_readable (total_bytes, hbuf, human_ceiling, 1, 1024));-
274 if (print_name > 1
print_name > 1Description
TRUEnever evaluated
FALSEevaluated 11 times by 1 test
Evaluated by:
  • sum
)
0-11
275 printf (" %s", file);
never executed: printf (" %s", file);
0
276 putchar_unlocked ('\n');-
277-
278 return
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
279 1
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
280 ;
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
281}-
282-
283-
284-
285-
286-
287-
288static -
289 _Bool-
290-
291sysv_sum_file (const char *file, int print_name)-
292{-
293 int fd;-
294 unsigned char buf[8192];-
295 uintmax_t total_bytes = 0;-
296 char hbuf[((2 * sizeof (uintmax_t) * 8 * 146 / 485 + 1) * (-
297 16 -
298 + 1) - -
299 16 -
300 + 1 + 3) + 1];-
301 int r;-
302 int checksum;-
303-
304-
305 unsigned int s = 0;-
306-
307 -
308 _Bool -
309 is_stdin = (-
310 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (-
311 file-
312 ) && __builtin_constant_p (-
313 "-"-
314 ) && (__s1_len = __builtin_strlen (-
315 file-
316 ), __s2_len = __builtin_strlen (-
317 "-"-
318 ), (!((size_t)(const void *)((-
319 file-
320 ) + 1) - (size_t)(const void *)(-
321 file-
322 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((-
323 "-"-
324 ) + 1) - (size_t)(const void *)(-
325 "-"-
326 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (-
327 file-
328 , -
329 "-"-
330 ) : (__builtin_constant_p (-
331 file-
332 ) && ((size_t)(const void *)((-
333 file-
334 ) + 1) - (size_t)(const void *)(-
335 file-
336 ) == 1) && (__s1_len = __builtin_strlen (-
337 file-
338 ), __s1_len < 4) ? (__builtin_constant_p (-
339 "-"-
340 ) && ((size_t)(const void *)((-
341 "-"-
342 ) + 1) - (size_t)(const void *)(-
343 "-"-
344 ) == 1) ? __builtin_strcmp (-
345 file-
346 , -
347 "-"-
348 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (-
349 "-"-
350 ); int __result = (((const unsigned char *) (const char *) (-
351 file-
352 ))[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 *) (
0
353 file-
354 ))[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 *) (
0
355 file-
356 ))[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 *) ( file ))[3] - __s2[3]);
0
357 file
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]);
0
358 ))[3] - __s2[3]);
never executed: __result = (((const unsigned char *) (const char *) ( file ))[3] - __s2[3]);
}
never executed: end of block
}
never executed: end of block
__result; }))) : (__builtin_constant_p (
0
359 "-"-
360 ) && ((size_t)(const void *)((-
361 "-"-
362 ) + 1) - (size_t)(const void *)(-
363 "-"-
364 ) == 1) && (__s2_len = __builtin_strlen (-
365 "-"-
366 ), __s2_len < 4) ? (__builtin_constant_p (-
367 file-
368 ) && ((size_t)(const void *)((-
369 file-
370 ) + 1) - (size_t)(const void *)(-
371 file-
372 ) == 1) ? __builtin_strcmp (-
373 file-
374 , -
375 "-"-
376 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (-
377 file-
378 ); int __result = (((const unsigned char *) (const char *) (-
379 "-"-
380 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • sum
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
) { __result = (((const unsigned char *) (const char *) (
0-11
381 "-"-
382 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • sum
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
0-2
383 "-"-
384 ))[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 *) ( "-" ))[3] - __s2[3]);
0
385 "-"
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
0
386 ))[3] - __s2[3]);
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
}
never executed: end of block
}
executed 2 times by 1 test: end of block
Executed by:
  • sum
__result; }))) : __builtin_strcmp (
0-2
387 file-
388 , -
389 "-"-
390 )))); }) -
391 == 0);-
392-
393 if (is_stdin
is_stdinDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
)
2-9
394 {-
395 fd = -
396 0-
397 ;-
398 have_read_stdin = -
399 1-
400 ;-
401 xset_binary_mode (-
402 0-
403 , -
404 0-
405 );-
406 }
executed 2 times by 1 test: end of block
Executed by:
  • sum
2
407 else-
408 {-
409 fd = open (file, -
410 00 -
411 | -
412 0-
413 );-
414 if (fd == -1
fd == -1Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
)
0-9
415 {-
416 error (0, -
417 (*__errno_location ())-
418 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
419 return
never executed: return 0 ;
never executed: return 0 ;
0
420 0
never executed: return 0 ;
0
421 ;
never executed: return 0 ;
0
422 }-
423 }
executed 9 times by 1 test: end of block
Executed by:
  • sum
9
424-
425 while (1)-
426 {-
427 size_t bytes_read = safe_read (fd, buf, sizeof buf);-
428-
429 if (bytes_read == 0
bytes_read == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 4122 times by 1 test
Evaluated by:
  • sum
)
11-4122
430 break;
executed 11 times by 1 test: break;
Executed by:
  • sum
11
431-
432 if (bytes_read == ((size_t) -1)
bytes_read == ((size_t) -1)Description
TRUEnever evaluated
FALSEevaluated 4122 times by 1 test
Evaluated by:
  • sum
)
0-4122
433 {-
434 error (0, -
435 (*__errno_location ())-
436 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
437 if (!is_stdin
!is_stdinDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
438 close (fd);
never executed: close (fd);
0
439 return
never executed: return 0 ;
never executed: return 0 ;
0
440 0
never executed: return 0 ;
0
441 ;
never executed: return 0 ;
0
442 }-
443-
444 for (size_t i = 0; i < bytes_read
i < bytes_readDescription
TRUEevaluated 33689277 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 4122 times by 1 test
Evaluated by:
  • sum
; i++)
4122-33689277
445 s += buf[i];
executed 33689277 times by 1 test: s += buf[i];
Executed by:
  • sum
33689277
446 total_bytes += bytes_read;-
447 }
executed 4122 times by 1 test: end of block
Executed by:
  • sum
4122
448-
449 if (!is_stdin
!is_stdinDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 2 times by 1 test
Evaluated by:
  • sum
&& close (fd) != 0
close (fd) != 0Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • sum
)
0-9
450 {-
451 error (0, -
452 (*__errno_location ())-
453 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, file));-
454 return
never executed: return 0 ;
never executed: return 0 ;
0
455 0
never executed: return 0 ;
0
456 ;
never executed: return 0 ;
0
457 }-
458-
459 r = (s & 0xffff) + ((s & 0xffffffff) >> 16);-
460 checksum = (r & 0xffff) + (r >> 16);-
461-
462 printf ("%d %s", checksum,-
463 human_readable (total_bytes, hbuf, human_ceiling, 1, 512));-
464 if (print_name
print_nameDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 2 times by 1 test
Evaluated by:
  • sum
)
2-9
465 printf (" %s", file);
executed 9 times by 1 test: printf (" %s", file);
Executed by:
  • sum
9
466 putchar_unlocked ('\n');-
467-
468 return
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
469 1
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
470 ;
executed 11 times by 1 test: return 1 ;
Executed by:
  • sum
11
471}-
472-
473int-
474main (int argc, char **argv)-
475{-
476 -
477 _Bool -
478 ok;-
479 int optc;-
480 int files_given;-
481 -
482 _Bool -
483 (*sum_func) (const char *, int) = bsd_sum_file;-
484-
485 ;-
486 set_program_name (argv[0]);-
487 setlocale (-
488 6-
489 , "");-
490 bindtextdomain ("coreutils", "/usr/local/share/locale");-
491 textdomain ("coreutils");-
492-
493 atexit (close_stdout);-
494-
495-
496-
497 setvbuf (-
498 stdout-
499 , -
500 ((void *)0)-
501 , -
502 1-
503 , 0);-
504-
505 have_read_stdin = -
506 0-
507 ;-
508-
509 while ((
(optc = getopt... *)0) )) != -1Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 22 times by 1 test
Evaluated by:
  • sum
optc = getopt_long (argc, argv, "rs", longopts,
(optc = getopt... *)0) )) != -1Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 22 times by 1 test
Evaluated by:
  • sum
22-30
510 ((void *)0)
(optc = getopt... *)0) )) != -1Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 22 times by 1 test
Evaluated by:
  • sum
22-30
511 )) != -1
(optc = getopt... *)0) )) != -1Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 22 times by 1 test
Evaluated by:
  • sum
)
22-30
512 {-
513 switch (optc)-
514 {-
515 case
executed 3 times by 1 test: case 'r':
Executed by:
  • sum
'r':
executed 3 times by 1 test: case 'r':
Executed by:
  • sum
3
516 sum_func = bsd_sum_file;-
517 break;
executed 3 times by 1 test: break;
Executed by:
  • sum
3
518-
519 case
executed 13 times by 1 test: case 's':
Executed by:
  • sum
's':
executed 13 times by 1 test: case 's':
Executed by:
  • sum
13
520 sum_func = sysv_sum_file;-
521 break;
executed 13 times by 1 test: break;
Executed by:
  • sum
13
522-
523 case
executed 6 times by 1 test: case GETOPT_HELP_CHAR:
Executed by:
  • sum
GETOPT_HELP_CHAR:
executed 6 times by 1 test: case GETOPT_HELP_CHAR:
Executed by:
  • sum
usage (
6
524 0-
525 ); break;
never executed: break;
;
0
526-
527 case
executed 5 times by 1 test: case GETOPT_VERSION_CHAR:
Executed by:
  • sum
GETOPT_VERSION_CHAR:
executed 5 times by 1 test: case GETOPT_VERSION_CHAR:
Executed by:
  • sum
version_etc (
5
528 stdout-
529 , "sum", "GNU coreutils", Version, ("Kayvan Aghaiepour"), ("David MacKenzie"), (char *) -
530 ((void *)0)-
531 ); exit (
executed 5 times by 1 test: exit ( 0 );
Executed by:
  • sum
5
532 0
executed 5 times by 1 test: exit ( 0 );
Executed by:
  • sum
5
533 );
executed 5 times by 1 test: exit ( 0 );
Executed by:
  • sum
break;
never executed: break;
;
0-5
534-
535 default
executed 3 times by 1 test: default:
Executed by:
  • sum
:
executed 3 times by 1 test: default:
Executed by:
  • sum
3
536 usage (-
537 1-
538 );-
539 }
never executed: end of block
0
540 }-
541-
542 files_given = argc - optind;-
543 if (files_given <= 0
files_given <= 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 18 times by 1 test
Evaluated by:
  • sum
)
4-18
544 ok = sum_func ("-", files_given);
executed 4 times by 1 test: ok = sum_func ("-", files_given);
Executed by:
  • sum
4
545 else-
546 for (ok = -
547 1-
548 ; optind < argc
optind < argcDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 18 times by 1 test
Evaluated by:
  • sum
; optind++)
18
549 ok &= sum_func (argv[optind], files_given);
executed 18 times by 1 test: ok &= sum_func (argv[optind], files_given);
Executed by:
  • sum
18
550-
551 if (have_read_stdin
have_read_stdinDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • sum
FALSEevaluated 18 times by 1 test
Evaluated by:
  • sum
&&
4-18
552 rpl_fclose
rpl_fclose ( stdin ) == (-1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • sum
0-4
553 (
rpl_fclose ( stdin ) == (-1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • sum
0-4
554 stdin
rpl_fclose ( stdin ) == (-1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • sum
0-4
555 ) ==
rpl_fclose ( stdin ) == (-1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • sum
0-4
556 (-1)
rpl_fclose ( stdin ) == (-1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • sum
0-4
557 )-
558 ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
!!sizeof (struct { _Static_assert (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
559 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
560 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
561 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
562 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
563 (*__errno_location ())
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
564 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
565 0
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
566 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
567 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
568 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
569 (*__errno_location ())
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
570 , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
571 0
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
572 ) ? (void) 0 : __builtin_unreachable ()))));
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon (0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_location ())...yle_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , "%s", quotearg_n_style_colon (0, shell_escape_quoting_style, "-")), (( 0 ) ? (void) 0 : __builtin_unreachable ()))));
0
573 return
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
ok ?
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
22
574 0
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
22
575 :
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
22
576 1
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
22
577 ;
executed 22 times by 1 test: return ok ? 0 : 1 ;
Executed by:
  • sum
22
578}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2