OpenCoverage

yes.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/yes.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static struct option const long_options[] =-
10{-
11 {-
12 ((void *)0)-
13 , 0, -
14 ((void *)0)-
15 , 0}-
16};-
17-
18void-
19usage (int status)-
20{-
21 if (status !=
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 3 times by 1 test
Evaluated by:
  • yes
3
22 0
status != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 3 times by 1 test
Evaluated by:
  • yes
3
23 )-
24 do { fprintf (-
25 stderr-
26 , -
27 dcgettext (((void *)0), -
28 "Try '%s --help' for more information.\n"-
29 , 5)-
30 , program_name); }
executed 3 times by 1 test: end of block
Executed by:
  • yes
while (0);
3
31 else-
32 {-
33 printf (-
34 dcgettext (((void *)0), -
35 "Usage: %s [STRING]...\n or: %s OPTION\n"-
36 , 5)-
37-
38-
39 -
40 ,-
41 program_name, program_name);-
42-
43 fputs_unlocked (-
44 dcgettext (((void *)0), -
45 "Repeatedly output a line with all specified STRING(s), or 'y'.\n\n"-
46 , 5)-
47 ,-
48 stdout-
49 )-
50-
51-
52 ;-
53 fputs_unlocked (-
54 dcgettext (((void *)0), -
55 " --help display this help and exit\n"-
56 , 5)-
57 ,-
58 stdout-
59 );-
60 fputs_unlocked (-
61 dcgettext (((void *)0), -
62 " --version output version information and exit\n"-
63 , 5)-
64 ,-
65 stdout-
66 );-
67 emit_ancillary_info ("yes");-
68 }
executed 3 times by 1 test: end of block
Executed by:
  • yes
3
69 exit (status);
executed 6 times by 1 test: exit (status);
Executed by:
  • yes
6
70}-
71-
72int-
73main (int argc, char **argv)-
74{-
75 ;-
76 set_program_name (argv[0]);-
77 setlocale (-
78 6-
79 , "");-
80 bindtextdomain ("coreutils", "/usr/local/share/locale");-
81 textdomain ("coreutils");-
82-
83 atexit (close_stdout);-
84-
85 parse_long_options (argc, argv, "yes", "GNU coreutils", Version,-
86 usage, ("David MacKenzie"), (char const *) -
87 ((void *)0)-
88 );-
89 if (getopt_long (argc, argv, "+", long_options,
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
3-47
90 ((void *)0)
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
3-47
91 ) != -1
getopt_long (a...d *)0) ) != -1Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
)
3-47
92 usage (
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • yes
3
93 1
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • yes
3
94 );
executed 3 times by 1 test: usage ( 1 );
Executed by:
  • yes
3
95-
96 char **operands = argv + optind;-
97 char **operand_lim = argv + argc;-
98 if (optind == argc
optind == argcDescription
TRUEevaluated 23 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 24 times by 1 test
Evaluated by:
  • yes
)
23-24
99 *
executed 23 times by 1 test: *operand_lim++ = bad_cast ("y");
Executed by:
  • yes
operand_lim++ = bad_cast ("y");
executed 23 times by 1 test: *operand_lim++ = bad_cast ("y");
Executed by:
  • yes
23
100-
101-
102-
103 size_t bufalloc = 0;-
104 -
105 _Bool -
106 reuse_operand_strings = -
107 1-
108 ;-
109 for (char **operandp = operands; operandp < operand_lim
operandp < operand_limDescription
TRUEevaluated 4145 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
; operandp++)
47-4145
110 {-
111 size_t operand_len = strlen (*operandp);-
112 bufalloc += operand_len + 1;-
113 if (operandp + 1 < operand_lim
operandp + 1 < operand_limDescription
TRUEevaluated 4098 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
47-4098
114 && *
*operandp + op...!= operandp[1]Description
TRUEnever evaluated
FALSEevaluated 4098 times by 1 test
Evaluated by:
  • yes
operandp + operand_len + 1 != operandp[1]
*operandp + op...!= operandp[1]Description
TRUEnever evaluated
FALSEevaluated 4098 times by 1 test
Evaluated by:
  • yes
)
0-4098
115 reuse_operand_strings =
never executed: reuse_operand_strings = 0 ;
0
116 0
never executed: reuse_operand_strings = 0 ;
0
117 ;
never executed: reuse_operand_strings = 0 ;
0
118 }
executed 4145 times by 1 test: end of block
Executed by:
  • yes
4145
119-
120-
121 if (bufalloc <=
bufalloc <= 8192 / 2Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 7 times by 1 test
Evaluated by:
  • yes
7-40
122 8192
bufalloc <= 8192 / 2Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 7 times by 1 test
Evaluated by:
  • yes
7-40
123 / 2
bufalloc <= 8192 / 2Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 7 times by 1 test
Evaluated by:
  • yes
)
7-40
124 {-
125 bufalloc = -
126 8192-
127 ;-
128 reuse_operand_strings = -
129 0-
130 ;-
131 }
executed 40 times by 1 test: end of block
Executed by:
  • yes
40
132-
133-
134-
135 char *buf = reuse_operand_strings
reuse_operand_stringsDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 40 times by 1 test
Evaluated by:
  • yes
? *operands : xmalloc (bufalloc);
7-40
136 size_t bufused = 0;-
137 for (char **operandp = operands; operandp < operand_lim
operandp < operand_limDescription
TRUEevaluated 4145 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
; operandp++)
47-4145
138 {-
139 size_t operand_len = strlen (*operandp);-
140 if (! reuse_operand_strings
! reuse_operand_stringsDescription
TRUEevaluated 139 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 4006 times by 1 test
Evaluated by:
  • yes
)
139-4006
141 memcpy (buf + bufused, *operandp, operand_len);
executed 139 times by 1 test: memcpy (buf + bufused, *operandp, operand_len);
Executed by:
  • yes
139
142 bufused += operand_len;-
143 buf[bufused++] = ' ';-
144 }
executed 4145 times by 1 test: end of block
Executed by:
  • yes
4145
145 buf[bufused - 1] = '\n';-
146-
147-
148-
149 size_t copysize = bufused;-
150 for (size_t copies = bufalloc / copysize; --
--copiesDescription
TRUEevaluated 109414 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
copies
--copiesDescription
TRUEevaluated 109414 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 47 times by 1 test
Evaluated by:
  • yes
; )
47-109414
151 {-
152 memcpy (buf + bufused, buf, copysize);-
153 bufused += copysize;-
154 }
executed 109414 times by 1 test: end of block
Executed by:
  • yes
109414
155-
156-
157 while (full_write (
full_write ( 1...ed) == bufusedDescription
TRUEevaluated 8995 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 45 times by 1 test
Evaluated by:
  • yes
45-8995
158 1
full_write ( 1...ed) == bufusedDescription
TRUEevaluated 8995 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 45 times by 1 test
Evaluated by:
  • yes
45-8995
159 , buf, bufused) == bufused
full_write ( 1...ed) == bufusedDescription
TRUEevaluated 8995 times by 1 test
Evaluated by:
  • yes
FALSEevaluated 45 times by 1 test
Evaluated by:
  • yes
)
45-8995
160 continue;
executed 8995 times by 1 test: continue;
Executed by:
  • yes
8995
161 error (0, -
162 (*__errno_location ())-
163 , -
164 dcgettext (((void *)0), -
165 "standard output"-
166 , 5)-
167 );-
168 return
executed 45 times by 1 test: return 1 ;
Executed by:
  • yes
executed 45 times by 1 test: return 1 ;
Executed by:
  • yes
45
169 1
executed 45 times by 1 test: return 1 ;
Executed by:
  • yes
45
170 ;
executed 45 times by 1 test: return 1 ;
Executed by:
  • yes
45
171}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2