OpenCoverage

strtrans.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/strtrans.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7char *-
8ansicstr (string, len, flags, sawc, rlen)-
9 char *string;-
10 int len, flags, *sawc, *rlen;-
11{-
12 int c, temp;-
13 char *ret, *r, *s;-
14 unsigned long v;-
15-
16 if (string == 0
string == 0Description
TRUEnever evaluated
FALSEevaluated 2682 times by 1 test
Evaluated by:
  • Self test
|| *
*string == '\0'Description
TRUEnever evaluated
FALSEevaluated 2682 times by 1 test
Evaluated by:
  • Self test
string == '\0'
*string == '\0'Description
TRUEnever evaluated
FALSEevaluated 2682 times by 1 test
Evaluated by:
  • Self test
)
0-2682
17 return
never executed: return ((char *) ((void *)0) );
((char *)
never executed: return ((char *) ((void *)0) );
0
18 ((void *)0)
never executed: return ((char *) ((void *)0) );
0
19 );
never executed: return ((char *) ((void *)0) );
0
20-
21-
22 temp = 4*len + 1;-
23 if (temp < 12
temp < 12Description
TRUEevaluated 176 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2506 times by 1 test
Evaluated by:
  • Self test
)
176-2506
24 temp = 12;
executed 176 times by 1 test: temp = 12;
Executed by:
  • Self test
176
25 ret = (char *)sh_xmalloc((temp), "strtrans.c", 66);-
26-
27-
28-
29 for (r = ret, s = string; s
sDescription
TRUEevaluated 9248 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& *
*sDescription
TRUEevaluated 6586 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2662 times by 1 test
Evaluated by:
  • Self test
s
*sDescription
TRUEevaluated 6586 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2662 times by 1 test
Evaluated by:
  • Self test
; )
0-9248
30 {-
31 c = *s++;-
32 if (c != '\\'
c != '\\'Description
TRUEevaluated 1679 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4907 times by 1 test
Evaluated by:
  • Self test
|| *
*s == '\0'Description
TRUEnever evaluated
FALSEevaluated 4907 times by 1 test
Evaluated by:
  • Self test
s == '\0'
*s == '\0'Description
TRUEnever evaluated
FALSEevaluated 4907 times by 1 test
Evaluated by:
  • Self test
)
0-4907
33 *
executed 1679 times by 1 test: *r++ = c;
Executed by:
  • Self test
r++ = c;
executed 1679 times by 1 test: *r++ = c;
Executed by:
  • Self test
1679
34 else-
35 {-
36 switch (c = *s++)-
37 {-
38-
39 case
executed 28 times by 1 test: case 'a':
Executed by:
  • Self test
'a':
executed 28 times by 1 test: case 'a':
Executed by:
  • Self test
c = '\a'; break;
executed 28 times by 1 test: break;
Executed by:
  • Self test
28
40 case
executed 16 times by 1 test: case 'v':
Executed by:
  • Self test
'v':
executed 16 times by 1 test: case 'v':
Executed by:
  • Self test
c = '\v'; break;
executed 16 times by 1 test: break;
Executed by:
  • Self test
16
41-
42-
43-
44-
45 case
executed 18 times by 1 test: case 'b':
Executed by:
  • Self test
'b':
executed 18 times by 1 test: case 'b':
Executed by:
  • Self test
c = '\b'; break;
executed 18 times by 1 test: break;
Executed by:
  • Self test
18
46 case
executed 10 times by 1 test: case 'e':
Executed by:
  • Self test
'e':
executed 10 times by 1 test: case 'e':
Executed by:
  • Self test
case
executed 1 time by 1 test: case 'E':
Executed by:
  • Self test
'E':
executed 1 time by 1 test: case 'E':
Executed by:
  • Self test
1-10
47 c = '\033'; break;
executed 11 times by 1 test: break;
Executed by:
  • Self test
11
48 case
executed 16 times by 1 test: case 'f':
Executed by:
  • Self test
'f':
executed 16 times by 1 test: case 'f':
Executed by:
  • Self test
c = '\f'; break;
executed 16 times by 1 test: break;
Executed by:
  • Self test
16
49 case
executed 218 times by 1 test: case 'n':
Executed by:
  • Self test
'n':
executed 218 times by 1 test: case 'n':
Executed by:
  • Self test
c = '\n'; break;
executed 218 times by 1 test: break;
Executed by:
  • Self test
218
50 case
executed 11 times by 1 test: case 'r':
Executed by:
  • Self test
'r':
executed 11 times by 1 test: case 'r':
Executed by:
  • Self test
c = '\r'; break;
executed 11 times by 1 test: break;
Executed by:
  • Self test
11
51 case
executed 60 times by 1 test: case 't':
Executed by:
  • Self test
't':
executed 60 times by 1 test: case 't':
Executed by:
  • Self test
c = '\t'; break;
executed 60 times by 1 test: break;
Executed by:
  • Self test
60
52 case
executed 293 times by 1 test: case '1':
Executed by:
  • Self test
'1':
executed 293 times by 1 test: case '1':
Executed by:
  • Self test
case
executed 2093 times by 1 test: case '2':
Executed by:
  • Self test
'2':
executed 2093 times by 1 test: case '2':
Executed by:
  • Self test
case
executed 1284 times by 1 test: case '3':
Executed by:
  • Self test
'3':
executed 1284 times by 1 test: case '3':
Executed by:
  • Self test
293-2093
53 case
never executed: case '4':
'4':
never executed: case '4':
case
never executed: case '5':
'5':
never executed: case '5':
case
never executed: case '6':
'6':
never executed: case '6':
0
54 case
never executed: case '7':
'7':
never executed: case '7':
0
55-
56 if (flags & 1
flags & 1Description
TRUEnever evaluated
FALSEevaluated 3670 times by 1 test
Evaluated by:
  • Self test
)
0-3670
57 {-
58 *r++ = '\\';-
59 break;
never executed: break;
0
60 }-
61-
62-
63 case
executed 332 times by 1 test: case '0':
Executed by:
  • Self test
'0':
executed 332 times by 1 test: case '0':
Executed by:
  • Self test
code before this statement executed 3670 times by 1 test: case '0':
Executed by:
  • Self test
332-3670
64-
65-
66-
67-
68 temp = 2 + ((
(flags & 1)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3995 times by 1 test
Evaluated by:
  • Self test
flags & 1)
(flags & 1)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3995 times by 1 test
Evaluated by:
  • Self test
&& (
(c == '0')Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c == '0')
(c == '0')Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
);
0-3995
69 for (c -= '0'; ((*
(*s) >= '0'Description
TRUEevaluated 10112 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1856 times by 1 test
Evaluated by:
  • Self test
s) >= '0'
(*s) >= '0'Description
TRUEevaluated 10112 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1856 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= '7'Description
TRUEevaluated 7970 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2142 times by 1 test
Evaluated by:
  • Self test
s) <= '7'
(*s) <= '7'Description
TRUEevaluated 7970 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2142 times by 1 test
Evaluated by:
  • Self test
) && temp--
temp--Description
TRUEevaluated 7966 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test
; s++)
4-10112
70 c = (c * 8) + ((*s) - '0');
executed 7966 times by 1 test: c = (c * 8) + ((*s) - '0');
Executed by:
  • Self test
7966
71 c &= 0xFF;-
72 break;
executed 4002 times by 1 test: break;
Executed by:
  • Self test
4002
73 case
executed 269 times by 1 test: case 'x':
Executed by:
  • Self test
'x':
executed 269 times by 1 test: case 'x':
Executed by:
  • Self test
269
74 if ((
(flags & 2)Description
TRUEevaluated 255 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
flags & 2)
(flags & 2)Description
TRUEevaluated 255 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test
&& *
*s == '{'Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 239 times by 1 test
Evaluated by:
  • Self test
s == '{'
*s == '{'Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 239 times by 1 test
Evaluated by:
  • Self test
)
14-255
75 {-
76 flags |= 16;-
77 s++;-
78 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test
16
79-
80 for (temp = 2, c = 0; (1 && -
81 ((*
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 529 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 247 times by 1 test
Evaluated by:
  • Self test
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 529 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 247 times by 1 test
Evaluated by:
  • Self test
247-529
82 (unsigned char)(unsigned char)*s
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 529 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 247 times by 1 test
Evaluated by:
  • Self test
247-529
83 ))] & (unsigned short int) _ISxdigit)
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 529 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 247 times by 1 test
Evaluated by:
  • Self test
247-529
84 ) && temp--
temp--Description
TRUEevaluated 507 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 22 times by 1 test
Evaluated by:
  • Self test
; s++)
22-507
85 c = (c * 16) + (((*
(*s) >= 'a'Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 450 times by 1 test
Evaluated by:
  • Self test
s) >= 'a'
(*s) >= 'a'Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 450 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'f'Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s) <= 'f'
(*s) <= 'f'Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
) ? (*s)-'a'+10 : (*
(*s) >= 'A'Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 315 times by 1 test
Evaluated by:
  • Self test
s) >= 'A'
(*s) >= 'A'Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 315 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'F'Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s) <= 'F'
(*s) <= 'F'Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
? (*s)-'A'+10 : (*s)-'0');
executed 507 times by 1 test: c = (c * 16) + (((*s) >= 'a' && (*s) <= 'f') ? (*s)-'a'+10 : (*s) >= 'A' && (*s) <= 'F' ? (*s)-'A'+10 : (*s)-'0');
Executed by:
  • Self test
0-507
86-
87-
88-
89 if (flags & 16
flags & 16Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 253 times by 1 test
Evaluated by:
  • Self test
)
16-253
90 {-
91 for ( ; (1 && -
92 ((*
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
10-16
93 (unsigned char)(unsigned char)*s
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
10-16
94 ))] & (unsigned short int) _ISxdigit)
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test
10-16
95 ); s++)-
96 c = (c * 16) + (((*
(*s) >= 'a'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
s) >= 'a'
(*s) >= 'a'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'f'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s) <= 'f'
(*s) <= 'f'Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
) ? (*s)-'a'+10 : (*
(*s) >= 'A'Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
s) >= 'A'
(*s) >= 'A'Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'F'Description
TRUEnever evaluated
FALSEnever evaluated
s) <= 'F'
(*s) <= 'F'Description
TRUEnever evaluated
FALSEnever evaluated
? (*s)-'A'+10 : (*s)-'0');
executed 10 times by 1 test: c = (c * 16) + (((*s) >= 'a' && (*s) <= 'f') ? (*s)-'a'+10 : (*s) >= 'A' && (*s) <= 'F' ? (*s)-'A'+10 : (*s)-'0');
Executed by:
  • Self test
0-10
97 flags &= ~16;-
98 if (*
*s == '}'Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
s == '}'
*s == '}'Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test
)
6-10
99 s++;
executed 10 times by 1 test: s++;
Executed by:
  • Self test
10
100 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test
16
101-
102 else if (temp == 2
temp == 2Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 243 times by 1 test
Evaluated by:
  • Self test
)
10-243
103 {-
104 *r++ = '\\';-
105 c = 'x';-
106 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test
10
107 c &= 0xFF;-
108 break;
executed 269 times by 1 test: break;
Executed by:
  • Self test
269
109-
110 case
executed 81 times by 1 test: case 'u':
Executed by:
  • Self test
'u':
executed 81 times by 1 test: case 'u':
Executed by:
  • Self test
81
111 case
executed 26 times by 1 test: case 'U':
Executed by:
  • Self test
'U':
executed 26 times by 1 test: case 'U':
Executed by:
  • Self test
26
112 temp = (
(c == 'u')Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 26 times by 1 test
Evaluated by:
  • Self test
c == 'u')
(c == 'u')Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 26 times by 1 test
Evaluated by:
  • Self test
? 4 : 8;
26-81
113 for (v = 0; (1 && -
114 ((*
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 423 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 107 times by 1 test
Evaluated by:
  • Self test
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 423 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 107 times by 1 test
Evaluated by:
  • Self test
107-423
115 (unsigned char)(unsigned char)*s
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 423 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 107 times by 1 test
Evaluated by:
  • Self test
107-423
116 ))] & (unsigned short int) _ISxdigit)
((*__ctype_b_l...nt) _ISxdigit)Description
TRUEevaluated 423 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 107 times by 1 test
Evaluated by:
  • Self test
107-423
117 ) && temp--
temp--Description
TRUEevaluated 423 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
; s++)
0-423
118 v = (v * 16) + (((*
(*s) >= 'a'Description
TRUEevaluated 394 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 29 times by 1 test
Evaluated by:
  • Self test
s) >= 'a'
(*s) >= 'a'Description
TRUEevaluated 394 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 29 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'f'Description
TRUEevaluated 394 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
s) <= 'f'
(*s) <= 'f'Description
TRUEevaluated 394 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
) ? (*s)-'a'+10 : (*
(*s) >= 'A'Description
TRUEnever evaluated
FALSEevaluated 29 times by 1 test
Evaluated by:
  • Self test
s) >= 'A'
(*s) >= 'A'Description
TRUEnever evaluated
FALSEevaluated 29 times by 1 test
Evaluated by:
  • Self test
&& (*
(*s) <= 'F'Description
TRUEnever evaluated
FALSEnever evaluated
s) <= 'F'
(*s) <= 'F'Description
TRUEnever evaluated
FALSEnever evaluated
? (*s)-'A'+10 : (*s)-'0');
executed 423 times by 1 test: v = (v * 16) + (((*s) >= 'a' && (*s) <= 'f') ? (*s)-'a'+10 : (*s) >= 'A' && (*s) <= 'F' ? (*s)-'A'+10 : (*s)-'0');
Executed by:
  • Self test
0-423
119 if (temp == ((
(c == 'u')Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 26 times by 1 test
Evaluated by:
  • Self test
c == 'u')
(c == 'u')Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 26 times by 1 test
Evaluated by:
  • Self test
? 4 : 8)
temp == ((c == 'u') ? 4 : 8)Description
TRUEnever evaluated
FALSEevaluated 107 times by 1 test
Evaluated by:
  • Self test
)
0-107
120 {-
121 *r++ = '\\';-
122 break;
never executed: break;
0
123 }-
124 else if (v <= 0x7f
v <= 0x7fDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test
FALSEevaluated 106 times by 1 test
Evaluated by:
  • Self test
)
1-106
125 {-
126 c = v;-
127 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test
1
128 }-
129 else-
130 {-
131 temp = u32cconv (v, r);-
132 r += temp;-
133 continue;
executed 106 times by 1 test: continue;
Executed by:
  • Self test
106
134 }-
135-
136 case
executed 37 times by 1 test: case '\\':
Executed by:
  • Self test
'\\':
executed 37 times by 1 test: case '\\':
Executed by:
  • Self test
37
137 break;
executed 37 times by 1 test: break;
Executed by:
  • Self test
37
138 case
executed 45 times by 1 test: case '\'':
Executed by:
  • Self test
'\'':
executed 45 times by 1 test: case '\'':
Executed by:
  • Self test
case
executed 5 times by 1 test: case '"':
Executed by:
  • Self test
'"':
executed 5 times by 1 test: case '"':
Executed by:
  • Self test
case
never executed: case '?':
'?':
never executed: case '?':
0-45
139 if (flags & 1
flags & 1Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 30 times by 1 test
Evaluated by:
  • Self test
)
20-30
140 *
executed 20 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
r++ = '\\';
executed 20 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
20
141 break;
executed 50 times by 1 test: break;
Executed by:
  • Self test
50
142 case
executed 48 times by 1 test: case 'c':
Executed by:
  • Self test
'c':
executed 48 times by 1 test: case 'c':
Executed by:
  • Self test
48
143 if (sawc
sawcDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
)
20-28
144 {-
145 *sawc = 1;-
146 *r = '\0';-
147 if (rlen
rlenDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-20
148 *
executed 20 times by 1 test: *rlen = r - ret;
Executed by:
  • Self test
rlen = r - ret;
executed 20 times by 1 test: *rlen = r - ret;
Executed by:
  • Self test
20
149 return
executed 20 times by 1 test: return ret;
Executed by:
  • Self test
ret;
executed 20 times by 1 test: return ret;
Executed by:
  • Self test
20
150 }-
151 else if ((
(flags & 1) == 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 1) == 0
(flags & 1) == 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& *
*s == 0Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
s == 0
*s == 0Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test
)
0-28
152 ;
never executed: ;
0
153 else if ((
(flags & 1) == 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 1) == 0
(flags & 1) == 0Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& (
(c = *s)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
c = *s)
(c = *s)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-28
154 {-
155 s++;-
156 if ((
(flags & 2)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 2)
(flags & 2)Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& c == '\\'
c == '\\'Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 25 times by 1 test
Evaluated by:
  • Self test
&& c == *s
c == *sDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-28
157 s++;
executed 3 times by 1 test: s++;
Executed by:
  • Self test
3
158 c = ((
(c) == '?'Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
c) == '?'
(c) == '?'Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
? 0x7f : (((1 &&
13-15
159 ((*
((*__ctype_b_l...int) _ISlower)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...int) _ISlower)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
0-15
160 (unsigned char)c
((*__ctype_b_l...int) _ISlower)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
0-15
161 ))] & (unsigned short int) _ISlower)
((*__ctype_b_l...int) _ISlower)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test
0-15
162 ) ? -
163 (__extension__ ({ int __res; if (sizeof (
sizeof ( c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
164 c
sizeof ( c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
165 ) > 1
sizeof ( c ) > 1Description
TRUEnever evaluated
FALSEnever evaluated
) { if (__builtin_constant_p (
__builtin_constant_p ( c )Description
TRUEnever evaluated
FALSEnever evaluated
0
166 c
__builtin_constant_p ( c )Description
TRUEnever evaluated
FALSEnever evaluated
0
167 )
__builtin_constant_p ( c )Description
TRUEnever evaluated
FALSEnever evaluated
) { int __c = (
0
168 c-
169 ); __res = __c < -128
__c < -128Description
TRUEnever evaluated
FALSEnever evaluated
|| __c > 255
__c > 255Description
TRUEnever evaluated
FALSEnever evaluated
? __c : (*__ctype_toupper_loc ())[__c]; }
never executed: end of block
else __res = toupper (
never executed: __res = toupper ( c );
0
170 c
never executed: __res = toupper ( c );
0
171 );
never executed: __res = toupper ( c );
} else __res = (*__ctype_toupper_loc ())[(int) (
never executed: __res = (*__ctype_toupper_loc ())[(int) ( c )];
0
172 c
never executed: __res = (*__ctype_toupper_loc ())[(int) ( c )];
0
173 )];
never executed: __res = (*__ctype_toupper_loc ())[(int) ( c )];
__res; }))
0
174 : (c)) & 0x1f));-
175 break;
executed 28 times by 1 test: break;
Executed by:
  • Self test
28
176 }-
177-
178 default
executed 16 times by 1 test: default:
Executed by:
  • Self test
code before this statement never executed: default:
executed 16 times by 1 test: default:
Executed by:
  • Self test
:
code before this statement never executed: default:
executed 16 times by 1 test: default:
Executed by:
  • Self test
0-16
179 if ((
(flags & 4) == 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 4) == 0
(flags & 4) == 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-16
180 *
executed 16 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
r++ = '\\';
executed 16 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
16
181 break;
executed 16 times by 1 test: break;
Executed by:
  • Self test
16
182 }-
183 if ((
(flags & 2)Description
TRUEevaluated 4720 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
flags & 2)
(flags & 2)Description
TRUEevaluated 4720 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test
&& (c == '\001'
c == '\001'Description
TRUEevaluated 235 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4485 times by 1 test
Evaluated by:
  • Self test
|| c == '\177'
c == '\177'Description
TRUEevaluated 266 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4219 times by 1 test
Evaluated by:
  • Self test
))
61-4720
184 *
executed 501 times by 1 test: *r++ = '\001';
Executed by:
  • Self test
r++ = '\001';
executed 501 times by 1 test: *r++ = '\001';
Executed by:
  • Self test
501
185 *r++ = c;-
186 }
executed 4781 times by 1 test: end of block
Executed by:
  • Self test
4781
187 }-
188 *r = '\0';-
189 if (rlen
rlenDescription
TRUEevaluated 2651 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
)
11-2651
190 *
executed 2651 times by 1 test: *rlen = r - ret;
Executed by:
  • Self test
rlen = r - ret;
executed 2651 times by 1 test: *rlen = r - ret;
Executed by:
  • Self test
2651
191 return
executed 2662 times by 1 test: return ret;
Executed by:
  • Self test
ret;
executed 2662 times by 1 test: return ret;
Executed by:
  • Self test
2662
192}-
193-
194-
195-
196char *-
197ansic_quote (str, flags, rlen)-
198 char *str;-
199 int flags, *rlen;-
200{-
201 char *r, *ret, *s;-
202 int l, rsize;-
203 unsigned char c;-
204 size_t clen;-
205 int b;-
206-
207 wchar_t wc;-
208-
209-
210 if (str == 0
str == 0Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • Self test
|| *
*str == 0Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • Self test
str == 0
*str == 0Description
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • Self test
)
0-198
211 return
never executed: return ((char *)0);
((char *)0);
never executed: return ((char *)0);
0
212-
213 l = strlen (str);-
214 rsize = 4 * l + 4;-
215 r = ret = (char *)sh_xmalloc((rsize), "strtrans.c", 228);-
216-
217 *r++ = '$';-
218 *r++ = '\'';-
219-
220 for (s = str; c = *s
c = *sDescription
TRUEevaluated 337 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 198 times by 1 test
Evaluated by:
  • Self test
; s++)
198-337
221 {-
222 b = l = 1;-
223 clen = 1;-
224-
225 switch (c)-
226 {-
227 case
never executed: case '\033':
'\033':
never executed: case '\033':
c = 'E'; break;
never executed: break;
0
228-
229 case
executed 6 times by 1 test: case '\a':
Executed by:
  • Self test
'\a':
executed 6 times by 1 test: case '\a':
Executed by:
  • Self test
c = 'a'; break;
executed 6 times by 1 test: break;
Executed by:
  • Self test
6
230 case
never executed: case '\v':
'\v':
never executed: case '\v':
c = 'v'; break;
never executed: break;
0
231-
232-
233-
234-
235-
236 case
never executed: case '\b':
'\b':
never executed: case '\b':
c = 'b'; break;
never executed: break;
0
237 case
never executed: case '\f':
'\f':
never executed: case '\f':
c = 'f'; break;
never executed: break;
0
238 case
executed 12 times by 1 test: case '\n':
Executed by:
  • Self test
'\n':
executed 12 times by 1 test: case '\n':
Executed by:
  • Self test
c = 'n'; break;
executed 12 times by 1 test: break;
Executed by:
  • Self test
12
239 case
never executed: case '\r':
'\r':
never executed: case '\r':
c = 'r'; break;
never executed: break;
0
240 case
executed 11 times by 1 test: case '\t':
Executed by:
  • Self test
'\t':
executed 11 times by 1 test: case '\t':
Executed by:
  • Self test
c = 't'; break;
executed 11 times by 1 test: break;
Executed by:
  • Self test
11
241 case
executed 6 times by 1 test: case '\\':
Executed by:
  • Self test
'\\':
executed 6 times by 1 test: case '\\':
Executed by:
  • Self test
6
242 case
never executed: case '\'':
'\'':
never executed: case '\'':
0
243 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test
6
244 default
executed 302 times by 1 test: default:
Executed by:
  • Self test
:
executed 302 times by 1 test: default:
Executed by:
  • Self test
302
245-
246 b = is_basic (c);-
247-
248 if ((b == 0
b == 0Description
TRUEevaluated 246 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
&& ((
(clen = mbrtow... ()) , 0)) < 0Description
TRUEnever evaluated
FALSEevaluated 246 times by 1 test
Evaluated by:
  • Self test
clen = mbrtowc (&wc, s,
(clen = mbrtow... ()) , 0)) < 0Description
TRUEnever evaluated
FALSEevaluated 246 times by 1 test
Evaluated by:
  • Self test
0-246
249 (__ctype_get_mb_cur_max ())
(clen = mbrtow... ()) , 0)) < 0Description
TRUEnever evaluated
FALSEevaluated 246 times by 1 test
Evaluated by:
  • Self test
0-246
250 , 0)) < 0
(clen = mbrtow... ()) , 0)) < 0Description
TRUEnever evaluated
FALSEevaluated 246 times by 1 test
Evaluated by:
  • Self test
|| ((
(clen) == (size_t)-1Description
TRUEevaluated 187 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
clen) == (size_t)-1
(clen) == (size_t)-1Description
TRUEevaluated 187 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
|| (
(clen) == (size_t)-2Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
clen) == (size_t)-2
(clen) == (size_t)-2Description
TRUEnever evaluated
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test
) || iswprint (wc) == 0
iswprint (wc) == 0Description
TRUEevaluated 55 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test
)) ||
0-246
251 (b == 1
b == 1Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test
&& (
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
1 &&
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
0-56
252 ((*
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
0-56
253 (unsigned char)c
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
0-56
254 ))] & (unsigned short int) _ISprint)
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
0-56
255 ) == 0
(1 && ((*__cty...Sprint) ) == 0Description
TRUEnever evaluated
FALSEevaluated 56 times by 1 test
Evaluated by:
  • Self test
))
0-56
256-
257-
258-
259 {-
260 *r++ = '\\';-
261 *r++ = (((c >> 6) & 07) + '0');-
262 *r++ = (((c >> 3) & 07) + '0');-
263 *r++ = ((c & 07) + '0');-
264 continue;
executed 242 times by 1 test: continue;
Executed by:
  • Self test
242
265 }-
266 l = 0;-
267 break;
executed 60 times by 1 test: break;
Executed by:
  • Self test
60
268 }-
269 if (b == 0
b == 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 91 times by 1 test
Evaluated by:
  • Self test
&& clen == 0
clen == 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test
)
0-91
270 break;
never executed: break;
0
271-
272 if (l
lDescription
TRUEevaluated 35 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 60 times by 1 test
Evaluated by:
  • Self test
)
35-60
273 *
executed 35 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
r++ = '\\';
executed 35 times by 1 test: *r++ = '\\';
Executed by:
  • Self test
35
274-
275 if (clen == 1
clen == 1Description
TRUEevaluated 95 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-95
276 *
executed 95 times by 1 test: *r++ = c;
Executed by:
  • Self test
r++ = c;
executed 95 times by 1 test: *r++ = c;
Executed by:
  • Self test
95
277 else-
278 {-
279 for (b = 0; b < (int)clen
b < (int)clenDescription
TRUEnever evaluated
FALSEnever evaluated
; b++)
0
280 *
never executed: *r++ = (unsigned char)s[b];
r++ = (unsigned char)s[b];
never executed: *r++ = (unsigned char)s[b];
0
281 s += clen - 1;-
282 }
never executed: end of block
0
283 }-
284-
285 *r++ = '\'';-
286 *r = '\0';-
287 if (rlen
rlenDescription
TRUEnever evaluated
FALSEevaluated 198 times by 1 test
Evaluated by:
  • Self test
)
0-198
288 *
never executed: *rlen = r - ret;
rlen = r - ret;
never executed: *rlen = r - ret;
0
289 return
executed 198 times by 1 test: return ret;
Executed by:
  • Self test
ret;
executed 198 times by 1 test: return ret;
Executed by:
  • Self test
198
290}-
291-
292-
293int-
294ansic_wshouldquote (string)-
295 const char *string;-
296{-
297 const wchar_t *wcs;-
298 wchar_t wcc;-
299 wchar_t *wcstr = -
300 ((void *)0)-
301 ;-
302 size_t slen;-
303-
304 slen = mbstowcs (wcstr, string, 0);-
305-
306 if (slen == (size_t)-1
slen == (size_t)-1Description
TRUEevaluated 131 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 168 times by 1 test
Evaluated by:
  • Self test
)
131-168
307 return
executed 131 times by 1 test: return 1;
Executed by:
  • Self test
1;
executed 131 times by 1 test: return 1;
Executed by:
  • Self test
131
308-
309 wcstr = (wchar_t *)sh_xmalloc((sizeof (wchar_t) * (slen + 1)), "strtrans.c", 314);-
310 mbstowcs (wcstr, string, slen + 1);-
311-
312 for (wcs = wcstr; wcc = *wcs
wcc = *wcsDescription
TRUEevaluated 294 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 112 times by 1 test
Evaluated by:
  • Self test
; wcs++)
112-294
313 if (iswprint(wcc) == 0
iswprint(wcc) == 0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 238 times by 1 test
Evaluated by:
  • Self test
)
56-238
314 {-
315 sh_xfree((wcstr), "strtrans.c", 320);-
316 return
executed 56 times by 1 test: return 1;
Executed by:
  • Self test
1;
executed 56 times by 1 test: return 1;
Executed by:
  • Self test
56
317 }-
318-
319 sh_xfree((wcstr), "strtrans.c", 324);-
320 return
executed 112 times by 1 test: return 0;
Executed by:
  • Self test
0;
executed 112 times by 1 test: return 0;
Executed by:
  • Self test
112
321}-
322-
323-
324-
325int-
326ansic_shouldquote (string)-
327 const char *string;-
328{-
329 const char *s;-
330 unsigned char c;-
331-
332 if (string == 0
string == 0Description
TRUEnever evaluated
FALSEevaluated 2088 times by 1 test
Evaluated by:
  • Self test
)
0-2088
333 return
never executed: return 0;
0;
never executed: return 0;
0
334-
335 for (s = string; c = *s
c = *sDescription
TRUEevaluated 11447 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1778 times by 1 test
Evaluated by:
  • Self test
; s++)
1778-11447
336 {-
337-
338 if (is_basic (c) == 0
is_basic (c) == 0Description
TRUEevaluated 299 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11148 times by 1 test
Evaluated by:
  • Self test
)
299-11148
339 return
executed 299 times by 1 test: return (ansic_wshouldquote (s));
Executed by:
  • Self test
(ansic_wshouldquote (s));
executed 299 times by 1 test: return (ansic_wshouldquote (s));
Executed by:
  • Self test
299
340-
341 if ((
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
1 &&
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
11-11137
342 ((*
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
__ctype_b_loc ())[(int) ((
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
11-11137
343 (unsigned char)c
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
11-11137
344 ))] & (unsigned short int) _ISprint)
((*__ctype_b_l...int) _ISprint)Description
TRUEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
11-11137
345 ) == 0
(1 && ((*__cty...Sprint) ) == 0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 11137 times by 1 test
Evaluated by:
  • Self test
)
11-11137
346 return
executed 11 times by 1 test: return 1;
Executed by:
  • Self test
1;
executed 11 times by 1 test: return 1;
Executed by:
  • Self test
11
347 }
executed 11137 times by 1 test: end of block
Executed by:
  • Self test
11137
348-
349 return
executed 1778 times by 1 test: return 0;
Executed by:
  • Self test
0;
executed 1778 times by 1 test: return 0;
Executed by:
  • Self test
1778
350}-
351-
352-
353-
354char *-
355ansiexpand (string, start, end, lenp)-
356 char *string;-
357 int start, end, *lenp;-
358{-
359 char *temp, *t;-
360 int len, tlen;-
361-
362 temp = (char *)sh_xmalloc((end - start + 1), "strtrans.c", 363);-
363 for (tlen = 0, len = start; len < end
len < endDescription
TRUEevaluated 20079 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2608 times by 1 test
Evaluated by:
  • Self test
; )
2608-20079
364 temp[tlen++] = string[len++];
executed 20079 times by 1 test: temp[tlen++] = string[len++];
Executed by:
  • Self test
20079
365 temp[tlen] = '\0';-
366-
367 if (*
*tempDescription
TRUEevaluated 2603 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
temp
*tempDescription
TRUEevaluated 2603 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test
)
5-2603
368 {-
369 t = ansicstr (temp, tlen, 2, (int *)-
370 ((void *)0)-
371 , lenp);-
372 sh_xfree((temp), "strtrans.c", 371);-
373 return
executed 2603 times by 1 test: return (t);
Executed by:
  • Self test
(t);
executed 2603 times by 1 test: return (t);
Executed by:
  • Self test
2603
374 }-
375 else-
376 {-
377 if (lenp
lenpDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5
378 *
executed 5 times by 1 test: *lenp = 0;
Executed by:
  • Self test
lenp = 0;
executed 5 times by 1 test: *lenp = 0;
Executed by:
  • Self test
5
379 return
executed 5 times by 1 test: return (temp);
Executed by:
  • Self test
(temp);
executed 5 times by 1 test: return (temp);
Executed by:
  • Self test
5
380 }-
381}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2