Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/sh/strtrans.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
7 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
8 | ansicstr (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
| 0-2682 | ||||||||||||||||||||||||||||||||||||||||||||||||
17 | return never executed: ((char *)return ((char *) ((void *)0) ); 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
| 176-2506 | ||||||||||||||||||||||||||||||||||||||||||||||||
24 | temp = 12; executed 176 times by 1 test: temp = 12; Executed by:
| 176 | ||||||||||||||||||||||||||||||||||||||||||||||||
25 | ret = (char *)sh_xmalloc((temp), "strtrans.c", 66); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
29 | for (r = ret, s = string; s
| 0-9248 | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | c = *s++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | if (c != '\\'
| 0-4907 | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | * executed 1679 times by 1 test: r++ = c;*r++ = c; Executed by:
executed 1679 times by 1 test: *r++ = c; Executed by:
| 1679 | ||||||||||||||||||||||||||||||||||||||||||||||||
34 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
36 | switch (c = *s++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
39 | case executed 28 times by 1 test: 'a':case 'a': Executed by:
executed 28 times by 1 test: c = '\a'; break;case 'a': Executed by:
executed 28 times by 1 test: break; Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | case executed 16 times by 1 test: 'v':case 'v': Executed by:
executed 16 times by 1 test: c = '\v'; break;case 'v': Executed by:
executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
45 | case executed 18 times by 1 test: 'b':case 'b': Executed by:
executed 18 times by 1 test: c = '\b'; break;case 'b': Executed by:
executed 18 times by 1 test: break; Executed by:
| 18 | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | case executed 10 times by 1 test: 'e':case 'e': Executed by:
executed 10 times by 1 test: casecase 'e': Executed by:
executed 1 time by 1 test: 'E':case 'E': Executed by:
executed 1 time by 1 test: case 'E': Executed by:
| 1-10 | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | c = '\033'; break; executed 11 times by 1 test: break; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
48 | case executed 16 times by 1 test: 'f':case 'f': Executed by:
executed 16 times by 1 test: c = '\f'; break;case 'f': Executed by:
executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | case executed 218 times by 1 test: 'n':case 'n': Executed by:
executed 218 times by 1 test: c = '\n'; break;case 'n': Executed by:
executed 218 times by 1 test: break; Executed by:
| 218 | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | case executed 11 times by 1 test: 'r':case 'r': Executed by:
executed 11 times by 1 test: c = '\r'; break;case 'r': Executed by:
executed 11 times by 1 test: break; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | case executed 60 times by 1 test: 't':case 't': Executed by:
executed 60 times by 1 test: c = '\t'; break;case 't': Executed by:
executed 60 times by 1 test: break; Executed by:
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||
52 | case executed 293 times by 1 test: '1':case '1': Executed by:
executed 293 times by 1 test: casecase '1': Executed by:
executed 2093 times by 1 test: '2':case '2': Executed by:
executed 2093 times by 1 test: casecase '2': Executed by:
executed 1284 times by 1 test: '3':case '3': Executed by:
executed 1284 times by 1 test: case '3': Executed by:
| 293-2093 | ||||||||||||||||||||||||||||||||||||||||||||||||
53 | case never executed: '4':case '4': never executed: casecase '4': never executed: '5':case '5': never executed: casecase '5': never executed: '6':case '6': never executed: case '6': | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
54 | case never executed: '7':case '7': never executed: case '7': | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
56 | if (flags & 1
| 0-3670 | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | *r++ = '\\'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
62 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
63 | case executed 332 times by 1 test: '0':case '0': Executed by:
executed 332 times by 1 test: case '0': Executed by:
code before this statement executed 3670 times by 1 test: case '0': Executed by:
| 332-3670 | ||||||||||||||||||||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
68 | temp = 2 + ((
| 0-3995 | ||||||||||||||||||||||||||||||||||||||||||||||||
69 | for (c -= '0'; ((*
| 4-10112 | ||||||||||||||||||||||||||||||||||||||||||||||||
70 | c = (c * 8) + ((*s) - '0'); executed 7966 times by 1 test: c = (c * 8) + ((*s) - '0'); Executed by:
| 7966 | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | c &= 0xFF; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
72 | break; executed 4002 times by 1 test: break; Executed by:
| 4002 | ||||||||||||||||||||||||||||||||||||||||||||||||
73 | case executed 269 times by 1 test: 'x':case 'x': Executed by:
executed 269 times by 1 test: case 'x': Executed by:
| 269 | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | if ((
| 14-255 | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
76 | flags |= 16; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
77 | s++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
78 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
80 | for (temp = 2, c = 0; (1 && | - | ||||||||||||||||||||||||||||||||||||||||||||||||
81 | ((*
| 247-529 | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | (unsigned char)(unsigned char)*s
| 247-529 | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | ))] & (unsigned short int) _ISxdigit)
| 247-529 | ||||||||||||||||||||||||||||||||||||||||||||||||
84 | ) && temp--
| 22-507 | ||||||||||||||||||||||||||||||||||||||||||||||||
85 | c = (c * 16) + (((*
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:
| 0-507 | ||||||||||||||||||||||||||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
89 | if (flags & 16
| 16-253 | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | for ( ; (1 && | - | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | ((*
| 10-16 | ||||||||||||||||||||||||||||||||||||||||||||||||
93 | (unsigned char)(unsigned char)*s
| 10-16 | ||||||||||||||||||||||||||||||||||||||||||||||||
94 | ))] & (unsigned short int) _ISxdigit)
| 10-16 | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | ); s++) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | c = (c * 16) + (((*
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:
| 0-10 | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | flags &= ~16; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | if (*
| 6-10 | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | s++; executed 10 times by 1 test: s++; Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||
100 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
102 | else if (temp == 2
| 10-243 | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | *r++ = '\\'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | c = 'x'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | c &= 0xFF; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | break; executed 269 times by 1 test: break; Executed by:
| 269 | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
110 | case executed 81 times by 1 test: 'u':case 'u': Executed by:
executed 81 times by 1 test: case 'u': Executed by:
| 81 | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | case executed 26 times by 1 test: 'U':case 'U': Executed by:
executed 26 times by 1 test: case 'U': Executed by:
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||
112 | temp = (
| 26-81 | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | for (v = 0; (1 && | - | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | ((*
| 107-423 | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | (unsigned char)(unsigned char)*s
| 107-423 | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | ))] & (unsigned short int) _ISxdigit)
| 107-423 | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | ) && temp--
| 0-423 | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | v = (v * 16) + (((*
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:
| 0-423 | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | if (temp == ((
| 0-107 | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | *r++ = '\\'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
123 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | else if (v <= 0x7f
| 1-106 | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | c = v; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
130 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | temp = u32cconv (v, r); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
132 | r += temp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
133 | continue; executed 106 times by 1 test: continue; Executed by:
| 106 | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
136 | case executed 37 times by 1 test: '\\':case '\\': Executed by:
executed 37 times by 1 test: case '\\': Executed by:
| 37 | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | break; executed 37 times by 1 test: break; Executed by:
| 37 | ||||||||||||||||||||||||||||||||||||||||||||||||
138 | case executed 45 times by 1 test: '\'':case '\'': Executed by:
executed 45 times by 1 test: casecase '\'': Executed by:
executed 5 times by 1 test: '"':case '"': Executed by:
executed 5 times by 1 test: casecase '"': Executed by:
never executed: '?':case '?': never executed: case '?': | 0-45 | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | if (flags & 1
| 20-30 | ||||||||||||||||||||||||||||||||||||||||||||||||
140 | * executed 20 times by 1 test: r++ = '\\';*r++ = '\\'; Executed by:
executed 20 times by 1 test: *r++ = '\\'; Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
141 | break; executed 50 times by 1 test: break; Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||||||||||||||
142 | case executed 48 times by 1 test: 'c':case 'c': Executed by:
executed 48 times by 1 test: case 'c': Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | if (sawc
| 20-28 | ||||||||||||||||||||||||||||||||||||||||||||||||
144 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | *sawc = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
146 | *r = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | if (rlen
| 0-20 | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | * executed 20 times by 1 test: rlen = r - ret;*rlen = r - ret; Executed by:
executed 20 times by 1 test: *rlen = r - ret; Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
149 | return executed 20 times by 1 test: ret;return ret; Executed by:
executed 20 times by 1 test: return ret; Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||||||||||||||
150 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | else if ((
| 0-28 | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | ; never executed: ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | else if ((
| 0-28 | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | s++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | if ((
| 0-28 | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | s++; executed 3 times by 1 test: s++; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | c = ((
| 13-15 | ||||||||||||||||||||||||||||||||||||||||||||||||
159 | ((*
| 0-15 | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | (unsigned char)c
| 0-15 | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | ))] & (unsigned short int) _ISlower)
| 0-15 | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | ) ? | - | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | (__extension__ ({ int __res; if (sizeof (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | c
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | ) > 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | c
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | )
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
168 | c | - | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | ); __res = __c < -128
never executed: else __res = toupper (end of block never executed: __res = toupper ( c ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
170 | c never executed: __res = toupper ( c ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
171 | ); never executed: } else __res = (*__ctype_toupper_loc ())[(int) (__res = toupper ( c ); never executed: __res = (*__ctype_toupper_loc ())[(int) ( c )]; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | c never executed: __res = (*__ctype_toupper_loc ())[(int) ( c )]; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | )]; never executed: __res; })) __res = (*__ctype_toupper_loc ())[(int) ( c )]; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | : (c)) & 0x1f)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | break; executed 28 times by 1 test: break; Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
178 | default executed 16 times by 1 test: default: Executed by:
code before this statement never executed: default: executed 16 times by 1 test: :default: Executed by:
code before this statement never executed: default: executed 16 times by 1 test: default: Executed by:
| 0-16 | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | if ((
| 0-16 | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | * executed 16 times by 1 test: r++ = '\\';*r++ = '\\'; Executed by:
executed 16 times by 1 test: *r++ = '\\'; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
181 | break; executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||||||||||||||
182 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
183 | if ((
| 61-4720 | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | * executed 501 times by 1 test: r++ = '\001';*r++ = '\001'; Executed by:
executed 501 times by 1 test: *r++ = '\001'; Executed by:
| 501 | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | *r++ = c; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
186 | } executed 4781 times by 1 test: end of block Executed by:
| 4781 | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
188 | *r = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
189 | if (rlen
| 11-2651 | ||||||||||||||||||||||||||||||||||||||||||||||||
190 | * executed 2651 times by 1 test: rlen = r - ret;*rlen = r - ret; Executed by:
executed 2651 times by 1 test: *rlen = r - ret; Executed by:
| 2651 | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | return executed 2662 times by 1 test: ret;return ret; Executed by:
executed 2662 times by 1 test: return ret; Executed by:
| 2662 | ||||||||||||||||||||||||||||||||||||||||||||||||
192 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
196 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
197 | ansic_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
| 0-198 | ||||||||||||||||||||||||||||||||||||||||||||||||
211 | return never executed: ((char *)0);return ((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
| 198-337 | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | b = l = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
223 | clen = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
225 | switch (c) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | case never executed: '\033':case '\033': never executed: c = 'E'; break;case '\033': never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
229 | case executed 6 times by 1 test: '\a':case '\a': Executed by:
executed 6 times by 1 test: c = 'a'; break;case '\a': Executed by:
executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | case never executed: '\v':case '\v': never executed: c = 'v'; break;case '\v': never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
233 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
236 | case never executed: '\b':case '\b': never executed: c = 'b'; break;case '\b': never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | case never executed: '\f':case '\f': never executed: c = 'f'; break;case '\f': never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | case executed 12 times by 1 test: '\n':case '\n': Executed by:
executed 12 times by 1 test: c = 'n'; break;case '\n': Executed by:
executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | case never executed: '\r':case '\r': never executed: c = 'r'; break;case '\r': never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | case executed 11 times by 1 test: '\t':case '\t': Executed by:
executed 11 times by 1 test: c = 't'; break;case '\t': Executed by:
executed 11 times by 1 test: break; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | case executed 6 times by 1 test: '\\':case '\\': Executed by:
executed 6 times by 1 test: case '\\': Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | case never executed: '\'':case '\'': never executed: case '\'': | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||||||||||||||
244 | default executed 302 times by 1 test: :default: Executed by:
executed 302 times by 1 test: default: Executed by:
| 302 | ||||||||||||||||||||||||||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
246 | b = is_basic (c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
248 | if ((b == 0
| 0-246 | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | (__ctype_get_mb_cur_max ())
| 0-246 | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | , 0)) < 0
| 0-246 | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | (b == 1
| 0-56 | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | ((*
| 0-56 | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | (unsigned char)c
| 0-56 | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | ))] & (unsigned short int) _ISprint)
| 0-56 | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | ) == 0
| 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:
| 242 | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
266 | l = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | break; executed 60 times by 1 test: break; Executed by:
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | if (b == 0
| 0-91 | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
271 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
272 | if (l
| 35-60 | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | * executed 35 times by 1 test: r++ = '\\';*r++ = '\\'; Executed by:
executed 35 times by 1 test: *r++ = '\\'; Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
275 | if (clen == 1
| 0-95 | ||||||||||||||||||||||||||||||||||||||||||||||||
276 | * executed 95 times by 1 test: r++ = c;*r++ = c; Executed by:
executed 95 times by 1 test: *r++ = c; Executed by:
| 95 | ||||||||||||||||||||||||||||||||||||||||||||||||
277 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
278 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
279 | for (b = 0; b < (int)clen
| 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
| 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: ret;return ret; Executed by:
executed 198 times by 1 test: return ret; Executed by:
| 198 | ||||||||||||||||||||||||||||||||||||||||||||||||
290 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
293 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
294 | ansic_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
| 131-168 | ||||||||||||||||||||||||||||||||||||||||||||||||
307 | return executed 131 times by 1 test: 1;return 1; Executed by:
executed 131 times by 1 test: return 1; Executed by:
| 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
| 112-294 | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | if (iswprint(wcc) == 0
| 56-238 | ||||||||||||||||||||||||||||||||||||||||||||||||
314 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
315 | sh_xfree((wcstr), "strtrans.c", 320); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
316 | return executed 56 times by 1 test: 1;return 1; Executed by:
executed 56 times by 1 test: return 1; Executed by:
| 56 | ||||||||||||||||||||||||||||||||||||||||||||||||
317 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
319 | sh_xfree((wcstr), "strtrans.c", 324); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
320 | return executed 112 times by 1 test: 0;return 0; Executed by:
executed 112 times by 1 test: return 0; Executed by:
| 112 | ||||||||||||||||||||||||||||||||||||||||||||||||
321 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
324 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
325 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | ansic_shouldquote (string) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | const char *string; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
328 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
329 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
330 | unsigned char c; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
332 | if (string == 0
| 0-2088 | ||||||||||||||||||||||||||||||||||||||||||||||||
333 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
335 | for (s = string; c = *s
| 1778-11447 | ||||||||||||||||||||||||||||||||||||||||||||||||
336 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
338 | if (is_basic (c) == 0
| 299-11148 | ||||||||||||||||||||||||||||||||||||||||||||||||
339 | return executed 299 times by 1 test: (ansic_wshouldquote (s));return (ansic_wshouldquote (s)); Executed by:
executed 299 times by 1 test: return (ansic_wshouldquote (s)); Executed by:
| 299 | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
341 | if ((
| 11-11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
342 | ((*
| 11-11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
343 | (unsigned char)c
| 11-11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
344 | ))] & (unsigned short int) _ISprint)
| 11-11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
345 | ) == 0
| 11-11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
346 | return executed 11 times by 1 test: 1;return 1; Executed by:
executed 11 times by 1 test: return 1; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||
347 | } executed 11137 times by 1 test: end of block Executed by:
| 11137 | ||||||||||||||||||||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
349 | return executed 1778 times by 1 test: 0;return 0; Executed by:
executed 1778 times by 1 test: return 0; Executed by:
| 1778 | ||||||||||||||||||||||||||||||||||||||||||||||||
350 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
351 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
353 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
354 | char * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
355 | ansiexpand (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
| 2608-20079 | ||||||||||||||||||||||||||||||||||||||||||||||||
364 | temp[tlen++] = string[len++]; executed 20079 times by 1 test: temp[tlen++] = string[len++]; Executed by:
| 20079 | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | temp[tlen] = '\0'; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
367 | if (*
| 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: (t);return (t); Executed by:
executed 2603 times by 1 test: return (t); Executed by:
| 2603 | ||||||||||||||||||||||||||||||||||||||||||||||||
374 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
375 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
376 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | if (lenp
| 0-5 | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | * executed 5 times by 1 test: lenp = 0;*lenp = 0; Executed by:
executed 5 times by 1 test: *lenp = 0; Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
379 | return executed 5 times by 1 test: (temp);return (temp); Executed by:
executed 5 times by 1 test: return (temp); Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |