| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/quotearg.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | struct quoting_options | - | ||||||||||||||||||
| 11 | { | - | ||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | enum quoting_style style; | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | int flags; | - | ||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | unsigned int quote_these_too[( | - | ||||||||||||||||||
| 21 | (0x7f * 2 + 1) | - | ||||||||||||||||||
| 22 | / (sizeof (int) * 8)) + 1]; | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | char const *left_quote; | - | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | char const *right_quote; | - | ||||||||||||||||||
| 29 | }; | - | ||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | - | |||||||||||||||||||
| 32 | char const *const quoting_style_args[] = | - | ||||||||||||||||||
| 33 | { | - | ||||||||||||||||||
| 34 | "literal", | - | ||||||||||||||||||
| 35 | "shell", | - | ||||||||||||||||||
| 36 | "shell-always", | - | ||||||||||||||||||
| 37 | "shell-escape", | - | ||||||||||||||||||
| 38 | "shell-escape-always", | - | ||||||||||||||||||
| 39 | "c", | - | ||||||||||||||||||
| 40 | "c-maybe", | - | ||||||||||||||||||
| 41 | "escape", | - | ||||||||||||||||||
| 42 | "locale", | - | ||||||||||||||||||
| 43 | "clocale", | - | ||||||||||||||||||
| 44 | 0 | - | ||||||||||||||||||
| 45 | }; | - | ||||||||||||||||||
| 46 | - | |||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | enum quoting_style const quoting_style_vals[] = | - | ||||||||||||||||||
| 49 | { | - | ||||||||||||||||||
| 50 | literal_quoting_style, | - | ||||||||||||||||||
| 51 | shell_quoting_style, | - | ||||||||||||||||||
| 52 | shell_always_quoting_style, | - | ||||||||||||||||||
| 53 | shell_escape_quoting_style, | - | ||||||||||||||||||
| 54 | shell_escape_always_quoting_style, | - | ||||||||||||||||||
| 55 | c_quoting_style, | - | ||||||||||||||||||
| 56 | c_maybe_quoting_style, | - | ||||||||||||||||||
| 57 | escape_quoting_style, | - | ||||||||||||||||||
| 58 | locale_quoting_style, | - | ||||||||||||||||||
| 59 | clocale_quoting_style | - | ||||||||||||||||||
| 60 | }; | - | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | - | |||||||||||||||||||
| 63 | static struct quoting_options default_quoting_options; | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | - | |||||||||||||||||||
| 68 | struct quoting_options * | - | ||||||||||||||||||
| 69 | clone_quoting_options (struct quoting_options *o) | - | ||||||||||||||||||
| 70 | { | - | ||||||||||||||||||
| 71 | int e = | - | ||||||||||||||||||
| 72 | (*__errno_location ()) | - | ||||||||||||||||||
| 73 | ; | - | ||||||||||||||||||
| 74 | struct quoting_options *p = xmemdup (o ? o : &default_quoting_options, | - | ||||||||||||||||||
| 75 | sizeof *o); | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | (*__errno_location ()) | - | ||||||||||||||||||
| 78 | = e; | - | ||||||||||||||||||
| 79 | return p; | - | ||||||||||||||||||
| 80 | } | 2332 | ||||||||||||||||||
| 81 | - | |||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | enum quoting_style | - | ||||||||||||||||||
| 84 | get_quoting_style (struct quoting_options const *o) | - | ||||||||||||||||||
| 85 | { | - | ||||||||||||||||||
| 86 | return (o ? o : &default_quoting_options)->style; | - | ||||||||||||||||||
| 87 | } | 2349 | ||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | void | - | ||||||||||||||||||
| 92 | set_quoting_style (struct quoting_options *o, enum quoting_style s) | - | ||||||||||||||||||
| 93 | { | - | ||||||||||||||||||
| 94 | (o ? o : &default_quoting_options)->style = s; | - | ||||||||||||||||||
| 95 | } | - | ||||||||||||||||||
| 96 | 236 | |||||||||||||||||||
| 97 | - | |||||||||||||||||||
| 98 | - | |||||||||||||||||||
| 99 | - | |||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | int | - | ||||||||||||||||||
| 103 | set_char_quoting (struct quoting_options *o, char c, int i) | - | ||||||||||||||||||
| 104 | { | - | ||||||||||||||||||
| 105 | unsigned char uc = c; | - | ||||||||||||||||||
| 106 | unsigned int *p = | - | ||||||||||||||||||
| 107 | (o ? o : &default_quoting_options)->quote_these_too + uc / (sizeof (int) * 8); | - | ||||||||||||||||||
| 108 | int
| 0-1365 | ||||||||||||||||||
| 109 | int r = (*p >> shift) & 1; | - | ||||||||||||||||||
| 110 | *p ^= ((i & 1) ^ r) << shift; | - | ||||||||||||||||||
| 111 | return r; | - | ||||||||||||||||||
| 112 | } | 1365 | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | int | - | ||||||||||||||||||
| 119 | set_quoting_flags (struct quoting_options *o, int i) | - | ||||||||||||||||||
| 120 | { | - | ||||||||||||||||||
| 121 | int r; | - | ||||||||||||||||||
| 122 | if (!o) | - | ||||||||||||||||||
| 123 | o =
| 0 | ||||||||||||||||||
| 124 | r = never executed: o->flags;= o->flags;never executed: = o->flags; | 0 | ||||||||||||||||||
| 125 | o->flags = i; | - | ||||||||||||||||||
| 126 | return r; | - | ||||||||||||||||||
| 127 | } | 0 | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | void | - | ||||||||||||||||||
| 130 | set_custom_quoting (struct quoting_options *o, | - | ||||||||||||||||||
| 131 | char const *left_quote, char const *right_quote) | - | ||||||||||||||||||
| 132 | { | - | ||||||||||||||||||
| 133 | if (!o) | - | ||||||||||||||||||
| 134 | o =
| 0 | ||||||||||||||||||
| 135 | o-> never executed: style = custom_quoting_style>style = custom_quoting_stylenever executed: ;>style = custom_quoting_style | 0 | ||||||||||||||||||
| 136 | if (!left_quote || !right_quote) | - | ||||||||||||||||||
| 137 | abort ();
| 0 | ||||||||||||||||||
| 138 | o-> never executed: left_quo>left_quonever executed: te = left_quote;>left_quo | 0 | ||||||||||||||||||
| 139 | o->right_quote = right_quote; | - | ||||||||||||||||||
| 140 | } | - | ||||||||||||||||||
| 141 | 0 | |||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | static struct quoting_options | - | ||||||||||||||||||
| 144 | quoting_options_from_style (enum quoting_style style) | - | ||||||||||||||||||
| 145 | { | - | ||||||||||||||||||
| 146 | struct quoting_options o = { literal_quoting_style, 0, { 0 }, | - | ||||||||||||||||||
| 147 | ((void *)0) | - | ||||||||||||||||||
| 148 | , | - | ||||||||||||||||||
| 149 | ((void *)0) | - | ||||||||||||||||||
| 150 | }; | - | ||||||||||||||||||
| 151 | if (style == custom_quoting_style) | - | ||||||||||||||||||
| 152 | abort ();
| 0-1443 | ||||||||||||||||||
| 153 | o.style = s never executed: tyle;style = s | 0 | ||||||||||||||||||
| 154 | return o; | - | ||||||||||||||||||
| 155 | } | 1443 | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | - | |||||||||||||||||||
| 161 | static char const * | - | ||||||||||||||||||
| 162 | gettext_quote (char const *msgid, enum quoting_style s) | - | ||||||||||||||||||
| 163 | { | - | ||||||||||||||||||
| 164 | char const *translation = | - | ||||||||||||||||||
| 165 | dcgettext (((void *)0), | - | ||||||||||||||||||
| 166 | msgid | - | ||||||||||||||||||
| 167 | , 5) | - | ||||||||||||||||||
| 168 | ; | - | ||||||||||||||||||
| 169 | char const *locale_code; | - | ||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | if (translation != msgid) | - | ||||||||||||||||||
| 172 | return
| 0-1638 | ||||||||||||||||||
| 173 | locale_code = locale_ never executed: charset ();cale_code = locale_ | 0 | ||||||||||||||||||
| 174 | if (strcaseeq0 (locale_code, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0)) | - | ||||||||||||||||||
| 175 | return
| 0-1638 | ||||||||||||||||||
| 176 | if (strcaseeq0 (locale_code, "GB18030", 'G', 'B', '1', '8' never executed: , '0', '3', '0', 0, 0))(strcaseeq0 (locale_code, "GB18030", 'G', 'B', '1', '8' | 0 | ||||||||||||||||||
| 177 | return
| 0-1638 | ||||||||||||||||||
| 178 | 0 | |||||||||||||||||||
| 179 | return (s == clocale_quoting_style ? "\"" : "'"); | - | ||||||||||||||||||
| 180 | } | 1638 | ||||||||||||||||||
| 181 | static size_t | - | ||||||||||||||||||
| 182 | quotearg_buffer_restyled (char *buffer, size_t buffersize, | - | ||||||||||||||||||
| 183 | char const *arg, size_t argsize, | - | ||||||||||||||||||
| 184 | enum quoting_style quoting_style, int flags, | - | ||||||||||||||||||
| 185 | unsigned int const *quote_these_too, | - | ||||||||||||||||||
| 186 | char const *left_quote, | - | ||||||||||||||||||
| 187 | char const *right_quote) | - | ||||||||||||||||||
| 188 | { | - | ||||||||||||||||||
| 189 | size_t i; | - | ||||||||||||||||||
| 190 | size_t len = 0; | - | ||||||||||||||||||
| 191 | size_t orig_buffersize = 0; | - | ||||||||||||||||||
| 192 | char const *quote_string = 0; | - | ||||||||||||||||||
| 193 | size_t quote_string_len = 0; | - | ||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | _Bool | - | ||||||||||||||||||
| 196 | backslash_escapes = | - | ||||||||||||||||||
| 197 | 0 | - | ||||||||||||||||||
| 198 | ; | - | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | _Bool | - | ||||||||||||||||||
| 201 | unibyte_locale = | - | ||||||||||||||||||
| 202 | (__ctype_get_mb_cur_max ()) | - | ||||||||||||||||||
| 203 | == 1; | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | _Bool | - | ||||||||||||||||||
| 206 | elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0; | - | ||||||||||||||||||
| 207 | - | |||||||||||||||||||
| 208 | _Bool | - | ||||||||||||||||||
| 209 | pending_shell_escape_end = | - | ||||||||||||||||||
| 210 | 0 | - | ||||||||||||||||||
| 211 | ; | - | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | _Bool | - | ||||||||||||||||||
| 214 | encountered_single_quote = | - | ||||||||||||||||||
| 215 | 0 | - | ||||||||||||||||||
| 216 | ; | - | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | _Bool | - | ||||||||||||||||||
| 219 | all_c_and_shell_quote_compat = | - | ||||||||||||||||||
| 220 | 1 | - | ||||||||||||||||||
| 221 | ; | - | ||||||||||||||||||
| 222 | process_input: | - | ||||||||||||||||||
| 223 | 3544 | |||||||||||||||||||
| 224 | switch (quoting_style) | - | ||||||||||||||||||
| 225 | { | - | ||||||||||||||||||
| 226 | case c_maybe_quoting_style: | - | ||||||||||||||||||
| 227 | quoting_style = c_quoting executed 2 times by 1 test: _style;quoting_style = c_quotingExecuted by:
| 2 | ||||||||||||||||||
| 228 | elide_outer_quotes = | - | ||||||||||||||||||
| 229 | 1 | - | ||||||||||||||||||
| 230 | ; | - | ||||||||||||||||||
| 231 | ((void) 0); | - | ||||||||||||||||||
| 232 | case c_quoting_style: | - | ||||||||||||||||||
| 233 | if (!elide_outer_qu executed 10 times by 3 tests: if (!elide_outer_quExecuted by:
code before this statement executed 2 times by 1 test: otes)if (!elide_outer_quExecuted by:
| 2-10 | ||||||||||||||||||
| 234 | do { if (len < buffer
| 2-10 | ||||||||||||||||||
| 235 | backslash_escapes =
| 0-10 | ||||||||||||||||||
| 236 | 1 | - | ||||||||||||||||||
| 237 | ; | - | ||||||||||||||||||
| 238 | quote_string = "\""; | - | ||||||||||||||||||
| 239 | quote_string_len = 1; | - | ||||||||||||||||||
| 240 | break; | - | ||||||||||||||||||
| 241 | 12 | |||||||||||||||||||
| 242 | case escape_quoting_style: | - | ||||||||||||||||||
| 243 | backslash_escapes = executed 46 times by 3 tests: backslash_escapes =Executed by:
| 46 | ||||||||||||||||||
| 244 | 1 | - | ||||||||||||||||||
| 245 | ; | - | ||||||||||||||||||
| 246 | elide_outer_quotes = | - | ||||||||||||||||||
| 247 | 0 | - | ||||||||||||||||||
| 248 | ; | - | ||||||||||||||||||
| 249 | break; | - | ||||||||||||||||||
| 250 | 46 | |||||||||||||||||||
| 251 | case locale_quoting_style: | - | ||||||||||||||||||
| 252 | case executed 815 times by 58 tests: clocale_quoting_stylecase clocale_quoting_styleExecuted by:
executed 815 times by 58 tests: :case clocale_quoting_styleExecuted by:
| 815 | ||||||||||||||||||
| 253 | case executed 4 times by 1 test: custom_quoting_style:case custom_quoting_style:Executed by:
executed 4 times by 1 test: case custom_quoting_style:Executed by:
| 4 | ||||||||||||||||||
| 254 | { never executed: { | 0 | ||||||||||||||||||
| 255 | if (quoting_style != custom_quoting_style) | - | ||||||||||||||||||
| 256 | { | 0-819 | ||||||||||||||||||
| 257 | left_quote = gettext_quote ("`", quoting_style); | - | ||||||||||||||||||
| 258 | right_quote = gettext_quote ("'", quoting_style); | - | ||||||||||||||||||
| 259 | } | - | ||||||||||||||||||
| 260 | if executed 819 times by 58 tests (!elide_outer_quotes)Executed by:
| 819 | ||||||||||||||||||
| 261 | for
| 0-819 | ||||||||||||||||||
| 262 | do { if (len < buffersize) buffer[len] = (*
| 819 | ||||||||||||||||||
| 263 | backslash_escapes =
| 67-819 | ||||||||||||||||||
| 264 | 1 | - | ||||||||||||||||||
| 265 | ; | - | ||||||||||||||||||
| 266 | quote_string = right_quote; | - | ||||||||||||||||||
| 267 | quote_string_len = strlen (quote_string); | - | ||||||||||||||||||
| 268 | } | - | ||||||||||||||||||
| 269 | break; | - | ||||||||||||||||||
| 270 | 819 | |||||||||||||||||||
| 271 | case shell_escape_quoting_style: | - | ||||||||||||||||||
| 272 | backslash_escapes = executed 145 times by 25 tests: backslash_escapes =Executed by:
| 145 | ||||||||||||||||||
| 273 | 1 | - | ||||||||||||||||||
| 274 | ; | - | ||||||||||||||||||
| 275 | ((void) 0); | - | ||||||||||||||||||
| 276 | case shell_quoting_style: | - | ||||||||||||||||||
| 277 | elide_outer_quotes = executed 4 times by 1 test: elide_outer_quotes =Executed by:
code before this statement executed 145 times by 25 tests: elide_outer_quotes =Executed by:
| 4-145 | ||||||||||||||||||
| 278 | 1 | - | ||||||||||||||||||
| 279 | ; | - | ||||||||||||||||||
| 280 | ((void) 0); | - | ||||||||||||||||||
| 281 | case shell_escape_always_quoting_style: | - | ||||||||||||||||||
| 282 | if (!elide_outer_quotes) executed 1407 times by 31 tests: if (!elide_outer_quotes)Executed by:
code before this statement executed 149 times by 25 tests: if (!elide_outer_quotes)Executed by:
| 149-1407 | ||||||||||||||||||
| 283 | backslash_escapes =
| 149-1407 | ||||||||||||||||||
| 284 | 1 executed 1407 times by 31 tests: 1 ; ((void) 0);Executed by:
| 1407 | ||||||||||||||||||
| 285 | ; executed 1407 times by 31 tests: 1 ; ((void) 0);Executed by:
| 1407 | ||||||||||||||||||
| 286 | ((void) 0); executed 1407 times by 31 tests: 1 ; ((void) 0);Executed by:
| 1407 | ||||||||||||||||||
| 287 | case shell_always_quoting_style: | - | ||||||||||||||||||
| 288 | quoting_style = shell_always_q executed 4 times by 1 test: quoting_style = shell_always_qExecuted by:
code before this statement executed 1556 times by 41 tests: uoting_style;quoting_style = shell_always_qExecuted by:
| 4-1556 | ||||||||||||||||||
| 289 | if (!elide_outer_quotes) | - | ||||||||||||||||||
| 290 | do { if (len < buffer
| 149-1411 | ||||||||||||||||||
| 291 | quote_string = "'";
| 125-1411 | ||||||||||||||||||
| 292 | quote_string_len = 1; | - | ||||||||||||||||||
| 293 | break; | - | ||||||||||||||||||
| 294 | 1560 | |||||||||||||||||||
| 295 | case literal_quoting_style: | - | ||||||||||||||||||
| 296 | elide_outer_quotes = executed 1107 times by 2 tests: elide_outer_quotes =Executed by:
| 1107 | ||||||||||||||||||
| 297 | 0 | - | ||||||||||||||||||
| 298 | ; | - | ||||||||||||||||||
| 299 | break; | - | ||||||||||||||||||
| 300 | 1107 | |||||||||||||||||||
| 301 | default: | - | ||||||||||||||||||
| 302 | abort never executed: ();abort | 0 | ||||||||||||||||||
| 303 | } | 0 | ||||||||||||||||||
| 304 | - | |||||||||||||||||||
| 305 | for (i = 0; ! (argsize == | - | ||||||||||||||||||
| 306 | (18446744073709551615UL)
| 0-42132 | ||||||||||||||||||
| 307 | ? arg[i] == '\0
| 0-42132 | ||||||||||||||||||
| 308 | {
| 3520-42132 | ||||||||||||||||||
| 309 | unsigned char c; | - | ||||||||||||||||||
| 310 | unsigned char esc; | - | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | _Bool | - | ||||||||||||||||||
| 313 | is_right_quote = | - | ||||||||||||||||||
| 314 | 0 | - | ||||||||||||||||||
| 315 | ; | - | ||||||||||||||||||
| 316 | - | |||||||||||||||||||
| 317 | _Bool | - | ||||||||||||||||||
| 318 | escaping = | - | ||||||||||||||||||
| 319 | 0 | - | ||||||||||||||||||
| 320 | ; | - | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | _Bool | - | ||||||||||||||||||
| 323 | c_and_shell_quote_compat = | - | ||||||||||||||||||
| 324 | 0 | - | ||||||||||||||||||
| 325 | ; | - | ||||||||||||||||||
| 326 | - | |||||||||||||||||||
| 327 | if (backslash_escapes | - | ||||||||||||||||||
| 328 | &&
| 14648-27484 | ||||||||||||||||||
| 329 | && quote_string_len
| 5270-9378 | ||||||||||||||||||
| 330 | && (
| 292-4978 | ||||||||||||||||||
| 331 | <= (argsize ==
| 0-4978 | ||||||||||||||||||
| 332 | (18446744073709551615UL)
| 0-4978 | ||||||||||||||||||
| 333 | && 1 < quote_st
| 0-4978 | ||||||||||||||||||
| 334 | 0-4978 | |||||||||||||||||||
| 335 | 0-4978 | |||||||||||||||||||
| 336 | 0-4978 | |||||||||||||||||||
| 337 | ? (argsize = strlen (arg)) : argsize))
| 0-4978 | ||||||||||||||||||
| 338 | && memcmp (arg + i, quote_string, quote_string
| 0-4978 | ||||||||||||||||||
| 339 | { | 2-4976 | ||||||||||||||||||
| 340 | if (elide_outer_quotes) | - | ||||||||||||||||||
| 341 | goto
| 0-2 | ||||||||||||||||||
| 342 | is_right_quote = never executed: _right_quote = | 0 | ||||||||||||||||||
| 343 | 1 | - | ||||||||||||||||||
| 344 | ; | - | ||||||||||||||||||
| 345 | } | - | ||||||||||||||||||
| 346 | 2 | |||||||||||||||||||
| 347 | c = arg[i]; | - | ||||||||||||||||||
| 348 | switch (c) | - | ||||||||||||||||||
| 349 | { | - | ||||||||||||||||||
| 350 | case '\0': | - | ||||||||||||||||||
| 351 | if (back never executed: slash_escapes)if (back | 0 | ||||||||||||||||||
| 352 | { | 0 | ||||||||||||||||||
| 353 | do { if (elide_outer_quotes) goto force_outer_quoting_style; escaping = | - | ||||||||||||||||||
| 354 | 1 | 0 | ||||||||||||||||||
| 355 | ; if (quoting_style == shell_always_quoting_style && ! pending_shell_escape_end) { do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); do { if (len < buffersize) buffer[len] = ('$'); len++; } while (0); do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); pending_shell_escape_end = | - | ||||||||||||||||||
| 356 | 1 | 0 | ||||||||||||||||||
| 357 | ; } do { if (len < buffersize) buffer[len] = ('\\'); len++; } while (0); } while (0); | - | ||||||||||||||||||
| 358 | 0 | |||||||||||||||||||
| 359 | - | |||||||||||||||||||
| 360 | - | |||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | - | |||||||||||||||||||
| 364 | if (quoting_style != shell_always_quoting_style | - | ||||||||||||||||||
| 365 | &&
| 0 | ||||||||||||||||||
| 366 | { | 0 | ||||||||||||||||||
| 367 | do { if (len < buffersize) buffer[len] = ('0'); len++; } while (0); | - | ||||||||||||||||||
| 368 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('0'); | 0 | ||||||||||||||||||
| 369 | } | 0 | ||||||||||||||||||
| 370 | c = never executed: '0';= | 0 | ||||||||||||||||||
| 371 | - | |||||||||||||||||||
| 372 | - | |||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | } | - | ||||||||||||||||||
| 376 | els never executed: e if (flags & QA_ELIDE_NULL_BYTES)s | 0 | ||||||||||||||||||
| 377 | continue;
| 0 | ||||||||||||||||||
| 378 | break; never executed: eak; | 0 | ||||||||||||||||||
| 379 | 0 | |||||||||||||||||||
| 380 | case '?': | - | ||||||||||||||||||
| 381 | switch executed 10 times by 1 test: (quoting_style)switchExecuted by:
| 10 | ||||||||||||||||||
| 382 | { | - | ||||||||||||||||||
| 383 | case shell_always_quoting_style: | - | ||||||||||||||||||
| 384 | if (elide_outer_quotes) executed 10 times by 1 test: if (elide_outer_quotes)Executed by:
| 10 | ||||||||||||||||||
| 385 | goto
| 0-10 | ||||||||||||||||||
| 386 | break; never executed: eak; | 0 | ||||||||||||||||||
| 387 | 10 | |||||||||||||||||||
| 388 | case c_quoting_style: | - | ||||||||||||||||||
| 389 | if ((flags & QA_SPL never executed: IT_TRIGRAPHS)if ((flags & QA_SPL | 0 | ||||||||||||||||||
| 390 | &&
| 0 | ||||||||||||||||||
| 391 | switch
| 0 | ||||||||||||||||||
| 392 | { | - | ||||||||||||||||||
| 393 | case '!': case '\'': | - | ||||||||||||||||||
| 394 | case never executed: '(':case '(':never executed: casecase '(':never executed: ')': case ')':never executed: case '-': case '/':case ')': | 0 | ||||||||||||||||||
| 395 | case never executed: '<':case '<':never executed: casecase '<':never executed: '=':case '=':never executed: casecase '=':never executed: '>':case '>':never executed: case '>': | 0 | ||||||||||||||||||
| 396 | 0 | |||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | if (elide_outer_quotes) | - | ||||||||||||||||||
| 399 | goto
| 0 | ||||||||||||||||||
| 400 | c = never executed: arg[i + 2];= arg[i + 2];never executed: = arg[i + 2]; | 0 | ||||||||||||||||||
| 401 | i += 2; | - | ||||||||||||||||||
| 402 | do { if (len < buffersize) buffer[len] = ('?'); len++; } while (0); | - | ||||||||||||||||||
| 403 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('"'); | 0 | ||||||||||||||||||
| 404 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('"'); | 0 | ||||||||||||||||||
| 405 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('?'); | 0 | ||||||||||||||||||
| 406 | break; | 0 | ||||||||||||||||||
| 407 | 0 | |||||||||||||||||||
| 408 | default: | - | ||||||||||||||||||
| 409 | break; never executed: break; | 0 | ||||||||||||||||||
| 410 | } | 0 | ||||||||||||||||||
| 411 | break; | - | ||||||||||||||||||
| 412 | 0 | |||||||||||||||||||
| 413 | default: | - | ||||||||||||||||||
| 414 | break; never executed: break; | 0 | ||||||||||||||||||
| 415 | } | 0 | ||||||||||||||||||
| 416 | break; | - | ||||||||||||||||||
| 417 | 10 | |||||||||||||||||||
| 418 | case '\a': esc = 'a'; goto c_escape; | - | ||||||||||||||||||
| 419 | case executed 44 times by 1 test: '\b':case '\b':Executed by:
executed 44 times by 1 test: esc = 'b'; gotocase '\b':Executed by:
executed 44 times by 1 test: c_escape;goto c_escape;Executed by:
executed 44 times by 1 test: goto c_escape;Executed by:
| 44 | ||||||||||||||||||
| 420 | case never executed: '\f':case '\f':never executed: esc = 'f'; gotocase '\f':never executed: c_escape;goto c_escape;never executed: goto c_escape; | 0 | ||||||||||||||||||
| 421 | case never executed: '\n':case '\n':never executed: esc = 'n'; gotocase '\n':never executed: c_and_shegoto c_and_shenever executed: ll_escape;goto c_and_she | 0 | ||||||||||||||||||
| 422 | case executed 2 times by 1 test: '\r':case '\r':Executed by:
executed 2 times by 1 test: esc = 'r'; gotocase '\r':Executed by:
executed 2 times by 1 test: c_and_shell_escape;goto c_and_shell_escape;Executed by:
executed 2 times by 1 test: goto c_and_shell_escape;Executed by:
| 2 | ||||||||||||||||||
| 423 | case executed 2 times by 1 test: '\t':case '\t':Executed by:
executed 2 times by 1 test: esc = 't'; gotocase '\t':Executed by:
executed 2 times by 1 test: c_and_shell_escape;goto c_and_shell_escape;Executed by:
executed 2 times by 1 test: goto c_and_shell_escape;Executed by:
| 2 | ||||||||||||||||||
| 424 | case never executed: '\v':case '\v':never executed: esc = 'v'; gotocase '\v':never executed: c_escape;goto c_escape;never executed: goto c_escape; | 0 | ||||||||||||||||||
| 425 | case never executed: '\\':case '\\':never executed: esc = c;case '\\': | 0 | ||||||||||||||||||
| 426 | 2 | |||||||||||||||||||
| 427 | if (quoting_style == shell_always_quoting_style) | - | ||||||||||||||||||
| 428 | { | 0-2 | ||||||||||||||||||
| 429 | if (elide_outer_quotes) | - | ||||||||||||||||||
| 430 | goto
| 0 | ||||||||||||||||||
| 431 | goto never executed: store_c;to store_c;never executed: to store_c; | 0 | ||||||||||||||||||
| 432 | } | 0 | ||||||||||||||||||
| 433 | - | |||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | - | |||||||||||||||||||
| 436 | if (backslash_escapes && elide_outer_quotes && quote_string_len) | - | ||||||||||||||||||
| 437 | goto
| 0-2 | ||||||||||||||||||
| 438 | 2 | |||||||||||||||||||
| 439 | c_and_shell_escape: | - | ||||||||||||||||||
| 440 | if (quoting_style code before this statement never executed: == shell_always_quoting_styleif (quoting_style | 0 | ||||||||||||||||||
| 441 | &&
| 0-4 | ||||||||||||||||||
| 442 | goto force_outer_quotin
| 2 | ||||||||||||||||||
| 443 | 2 | |||||||||||||||||||
| 444 | c_escape: | - | ||||||||||||||||||
| 445 | if (bac code before this statement executed 2 times by 2 tests: kslash_escapes)if (bacExecuted by:
| 2 | ||||||||||||||||||
| 446 | { | 18-28 | ||||||||||||||||||
| 447 | c = esc; | - | ||||||||||||||||||
| 448 | goto store_escape; | - | ||||||||||||||||||
| 449 | } | 28 | ||||||||||||||||||
| 450 | break; | - | ||||||||||||||||||
| 451 | 18 | |||||||||||||||||||
| 452 | case '{': case '}': | - | ||||||||||||||||||
| 453 | if (! ( never executed: argsize ==if (! (never executed: rgsize == | 0 | ||||||||||||||||||
| 454 | (18446744073709551615UL)
| 0 | ||||||||||||||||||
| 455 | ? arg[1] == '\0
| 0 | ||||||||||||||||||
| 456 | break;
| 0 | ||||||||||||||||||
| 457 | ((void) never executed: 0);void) | 0 | ||||||||||||||||||
| 458 | case '#': case '~': | - | ||||||||||||||||||
| 459 | if (i ! never executed: if (i !code before this statement never executed: = 0)if (i !executed 21 times by 4 tests: 0)Executed by:
| 0-21 | ||||||||||||||||||
| 460 | break;
| 2-19 | ||||||||||||||||||
| 461 | ((void) executed 19 times by 4 tests: 0);void)Executed by:
| 19 | ||||||||||||||||||
| 462 | case ' ': | - | ||||||||||||||||||
| 463 | c_and_s executed 67 times by 11 tests: c_and_sExecuted by:
code before this statement executed 2 times by 1 test: hell_quote_compat = c_and_sExecuted by:
| 2-67 | ||||||||||||||||||
| 464 | 1 | - | ||||||||||||||||||
| 465 | ; | - | ||||||||||||||||||
| 466 | ((void) 0); | - | ||||||||||||||||||
| 467 | case '!': | - | ||||||||||||||||||
| 468 | case never executed: case '"':code before this statement executed 69 times by 11 tests: case '"':Executed by:
never executed: '"':case '"':code before this statement executed 69 times by 11 tests: case '"':Executed by:
never executed: case '$': case '&':case '"': | 0-69 | ||||||||||||||||||
| 469 | case executed 6 times by 2 tests: '(':case '(':Executed by:
executed 6 times by 2 tests: casecase '(':Executed by:
never executed: ')':case ')':never executed: casecase ')':never executed: '*':case '*':never executed: case ';':case '*': | 0-6 | ||||||||||||||||||
| 470 | case never executed: '<':case '<':never executed: case '<': | 0-30 | ||||||||||||||||||
| 471 | case never executed: '=':case '=':never executed: case '=': | 0 | ||||||||||||||||||
| 472 | case executed 3 times by 2 tests: '>':case '>':Executed by:
executed 3 times by 2 tests: case '[':case '>':Executed by:
| 3 | ||||||||||||||||||
| 473 | case executed 1 time by 1 test: '^':case '^':Executed by:
executed 1 time by 1 test: case '^':Executed by:
| 0-1 | ||||||||||||||||||
| 474 | case executed 3 times by 1 test: '`':case '`':Executed by:
executed 3 times by 1 test: case '|':case '`':Executed by:
| 3 | ||||||||||||||||||
| 475 | 0 | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | if (quoting_style == shell_always_quoting_style | - | ||||||||||||||||||
| 480 | &&
| 37-75 | ||||||||||||||||||
| 481 | goto force_outer_quotin
| 17-58 | ||||||||||||||||||
| 482 | break; executed 17 times by 4 tests: eak;Executed by:
| 17 | ||||||||||||||||||
| 483 | 95 | |||||||||||||||||||
| 484 | case '\'': | - | ||||||||||||||||||
| 485 | encounte executed 7 times by 3 tests: red_single_quote = encounteExecuted by:
| 7 | ||||||||||||||||||
| 486 | 1 | - | ||||||||||||||||||
| 487 | ; | - | ||||||||||||||||||
| 488 | c_and_shell_quote_compat = | - | ||||||||||||||||||
| 489 | 1 | - | ||||||||||||||||||
| 490 | ; | - | ||||||||||||||||||
| 491 | if (quoting_style == shell_always_quoting_style) | - | ||||||||||||||||||
| 492 | { | 3-4 | ||||||||||||||||||
| 493 | if (elide_outer_quotes) | - | ||||||||||||||||||
| 494 | goto
| 1-2 | ||||||||||||||||||
| 495 | 1 | |||||||||||||||||||
| 496 | if (buffersize && ! orig_buffersize) | - | ||||||||||||||||||
| 497 | { | 0-2 | ||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | - | |||||||||||||||||||
| 500 | - | |||||||||||||||||||
| 501 | orig_buffersize = buffersize; | - | ||||||||||||||||||
| 502 | buffersize = 0; | - | ||||||||||||||||||
| 503 | } | - | ||||||||||||||||||
| 504 | 2 | |||||||||||||||||||
| 505 | do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); | - | ||||||||||||||||||
| 506 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('\\'); | 0-2 | ||||||||||||||||||
| 507 | do { if (len < buffersize
never executed: len++; } while (0);buffer[len] = ('\''); | 0-2 | ||||||||||||||||||
| 508 | pending_shell_escape_end
| 0-2 | ||||||||||||||||||
| 509 | 0 | - | ||||||||||||||||||
| 510 | ; | - | ||||||||||||||||||
| 511 | } | - | ||||||||||||||||||
| 512 | bre executed 2 times by 2 tests: ak;eExecuted by:
| 2 | ||||||||||||||||||
| 513 | 6 | |||||||||||||||||||
| 514 | case '%': case '+': case ',': case '-': case '.': case '/': | - | ||||||||||||||||||
| 515 | case executed 21 times by 3 tests: '0':case '0':Executed by:
executed 21 times by 3 tests: casecase '0':Executed by:
executed 12 times by 7 tests: '1':case '1':Executed by:
executed 12 times by 7 tests: casecase '1':Executed by:
executed 4 times by 2 tests: '2':case '2':Executed by:
executed 4 times by 2 tests: casecase '2':Executed by:
executed 1168 times by 51 tests: '3':case '3':Executed by:
executed 1168 times by 51 tests: casecase '3':Executed by:
executed 1350 times by 27 tests: '4':case '4':Executed by:
executed 1350 times by 27 tests: casecase '4':Executed by:
executed 5842 times by 30 tests: '5':case '5':Executed by:
executed 5842 times by 30 tests: case '5':Executed by:
| 4-5842 | ||||||||||||||||||
| 516 | case executed 286 times by 26 tests: '6':case '6':Executed by:
executed 286 times by 26 tests: casecase '6':Executed by:
executed 273 times by 39 tests: '7':case '7':Executed by:
executed 273 times by 39 tests: casecase '7':Executed by:
executed 221 times by 22 tests: '8':case '8':Executed by:
executed 221 times by 22 tests: casecase '8':Executed by:
executed 112 times by 20 tests: '9':case '9':Executed by:
executed 112 times by 20 tests: casecase '9':Executed by:
executed 250 times by 19 tests: ':':case ':':Executed by:
executed 250 times by 19 tests: case ':':Executed by:
| 81-286 | ||||||||||||||||||
| 517 | case executed 101 times by 19 tests: 'A':case 'A':Executed by:
executed 101 times by 19 tests: casecase 'A':Executed by:
executed 119 times by 18 tests: 'B':case 'B':Executed by:
executed 119 times by 18 tests: casecase 'B':Executed by:
executed 110 times by 17 tests: 'C':case 'C':Executed by:
executed 110 times by 17 tests: casecase 'C':Executed by:
executed 465 times by 18 tests: 'D':case 'D':Executed by:
executed 465 times by 18 tests: casecase 'D':Executed by:
executed 8 times by 4 tests: 'E':case 'E':Executed by:
executed 8 times by 4 tests: case 'F':case 'E':Executed by:
| 8-465 | ||||||||||||||||||
| 518 | case executed 28 times by 8 tests: 'G':case 'G':Executed by:
executed 28 times by 8 tests: casecase 'G':Executed by:
executed 11 times by 3 tests: 'H':case 'H':Executed by:
executed 11 times by 3 tests: casecase 'H':Executed by:
executed 126 times by 4 tests: 'I':case 'I':Executed by:
executed 126 times by 4 tests: casecase 'I':Executed by:
executed 15 times by 7 tests: 'J':case 'J':Executed by:
executed 15 times by 7 tests: casecase 'J':Executed by:
executed 14 times by 3 tests: 'K':case 'K':Executed by:
executed 14 times by 3 tests: casecase 'K':Executed by:
executed 34 times by 5 tests: 'L':case 'L':Executed by:
executed 34 times by 5 tests: case 'L':Executed by:
| 11-126 | ||||||||||||||||||
| 519 | case executed 9 times by 1 test: 'M':case 'M':Executed by:
executed 9 times by 1 test: casecase 'M':Executed by:
executed 13 times by 3 tests: 'N':case 'N':Executed by:
executed 13 times by 3 tests: casecase 'N':Executed by:
executed 17 times by 4 tests: 'O':case 'O':Executed by:
executed 17 times by 4 tests: casecase 'O':Executed by:
executed 7 times by 2 tests: 'P':case 'P':Executed by:
executed 7 times by 2 tests: casecase 'P':Executed by:
executed 7 times by 2 tests: 'Q':case 'Q':Executed by:
executed 7 times by 2 tests: casecase 'Q':Executed by:
executed 15 times by 4 tests: 'R':case 'R':Executed by:
executed 15 times by 4 tests: case 'R':Executed by:
| 7-17 | ||||||||||||||||||
| 520 | case executed 25 times by 5 tests: 'S':case 'S':Executed by:
executed 25 times by 5 tests: casecase 'S':Executed by:
executed 28 times by 7 tests: 'T':case 'T':Executed by:
executed 28 times by 7 tests: casecase 'T':Executed by:
executed 14 times by 4 tests: 'U':case 'U':Executed by:
executed 14 times by 4 tests: casecase 'U':Executed by:
executed 11 times by 2 tests: 'V':case 'V':Executed by:
executed 11 times by 2 tests: casecase 'V':Executed by:
executed 22 times by 2 tests: 'W':case 'W':Executed by:
executed 22 times by 2 tests: casecase 'W':Executed by:
executed 4 times by 3 tests: 'X':case 'X':Executed by:
executed 4 times by 3 tests: case 'X':Executed by:
| 4-28 | ||||||||||||||||||
| 521 | case executed 125 times by 3 tests: 'Y':case 'Y':Executed by:
executed 125 times by 3 tests: casecase 'Y':Executed by:
executed 8 times by 4 tests: 'Z':case 'Z':Executed by:
executed 8 times by 4 tests: casecase 'Z':Executed by:
executed 13 times by 4 tests: ']':case ']':Executed by:
executed 13 times by 4 tests: casecase ']':Executed by:
executed 13 times by 3 tests: '_':case '_':Executed by:
executed 13 times by 3 tests: casecase '_':Executed by:
executed 17 times by 2 tests: 'a':case 'a':Executed by:
executed 17 times by 2 tests: casecase 'a':Executed by:
executed 44 times by 4 tests: 'b':case 'b':Executed by:
executed 44 times by 4 tests: case 'b':Executed by:
| 8-125 | ||||||||||||||||||
| 522 | case executed 8 times by 2 tests: 'c':case 'c':Executed by:
executed 8 times by 2 tests: casecase 'c':Executed by:
executed 21 times by 4 tests: 'd':case 'd':Executed by:
executed 21 times by 4 tests: casecase 'd':Executed by:
never executed: 'e':case 'e':never executed: casecase 'e':executed 72 times by 11 tests: 'f':case 'f':Executed by:
executed 72 times by 11 tests: casecase 'f':Executed by:
executed 1726 times by 44 tests: 'g':case 'g':Executed by:
executed 1726 times by 44 tests: casecase 'g':Executed by:
executed 792 times by 23 tests: 'h':case 'h':Executed by:
executed 792 times by 23 tests: case 'h':Executed by:
| 0-1726 | ||||||||||||||||||
| 523 | case executed 1829 times by 31 tests: 'i':case 'i':Executed by:
executed 1829 times by 31 tests: casecase 'i':Executed by:
executed 530 times by 43 tests: 'j':case 'j':Executed by:
executed 530 times by 43 tests: casecase 'j':Executed by:
executed 3353 times by 47 tests: 'k':case 'k':Executed by:
executed 3353 times by 47 tests: casecase 'k':Executed by:
executed 719 times by 29 tests: 'l':case 'l':Executed by:
executed 719 times by 29 tests: casecase 'l':Executed by:
executed 1185 times by 21 tests: 'm':case 'm':Executed by:
executed 1185 times by 21 tests: casecase 'm':Executed by:
executed 766 times by 47 tests: 'n':case 'n':Executed by:
executed 766 times by 47 tests: case 'n':Executed by:
| 530-3353 | ||||||||||||||||||
| 524 | case executed 1712 times by 39 tests: 'o':case 'o':Executed by:
executed 1712 times by 39 tests: casecase 'o':Executed by:
executed 8 times by 4 tests: 'p':case 'p':Executed by:
executed 8 times by 4 tests: casecase 'p':Executed by:
executed 156 times by 24 tests: 'q':case 'q':Executed by:
executed 156 times by 24 tests: casecase 'q':Executed by:
executed 1281 times by 49 tests: 'r':case 'r':Executed by:
executed 1281 times by 49 tests: casecase 'r':Executed by:
executed 791 times by 26 tests: 's':case 's':Executed by:
executed 791 times by 26 tests: casecase 's':Executed by:
executed 1569 times by 45 tests: 't':case 't':Executed by:
executed 1569 times by 45 tests: case 't':Executed by:
| 8-1712 | ||||||||||||||||||
| 525 | case executed 2457 times by 45 tests: 'u':case 'u':Executed by:
executed 2457 times by 45 tests: casecase 'u':Executed by:
executed 1644 times by 42 tests: 'v':case 'v':Executed by:
executed 1644 times by 42 tests: casecase 'v':Executed by:
executed 178 times by 5 tests: 'w':case 'w':Executed by:
executed 178 times by 5 tests: casecase 'w':Executed by:
executed 2666 times by 36 tests: 'x':case 'x':Executed by:
executed 2666 times by 36 tests: casecase 'x':Executed by:
executed 3575 times by 39 tests: 'y':case 'y':Executed by:
executed 3575 times by 39 tests: casecase 'y':Executed by:
executed 1399 times by 34 tests: 'z':case 'z':Executed by:
executed 1399 times by 34 tests: case 'z':Executed by:
| 178-3575 | ||||||||||||||||||
| 526 | c_and_s executed 1225 times by 35 tests: hell_quotec_and_sExecuted by:
executed 593 times by 14 tests: _compat = ell_quoteExecuted by:
executed 280 times by 12 tests: compat =Executed by:
| 101-1225 | ||||||||||||||||||
| 527 | 1 | - | ||||||||||||||||||
| 528 | ; | - | ||||||||||||||||||
| 529 | break; | - | ||||||||||||||||||
| 530 | 41931 | |||||||||||||||||||
| 531 | default: | - | ||||||||||||||||||
| 532 | 3 | |||||||||||||||||||
| 533 | - | |||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | - | |||||||||||||||||||
| 537 | { | - | ||||||||||||||||||
| 538 | - | |||||||||||||||||||
| 539 | size_t m; | - | ||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | _Bool | - | ||||||||||||||||||
| 543 | printable; | - | ||||||||||||||||||
| 544 | - | |||||||||||||||||||
| 545 | if (unibyte_locale) | - | ||||||||||||||||||
| 546 | { | 0-3 | ||||||||||||||||||
| 547 | m = 1; | - | ||||||||||||||||||
| 548 | printable = | - | ||||||||||||||||||
| 549 | ((*__ctype_b_loc ())[(int) (( | - | ||||||||||||||||||
| 550 | c | - | ||||||||||||||||||
| 551 | ))] & (unsigned short int) _ISprint) | - | ||||||||||||||||||
| 552 | != 0; | - | ||||||||||||||||||
| 553 | } | - | ||||||||||||||||||
| 554 | els executed 3 times by 2 tests: esExecuted by:
| 3 | ||||||||||||||||||
| 555 | { | - | ||||||||||||||||||
| 556 | mbstate_t mbstate; | - | ||||||||||||||||||
| 557 | memset (&mbstate, 0, sizeof mbstate); | - | ||||||||||||||||||
| 558 | - | |||||||||||||||||||
| 559 | m = 0; | - | ||||||||||||||||||
| 560 | printable = | - | ||||||||||||||||||
| 561 | 1 | - | ||||||||||||||||||
| 562 | ; | - | ||||||||||||||||||
| 563 | if (argsize == | - | ||||||||||||||||||
| 564 | (18446744073709551615UL)
| 0 | ||||||||||||||||||
| 565 | )
| 0 | ||||||||||||||||||
| 566 | argsize = strlen (arg); | - | ||||||||||||||||||
| 567 | 0 | |||||||||||||||||||
| 568 | do | - | ||||||||||||||||||
| 569 | { | - | ||||||||||||||||||
| 570 | wchar_t w; | - | ||||||||||||||||||
| 571 | size_t bytes = | - | ||||||||||||||||||
| 572 | rpl_mbrtowc | - | ||||||||||||||||||
| 573 | (&w, &arg[i + m], | - | ||||||||||||||||||
| 574 | argsize - (i + m), &mbstate); | - | ||||||||||||||||||
| 575 | if (bytes == 0) | - | ||||||||||||||||||
| 576 | break;
| 0 | ||||||||||||||||||
| 577 | else never executed: if se ifnever executed: (bytes == (size_t) -1)se if | 0 | ||||||||||||||||||
| 578 | { | 0 | ||||||||||||||||||
| 579 | printable = | - | ||||||||||||||||||
| 580 | 0 | - | ||||||||||||||||||
| 581 | ; | - | ||||||||||||||||||
| 582 | break; | - | ||||||||||||||||||
| 583 | } | 0 | ||||||||||||||||||
| 584 | else if (bytes == (size_t) -2) | - | ||||||||||||||||||
| 585 | { | 0 | ||||||||||||||||||
| 586 | printable = | - | ||||||||||||||||||
| 587 | 0 | - | ||||||||||||||||||
| 588 | ; | - | ||||||||||||||||||
| 589 | while (i + m < argsize && arg[i + m]) | - | ||||||||||||||||||
| 590 | m++; | 0 | ||||||||||||||||||
| 591 | break; never executed: eak; | 0 | ||||||||||||||||||
| 592 | } | 0 | ||||||||||||||||||
| 593 | else | - | ||||||||||||||||||
| 594 | { | - | ||||||||||||||||||
| 595 | - | |||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | - | |||||||||||||||||||
| 598 | - | |||||||||||||||||||
| 599 | if ('[' == 0x5b && elide_outer_quotes | - | ||||||||||||||||||
| 600 | &&
| 0 | ||||||||||||||||||
| 601 | { | 0 | ||||||||||||||||||
| 602 | size_t j; | - | ||||||||||||||||||
| 603 | for (j = 1; j < bytes; j++) | - | ||||||||||||||||||
| 604 | switch (arg[i + m +
| 0 | ||||||||||||||||||
| 605 | { | - | ||||||||||||||||||
| 606 | case '[': case '\\': case '^': | - | ||||||||||||||||||
| 607 | case never executed: '`':case '`':never executed: casecase '`':never executed: '|':case '|':never executed: case '|': | 0 | ||||||||||||||||||
| 608 | goto fo never executed: rce_outer_goto fonever executed: quoting_style;ce_outer_ | 0 | ||||||||||||||||||
| 609 | 0 | |||||||||||||||||||
| 610 | default: | - | ||||||||||||||||||
| 611 | break; never executed: break; | 0 | ||||||||||||||||||
| 612 | } | 0 | ||||||||||||||||||
| 613 | } | - | ||||||||||||||||||
| 614 | 0 | |||||||||||||||||||
| 615 | if (! iswprint (w)) | - | ||||||||||||||||||
| 616 | printable =
| 0 | ||||||||||||||||||
| 617 | 0 never executed: 0 ; m += bytes; | 0 | ||||||||||||||||||
| 618 | ; never executed: 0 ; m += bytes; | 0 | ||||||||||||||||||
| 619 | m += bytes; never executed: 0 ; m += bytes; | 0 | ||||||||||||||||||
| 620 | } | - | ||||||||||||||||||
| 621 | } | 0 | ||||||||||||||||||
| 622 | while (! mbsinit (&mbstate)); | - | ||||||||||||||||||
| 623 | } | 0 | ||||||||||||||||||
| 624 | 0 | |||||||||||||||||||
| 625 | c_and_shell_quote_compat = printable; | - | ||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | if (1 < m || (backslash_escapes && ! printable)) | - | ||||||||||||||||||
| 628 | { | 0-3 | ||||||||||||||||||
| 629 | - | |||||||||||||||||||
| 630 | - | |||||||||||||||||||
| 631 | size_t ilim = i + m; | - | ||||||||||||||||||
| 632 | - | |||||||||||||||||||
| 633 | for (;;) | - | ||||||||||||||||||
| 634 | { | - | ||||||||||||||||||
| 635 | if (backslash_escapes && ! printable) | - | ||||||||||||||||||
| 636 | { | 0-3 | ||||||||||||||||||
| 637 | do { if (elide_outer_quotes) goto force_outer_quoting_style; escaping = | - | ||||||||||||||||||
| 638 | 1 | 0-3 | ||||||||||||||||||
| 639 | ; if (quoting_style == shell_always_quoting_style && ! pending_shell_escape_end) { do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); do { if (len < buffersize) buffer[len] = ('$'); len++; } while (0); do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); pending_shell_escape_end = | - | ||||||||||||||||||
| 640 | 1 | 0-3 | ||||||||||||||||||
| 641 | ; } do { if (len < buffersize) buffer[len] = ('\\'); len++; } while (0); } while (0); | - | ||||||||||||||||||
| 642 | do never executed: { if (len < buffersize) bo
executed 3 times by 2 tests: >> 6)); len++; } while (0);fer[len] = ('0' + (cExecuted by:
| 0-3 | ||||||||||||||||||
| 643 | do { if (len < buffersize
executed 3 times by 2 tests: & 7)); len++; } while (0);buffer[len] = ('0' + ((c >> 3)Executed by:
| 0-3 | ||||||||||||||||||
| 644 | c = '0' + (c & 7);
| 0-3 | ||||||||||||||||||
| 645 | } | - | ||||||||||||||||||
| 646 | els executed 3 times by 2 tests: e if (is_right_quote)sExecuted by:
| 3 | ||||||||||||||||||
| 647 | { | 0 | ||||||||||||||||||
| 648 | do { if (len < buffersize) buffer[len] = ('\\'); len++; } while (0); | - | ||||||||||||||||||
| 649 | is_right_quote =
| 0 | ||||||||||||||||||
| 650 | 0 | - | ||||||||||||||||||
| 651 | ; | - | ||||||||||||||||||
| 652 | } | - | ||||||||||||||||||
| 653 | if never executed (ilim <= i + 1) | 0 | ||||||||||||||||||
| 654 | break;
| 0-3 | ||||||||||||||||||
| 655 | do { if executed 3 times by 2 tests: (pending_shell_escape_end && ! escaping) { do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); pending_shell_escape_end = { ifExecuted by:
| 3 | ||||||||||||||||||
| 656 | 0 | 0 | ||||||||||||||||||
| 657 | ; } } while (0); | - | ||||||||||||||||||
| 658 | do never executed: { if (len < buffersize) buffer[len] = (c); len++; } while (0);o | 0 | ||||||||||||||||||
| 659 | c = arg[++
| 0 | ||||||||||||||||||
| 660 | } | - | ||||||||||||||||||
| 661 | 0 | |||||||||||||||||||
| 662 | goto store_c; | - | ||||||||||||||||||
| 663 | } | 3 | ||||||||||||||||||
| 664 | } | - | ||||||||||||||||||
| 665 | } | - | ||||||||||||||||||
| 666 | 0 | |||||||||||||||||||
| 667 | if (! (((backslash_escapes && quoting_style != shell_always_quoting_style) | - | ||||||||||||||||||
| 668 | ||
| 5247-27484 | ||||||||||||||||||
| 669 | && quote_these_too
| 2312-34520 | ||||||||||||||||||
| 670 | && quote_these_too
| 1-7558 | ||||||||||||||||||
| 671 | && !is_right_quote)
| 0-7558 | ||||||||||||||||||
| 672 | goto store_c;
| 2-42077 | ||||||||||||||||||
| 673 | 42077 | |||||||||||||||||||
| 674 | store_escape: | - | ||||||||||||||||||
| 675 | do { if (el code before this statement executed 2 times by 2 tests: ide_outer_quotes) goto force_outer_quoting_style; escaping = do { if (elExecuted by:
| 2 | ||||||||||||||||||
| 676 | 1 | 4-26 | ||||||||||||||||||
| 677 | ; if (quoting_style == shell_always_quoting_style && ! pending_shell_escape_end) { do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); do { if (len < buffersize) buffer[len] = ('$'); len++; } while (0); do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); pending_shell_escape_end = | - | ||||||||||||||||||
| 678 | 1 | 0-20 | ||||||||||||||||||
| 679 | ; } do { if (len < buffersize) buffer[len] = ('\\'); len++; } while (0); } while (0); | - | ||||||||||||||||||
| 680 | 0-26 | |||||||||||||||||||
| 681 | store_c: | - | ||||||||||||||||||
| 682 | do { i code before this statement executed 26 times by 5 tests: f (pending_shell_escape_end && ! escaping) { do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); do { if (len < buffersize) buffer[len] = ('\''); len++; } while (0); pending_shell_escape_end = do { iExecuted by:
| 26 | ||||||||||||||||||
| 683 | 0 | 0-42101 | ||||||||||||||||||
| 684 | ; } } while (0); | - | ||||||||||||||||||
| 685 | do executed 1 time by 1 test: { if (len < buffersize) buffer[len] = (c); len++; } while (0);oExecuted by:
| 1 | ||||||||||||||||||
| 686 | 1833-40275 | |||||||||||||||||||
| 687 | if (! c_and_shell_quote_compat) | - | ||||||||||||||||||
| 688 | all_c_and_shell_quote_compat
| 119-41989 | ||||||||||||||||||
| 689 | 0 executed 119 times by 11 tests: 0 ; }Executed by:
| 119 | ||||||||||||||||||
| 690 | ; executed 119 times by 11 tests: 0 ; }Executed by:
| 119 | ||||||||||||||||||
| 691 | } executed 119 times by 11 tests: 0 ; }Executed by:
| 119 | ||||||||||||||||||
| 692 | 42108 | |||||||||||||||||||
| 693 | if (len == 0 && quoting_style == shell_always_quoting_style | - | ||||||||||||||||||
| 694 | &&
| 0-3517 | ||||||||||||||||||
| 695 | goto force_outer_quotin
| 0-3 | ||||||||||||||||||
| 696 | 3 | |||||||||||||||||||
| 697 | - | |||||||||||||||||||
| 698 | - | |||||||||||||||||||
| 699 | - | |||||||||||||||||||
| 700 | - | |||||||||||||||||||
| 701 | if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes | - | ||||||||||||||||||
| 702 | &&
| 122-1984 | ||||||||||||||||||
| 703 | { | 2-1409 | ||||||||||||||||||
| 704 | if (all_c_and_shell_quote_compat) | - | ||||||||||||||||||
| 705 | return
| 0-2 | ||||||||||||||||||
| 706 | c_quoting_style, executed 2 times by 2 tests: c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize)Executed by:
| 2 | ||||||||||||||||||
| 707 | flags, quote_these_too, executed 2 times by 2 tests: c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize)Executed by:
| 2 | ||||||||||||||||||
| 708 | left_quote, right_quote); executed 2 times by 2 tests: c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize)Executed by:
| 2 | ||||||||||||||||||
| 709 | else if (! buffersize && orig_buffersize) executed 2 times by 2 tests: c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize)Executed by:
| 2 | ||||||||||||||||||
| 710 | { | 0 | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | buffersize = orig_buffersize; | - | ||||||||||||||||||
| 713 | len = 0; | - | ||||||||||||||||||
| 714 | goto process_input; | - | ||||||||||||||||||
| 715 | } | 0 | ||||||||||||||||||
| 716 | } | - | ||||||||||||||||||
| 717 | 0 | |||||||||||||||||||
| 718 | if (quote_string && !elide_outer_quotes) | - | ||||||||||||||||||
| 719 | for
| 124-2362 | ||||||||||||||||||
| 720 | do { if
| 2238 | ||||||||||||||||||
| 721 | 193-2238 | |||||||||||||||||||
| 722 | if (len < buffersize) | - | ||||||||||||||||||
| 723 | buffer[len] = '\0'
| 196-3319 | ||||||||||||||||||
| 724 | return executed 3319 times by 77 tests: len;turn len;Executed by:
executed 3319 times by 77 tests: turn len;Executed by:
| 3319 | ||||||||||||||||||
| 725 | 3515 | |||||||||||||||||||
| 726 | force_outer_quoting_style: | - | ||||||||||||||||||
| 727 | - | |||||||||||||||||||
| 728 | - | |||||||||||||||||||
| 729 | if (quoting_style == shell_always_quoting_style && backslash_escapes) | - | ||||||||||||||||||
| 730 | quoting_style = shell_escape_always_quoting_s
| 0-27 | ||||||||||||||||||
| 731 | return executed 27 times by 7 tests: quotearg_buffer_restyled (buffer, buffersize,turn quotearg_buffer_restyled (buffer, buffersize,Executed by:
executed 27 times by 7 tests: arg, argsize,turn quotearg_buffer_restyled (buffer, buffersize,Executed by:
| 27 | ||||||||||||||||||
| 732 | quoting_style, executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 733 | flags & ~QA_ELIDE_OUTER_QUOTES, executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 734 | ((void *)0) executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 735 | , executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 736 | left_quote, right_quote); executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 737 | } executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }Executed by:
| 27 | ||||||||||||||||||
| 738 | size_t | - | ||||||||||||||||||
| 739 | quotearg_buffer (char *buffer, size_t buffersize, | - | ||||||||||||||||||
| 740 | char const *arg, size_t argsize, | - | ||||||||||||||||||
| 741 | struct quoting_options const *o) | - | ||||||||||||||||||
| 742 | { | - | ||||||||||||||||||
| 743 | struct quoting_options const *p = o ? o : &default_quoting_options; | - | ||||||||||||||||||
| 744 | int e = | 0-1180 | ||||||||||||||||||
| 745 | (*__errno_location ()) | - | ||||||||||||||||||
| 746 | ; | - | ||||||||||||||||||
| 747 | size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize, | - | ||||||||||||||||||
| 748 | p->style, p->flags, p->quote_these_too, | - | ||||||||||||||||||
| 749 | p->left_quote, p->right_quote); | - | ||||||||||||||||||
| 750 | - | |||||||||||||||||||
| 751 | (*__errno_location ()) | - | ||||||||||||||||||
| 752 | = e; | - | ||||||||||||||||||
| 753 | return r; | - | ||||||||||||||||||
| 754 | } | 1180 | ||||||||||||||||||
| 755 | - | |||||||||||||||||||
| 756 | - | |||||||||||||||||||
| 757 | char * | - | ||||||||||||||||||
| 758 | quotearg_alloc (char const *arg, size_t argsize, | - | ||||||||||||||||||
| 759 | struct quoting_options const *o) | - | ||||||||||||||||||
| 760 | { | - | ||||||||||||||||||
| 761 | return quotearg_alloc_mem (arg, argsize, | - | ||||||||||||||||||
| 762 | ((void *)0) never executed: ((void *)0) , o); } | 0 | ||||||||||||||||||
| 763 | , o); never executed: ((void *)0) , o); } | 0 | ||||||||||||||||||
| 764 | } never executed: ((void *)0) , o); } | 0 | ||||||||||||||||||
| 765 | - | |||||||||||||||||||
| 766 | - | |||||||||||||||||||
| 767 | - | |||||||||||||||||||
| 768 | - | |||||||||||||||||||
| 769 | - | |||||||||||||||||||
| 770 | - | |||||||||||||||||||
| 771 | - | |||||||||||||||||||
| 772 | char * | - | ||||||||||||||||||
| 773 | quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size, | - | ||||||||||||||||||
| 774 | struct quoting_options const *o) | - | ||||||||||||||||||
| 775 | { | - | ||||||||||||||||||
| 776 | struct quoting_options const *p = o ? o : &default_quoting_options; | - | ||||||||||||||||||
| 777 | int e = | 0 | ||||||||||||||||||
| 778 | (*__errno_location ()) | - | ||||||||||||||||||
| 779 | ; | - | ||||||||||||||||||
| 780 | - | |||||||||||||||||||
| 781 | int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES); | - | ||||||||||||||||||
| 782 | size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style, | - | ||||||||||||||||||
| 783 | flags, p->quote_these_too, | - | ||||||||||||||||||
| 784 | p->left_quote, | - | ||||||||||||||||||
| 785 | p->right_quote) + 1; | - | ||||||||||||||||||
| 786 | char *buf = xcharalloc (bufsize); | - | ||||||||||||||||||
| 787 | quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags, | - | ||||||||||||||||||
| 788 | p->quote_these_too, | - | ||||||||||||||||||
| 789 | p->left_quote, p->right_quote); | - | ||||||||||||||||||
| 790 | - | |||||||||||||||||||
| 791 | (*__errno_location ()) | - | ||||||||||||||||||
| 792 | = e; | - | ||||||||||||||||||
| 793 | if (size) | - | ||||||||||||||||||
| 794 | *size
| 0 | ||||||||||||||||||
| 795 | return never executed: buf;turn buf;never executed: turn buf; | 0 | ||||||||||||||||||
| 796 | } | 0 | ||||||||||||||||||
| 797 | - | |||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | struct slotvec | - | ||||||||||||||||||
| 800 | { | - | ||||||||||||||||||
| 801 | size_t size; | - | ||||||||||||||||||
| 802 | char *val; | - | ||||||||||||||||||
| 803 | }; | - | ||||||||||||||||||
| 804 | - | |||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | - | |||||||||||||||||||
| 807 | static char slot0[256]; | - | ||||||||||||||||||
| 808 | static int nslots = 1; | - | ||||||||||||||||||
| 809 | static struct slotvec slotvec0 = {sizeof slot0, slot0}; | - | ||||||||||||||||||
| 810 | static struct slotvec *slotvec = &slotvec0; | - | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | void | - | ||||||||||||||||||
| 813 | quotearg_free (void) | - | ||||||||||||||||||
| 814 | { | - | ||||||||||||||||||
| 815 | struct slotvec *sv = slotvec; | - | ||||||||||||||||||
| 816 | int i; | - | ||||||||||||||||||
| 817 | for (i = 1; i < nslots; i++) | - | ||||||||||||||||||
| 818 | free (sv[i].
| 0 | ||||||||||||||||||
| 819 | if (sv[0].val != sl never executed: ot0)(sv[0].val != sl | 0 | ||||||||||||||||||
| 820 | { | 0 | ||||||||||||||||||
| 821 | free (sv[0].val); | - | ||||||||||||||||||
| 822 | slotvec0.size = sizeof slot0; | - | ||||||||||||||||||
| 823 | slotvec0.val = slot0; | - | ||||||||||||||||||
| 824 | } | - | ||||||||||||||||||
| 825 | if never executed (sv != &slotvec0) | 0 | ||||||||||||||||||
| 826 | { | 0 | ||||||||||||||||||
| 827 | free (sv); | - | ||||||||||||||||||
| 828 | slotvec = &slotvec0; | - | ||||||||||||||||||
| 829 | } | - | ||||||||||||||||||
| 830 | nsl never executed: ots = 1;l | 0 | ||||||||||||||||||
| 831 | } | - | ||||||||||||||||||
| 832 | s never executed: tatic char *s | 0 | ||||||||||||||||||
| 833 | quotearg_n_options (int n, char const *arg, size_t argsize, | - | ||||||||||||||||||
| 834 | struct quoting_options const *options) | - | ||||||||||||||||||
| 835 | { | - | ||||||||||||||||||
| 836 | int e = | - | ||||||||||||||||||
| 837 | (*__errno_location ()) | - | ||||||||||||||||||
| 838 | ; | - | ||||||||||||||||||
| 839 | - | |||||||||||||||||||
| 840 | struct slotvec *sv = slotvec; | - | ||||||||||||||||||
| 841 | - | |||||||||||||||||||
| 842 | if (n < 0) | - | ||||||||||||||||||
| 843 | abort (
| 0-2139 | ||||||||||||||||||
| 844 | 0 | |||||||||||||||||||
| 845 | if (nslots <= n) | - | ||||||||||||||||||
| 846 | { | 185-1954 | ||||||||||||||||||
| 847 | - | |||||||||||||||||||
| 848 | _Bool | - | ||||||||||||||||||
| 849 | preallocated = (sv == &slotvec0); | - | ||||||||||||||||||
| 850 | int nmax = | - | ||||||||||||||||||
| 851 | (((0x7fffffff)<(((((9223372036854775807L))<((18446744073709551615UL)))?((9223372036854775807L)):((18446744073709551615UL))) | - | ||||||||||||||||||
| 852 | / sizeof *sv
| 0-185 | ||||||||||||||||||
| 853 | ))?(0x7fffffff):(((((9223372036854775807L))<((18446744073709551615UL)))?((9223372036854775807L)):((18446744073709551615UL)))
| 0-185 | ||||||||||||||||||
| 854 | /
| 0-185 | ||||||||||||||||||
| 855 | )) | - | ||||||||||||||||||
| 856 | - 1; | - | ||||||||||||||||||
| 857 | - | |||||||||||||||||||
| 858 | if (nmax < n) | - | ||||||||||||||||||
| 859 | xalloc_die
| 0-185 | ||||||||||||||||||
| 860 | 0 | |||||||||||||||||||
| 861 | slotvec = sv = xrealloc (preallocated ? | - | ||||||||||||||||||
| 862 | ((void *)0) | - | ||||||||||||||||||
| 863 | : sv, (n + 1) * sizeof *sv); | - | ||||||||||||||||||
| 864 | if (preallocated) | - | ||||||||||||||||||
| 865 | *sv = slotvec0
| 0-185 | ||||||||||||||||||
| 866 | memset (sv + nslo executed 185 times by 20 tests: ts, 0, (n + 1 - nslots) * sizeof *sv);mset (sv + nsloExecuted by:
| 185 | ||||||||||||||||||
| 867 | nslots = n + 1; | - | ||||||||||||||||||
| 868 | } | - | ||||||||||||||||||
| 869 | 185 | |||||||||||||||||||
| 870 | { | - | ||||||||||||||||||
| 871 | size_t size = sv[n].size; | - | ||||||||||||||||||
| 872 | char *val = sv[n].val; | - | ||||||||||||||||||
| 873 | - | |||||||||||||||||||
| 874 | int flags = options->flags | QA_ELIDE_NULL_BYTES; | - | ||||||||||||||||||
| 875 | size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize, | - | ||||||||||||||||||
| 876 | options->style, flags, | - | ||||||||||||||||||
| 877 | options->quote_these_too, | - | ||||||||||||||||||
| 878 | options->left_quote, | - | ||||||||||||||||||
| 879 | options->right_quote); | - | ||||||||||||||||||
| 880 | - | |||||||||||||||||||
| 881 | if (size <= qsize) | - | ||||||||||||||||||
| 882 | { | 196-1943 | ||||||||||||||||||
| 883 | sv[n].size = size = qsize + 1; | - | ||||||||||||||||||
| 884 | if (val != slot0) | - | ||||||||||||||||||
| 885 | free (val);
| 1-195 | ||||||||||||||||||
| 886 | sv[ executed 195 times by 20 tests: n].val = v[n].val = vExecuted by:
executed 195 times by 20 tests: al = xcharalloc (size);[n].val = vExecuted by:
| 195 | ||||||||||||||||||
| 887 | quotearg_buffer_restyled (val, size, arg, argsize, options->style, | - | ||||||||||||||||||
| 888 | flags, options->quote_these_too, | - | ||||||||||||||||||
| 889 | options->left_quote, | - | ||||||||||||||||||
| 890 | options->right_quote); | - | ||||||||||||||||||
| 891 | } | - | ||||||||||||||||||
| 892 | 196 | |||||||||||||||||||
| 893 | - | |||||||||||||||||||
| 894 | (*__errno_location ()) | - | ||||||||||||||||||
| 895 | = e; | - | ||||||||||||||||||
| 896 | return val; | - | ||||||||||||||||||
| 897 | } | 2139 | ||||||||||||||||||
| 898 | } | - | ||||||||||||||||||
| 899 | - | |||||||||||||||||||
| 900 | char * | - | ||||||||||||||||||
| 901 | quotearg_n (int n, char const *arg) | - | ||||||||||||||||||
| 902 | { | - | ||||||||||||||||||
| 903 | return quotearg_n_options (n, arg, | - | ||||||||||||||||||
| 904 | (18446744073709551615UL) never executed: (18446744073709551615UL) , &default_quoting_options); } | 0 | ||||||||||||||||||
| 905 | , &default_quoting_options); never executed: (18446744073709551615UL) , &default_quoting_options); } | 0 | ||||||||||||||||||
| 906 | } never executed: (18446744073709551615UL) , &default_quoting_options); } | 0 | ||||||||||||||||||
| 907 | - | |||||||||||||||||||
| 908 | char * | - | ||||||||||||||||||
| 909 | quotearg_n_mem (int n, char const *arg, size_t argsize) | - | ||||||||||||||||||
| 910 | { | - | ||||||||||||||||||
| 911 | return quotearg_n_options (n, arg, argsize, &default_quoting_options); | - | ||||||||||||||||||
| 912 | } | 0 | ||||||||||||||||||
| 913 | - | |||||||||||||||||||
| 914 | char * | - | ||||||||||||||||||
| 915 | quotearg (char const *arg) | - | ||||||||||||||||||
| 916 | { | - | ||||||||||||||||||
| 917 | return quotearg_n (0, arg); | - | ||||||||||||||||||
| 918 | } | 0 | ||||||||||||||||||
| 919 | - | |||||||||||||||||||
| 920 | char * | - | ||||||||||||||||||
| 921 | quotearg_mem (char const *arg, size_t argsize) | - | ||||||||||||||||||
| 922 | { | - | ||||||||||||||||||
| 923 | return quotearg_n_mem (0, arg, argsize); | - | ||||||||||||||||||
| 924 | } | 0 | ||||||||||||||||||
| 925 | - | |||||||||||||||||||
| 926 | char * | - | ||||||||||||||||||
| 927 | quotearg_n_style (int n, enum quoting_style s, char const *arg) | - | ||||||||||||||||||
| 928 | { | - | ||||||||||||||||||
| 929 | struct quoting_options const o = quoting_options_from_style (s); | - | ||||||||||||||||||
| 930 | return quotearg_n_options (n, arg, | - | ||||||||||||||||||
| 931 | (18446744073709551615UL) executed 1307 times by 38 tests: (18446744073709551615UL) , &o); }Executed by:
| 1307 | ||||||||||||||||||
| 932 | , &o); executed 1307 times by 38 tests: (18446744073709551615UL) , &o); }Executed by:
| 1307 | ||||||||||||||||||
| 933 | } executed 1307 times by 38 tests: (18446744073709551615UL) , &o); }Executed by:
| 1307 | ||||||||||||||||||
| 934 | - | |||||||||||||||||||
| 935 | char * | - | ||||||||||||||||||
| 936 | quotearg_n_style_mem (int n, enum quoting_style s, | - | ||||||||||||||||||
| 937 | char const *arg, size_t argsize) | - | ||||||||||||||||||
| 938 | { | - | ||||||||||||||||||
| 939 | struct quoting_options const o = quoting_options_from_style (s); | - | ||||||||||||||||||
| 940 | return quotearg_n_options (n, arg, argsize, &o); | - | ||||||||||||||||||
| 941 | } | 1 | ||||||||||||||||||
| 942 | - | |||||||||||||||||||
| 943 | char * | - | ||||||||||||||||||
| 944 | quotearg_style (enum quoting_style s, char const *arg) | - | ||||||||||||||||||
| 945 | { | - | ||||||||||||||||||
| 946 | return quotearg_n_style (0, s, arg); | - | ||||||||||||||||||
| 947 | } | 1014 | ||||||||||||||||||
| 948 | - | |||||||||||||||||||
| 949 | char * | - | ||||||||||||||||||
| 950 | quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize) | - | ||||||||||||||||||
| 951 | { | - | ||||||||||||||||||
| 952 | return quotearg_n_style_mem (0, s, arg, argsize); | - | ||||||||||||||||||
| 953 | } | 0 | ||||||||||||||||||
| 954 | - | |||||||||||||||||||
| 955 | char * | - | ||||||||||||||||||
| 956 | quotearg_char_mem (char const *arg, size_t argsize, char ch) | - | ||||||||||||||||||
| 957 | { | - | ||||||||||||||||||
| 958 | struct quoting_options options; | - | ||||||||||||||||||
| 959 | options = default_quoting_options; | - | ||||||||||||||||||
| 960 | set_char_quoting (&options, ch, 1); | - | ||||||||||||||||||
| 961 | return quotearg_n_options (0, arg, argsize, &options); | - | ||||||||||||||||||
| 962 | } | 0 | ||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | char * | - | ||||||||||||||||||
| 965 | quotearg_char (char const *arg, char ch) | - | ||||||||||||||||||
| 966 | { | - | ||||||||||||||||||
| 967 | return quotearg_char_mem (arg, | - | ||||||||||||||||||
| 968 | (18446744073709551615UL) never executed: (18446744073709551615UL) , ch); } | 0 | ||||||||||||||||||
| 969 | , ch); never executed: (18446744073709551615UL) , ch); } | 0 | ||||||||||||||||||
| 970 | } never executed: (18446744073709551615UL) , ch); } | 0 | ||||||||||||||||||
| 971 | - | |||||||||||||||||||
| 972 | char * | - | ||||||||||||||||||
| 973 | quotearg_colon (char const *arg) | - | ||||||||||||||||||
| 974 | { | - | ||||||||||||||||||
| 975 | return quotearg_char (arg, ':'); | - | ||||||||||||||||||
| 976 | } | 0 | ||||||||||||||||||
| 977 | - | |||||||||||||||||||
| 978 | char * | - | ||||||||||||||||||
| 979 | quotearg_colon_mem (char const *arg, size_t argsize) | - | ||||||||||||||||||
| 980 | { | - | ||||||||||||||||||
| 981 | return quotearg_char_mem (arg, argsize, ':'); | - | ||||||||||||||||||
| 982 | } | 0 | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | char * | - | ||||||||||||||||||
| 985 | quotearg_n_style_colon (int n, enum quoting_style s, char const *arg) | - | ||||||||||||||||||
| 986 | { | - | ||||||||||||||||||
| 987 | struct quoting_options options; | - | ||||||||||||||||||
| 988 | options = quoting_options_from_style (s); | - | ||||||||||||||||||
| 989 | set_char_quoting (&options, ':', 1); | - | ||||||||||||||||||
| 990 | return quotearg_n_options (n, arg, | - | ||||||||||||||||||
| 991 | (18446744073709551615UL) executed 135 times by 24 tests: (18446744073709551615UL) , &options); }Executed by:
| 135 | ||||||||||||||||||
| 992 | , &options); executed 135 times by 24 tests: (18446744073709551615UL) , &options); }Executed by:
| 135 | ||||||||||||||||||
| 993 | } executed 135 times by 24 tests: (18446744073709551615UL) , &options); }Executed by:
| 135 | ||||||||||||||||||
| 994 | - | |||||||||||||||||||
| 995 | char * | - | ||||||||||||||||||
| 996 | quotearg_n_custom (int n, char const *left_quote, | - | ||||||||||||||||||
| 997 | char const *right_quote, char const *arg) | - | ||||||||||||||||||
| 998 | { | - | ||||||||||||||||||
| 999 | return quotearg_n_custom_mem (n, left_quote, right_quote, arg, | - | ||||||||||||||||||
| 1000 | never executed: (18446744073709551615UL) ); } | 0 | ||||||||||||||||||
| 1001 | (18446744073709551615UL) never executed: (18446744073709551615UL) ); } | 0 | ||||||||||||||||||
| 1002 | ); never executed: (18446744073709551615UL) ); } | 0 | ||||||||||||||||||
| 1003 | } never executed: (18446744073709551615UL) ); } | 0 | ||||||||||||||||||
| 1004 | - | |||||||||||||||||||
| 1005 | char * | - | ||||||||||||||||||
| 1006 | quotearg_n_custom_mem (int n, char const *left_quote, | - | ||||||||||||||||||
| 1007 | char const *right_quote, | - | ||||||||||||||||||
| 1008 | char const *arg, size_t argsize) | - | ||||||||||||||||||
| 1009 | { | - | ||||||||||||||||||
| 1010 | struct quoting_options o = default_quoting_options; | - | ||||||||||||||||||
| 1011 | set_custom_quoting (&o, left_quote, right_quote); | - | ||||||||||||||||||
| 1012 | return quotearg_n_options (n, arg, argsize, &o); | - | ||||||||||||||||||
| 1013 | } | 0 | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | char * | - | ||||||||||||||||||
| 1016 | quotearg_custom (char const *left_quote, char const *right_quote, | - | ||||||||||||||||||
| 1017 | char const *arg) | - | ||||||||||||||||||
| 1018 | { | - | ||||||||||||||||||
| 1019 | return quotearg_n_custom (0, left_quote, right_quote, arg); | - | ||||||||||||||||||
| 1020 | } | 0 | ||||||||||||||||||
| 1021 | - | |||||||||||||||||||
| 1022 | char * | - | ||||||||||||||||||
| 1023 | quotearg_custom_mem (char const *left_quote, char const *right_quote, | - | ||||||||||||||||||
| 1024 | char const *arg, size_t argsize) | - | ||||||||||||||||||
| 1025 | { | - | ||||||||||||||||||
| 1026 | return quotearg_n_custom_mem (0, left_quote, right_quote, arg, | - | ||||||||||||||||||
| 1027 | argsize); never executed: argsize); } | 0 | ||||||||||||||||||
| 1028 | } never executed: argsize); } | 0 | ||||||||||||||||||
| 1029 | - | |||||||||||||||||||
| 1030 | - | |||||||||||||||||||
| 1031 | - | |||||||||||||||||||
| 1032 | struct quoting_options quote_quoting_options = | - | ||||||||||||||||||
| 1033 | { | - | ||||||||||||||||||
| 1034 | locale_quoting_style, | - | ||||||||||||||||||
| 1035 | 0, | - | ||||||||||||||||||
| 1036 | { 0 }, | - | ||||||||||||||||||
| 1037 | - | |||||||||||||||||||
| 1038 | ((void *)0) | - | ||||||||||||||||||
| 1039 | , | - | ||||||||||||||||||
| 1040 | ((void *)0) | - | ||||||||||||||||||
| 1041 | - | |||||||||||||||||||
| 1042 | }; | - | ||||||||||||||||||
| 1043 | - | |||||||||||||||||||
| 1044 | char const * | - | ||||||||||||||||||
| 1045 | quote_n_mem (int n, char const *arg, size_t argsize) | - | ||||||||||||||||||
| 1046 | { | - | ||||||||||||||||||
| 1047 | return quotearg_n_options (n, arg, argsize, "e_quoting_options); | - | ||||||||||||||||||
| 1048 | } | 696 | ||||||||||||||||||
| 1049 | - | |||||||||||||||||||
| 1050 | char const * | - | ||||||||||||||||||
| 1051 | quote_mem (char const *arg, size_t argsize) | - | ||||||||||||||||||
| 1052 | { | - | ||||||||||||||||||
| 1053 | return quote_n_mem (0, arg, argsize); | - | ||||||||||||||||||
| 1054 | } | 0 | ||||||||||||||||||
| 1055 | - | |||||||||||||||||||
| 1056 | char const * | - | ||||||||||||||||||
| 1057 | quote_n (int n, char const *arg) | - | ||||||||||||||||||
| 1058 | { | - | ||||||||||||||||||
| 1059 | return quote_n_mem (n, arg, | - | ||||||||||||||||||
| 1060 | (18446744073709551615UL) executed 696 times by 56 tests: (18446744073709551615UL) ); }Executed by:
| 696 | ||||||||||||||||||
| 1061 | ); executed 696 times by 56 tests: (18446744073709551615UL) ); }Executed by:
| 696 | ||||||||||||||||||
| 1062 | } executed 696 times by 56 tests: (18446744073709551615UL) ); }Executed by:
| 696 | ||||||||||||||||||
| 1063 | - | |||||||||||||||||||
| 1064 | char const * | - | ||||||||||||||||||
| 1065 | quote (char const *arg) | - | ||||||||||||||||||
| 1066 | { | - | ||||||||||||||||||
| 1067 | return quote_n (0, arg); | - | ||||||||||||||||||
| 1068 | } | 593 | ||||||||||||||||||
| Switch to Source code | Preprocessed file |