OpenCoverage

quotearg.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/quotearg.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* quotearg.c - quote arguments for output-
2-
3 Copyright (C) 1998-2002, 2004-2018 Free Software Foundation, Inc.-
4-
5 This program is free software: you can redistribute it and/or modify-
6 it under the terms of the GNU General Public License as published by-
7 the Free Software Foundation; either version 3 of the License, or-
8 (at your option) any later version.-
9-
10 This program is distributed in the hope that it will be useful,-
11 but WITHOUT ANY WARRANTY; without even the implied warranty of-
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
13 GNU General Public License for more details.-
14-
15 You should have received a copy of the GNU General Public License-
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */-
17-
18/* Written by Paul Eggert <eggert@twinsun.com> */-
19-
20/* Without this pragma, gcc 4.7.0 20111124 mistakenly suggests that-
21 the quoting_options_from_style function might be candidate for-
22 attribute 'pure' */-
23#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__-
24# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"-
25#endif-
26-
27#include <config.h>-
28-
29#include "quotearg.h"-
30#include "quote.h"-
31-
32#include "minmax.h"-
33#include "xalloc.h"-
34#include "c-strcaseeq.h"-
35#include "localcharset.h"-
36-
37#include <ctype.h>-
38#include <errno.h>-
39#include <limits.h>-
40#include <stdbool.h>-
41#include <stdint.h>-
42#include <stdlib.h>-
43#include <string.h>-
44#include <wchar.h>-
45#include <wctype.h>-
46-
47#include "gettext.h"-
48#define _(msgid) gettext (msgid)-
49#define N_(msgid) msgid-
50-
51#ifndef SIZE_MAX-
52# define SIZE_MAX ((size_t) -1)-
53#endif-
54-
55#define INT_BITS (sizeof (int) * CHAR_BIT)-
56-
57#ifndef FALLTHROUGH-
58# if __GNUC__ < 7-
59# define FALLTHROUGH ((void) 0)-
60# else-
61# define FALLTHROUGH __attribute__ ((__fallthrough__))-
62# endif-
63#endif-
64-
65struct quoting_options-
66{-
67 /* Basic quoting style. */-
68 enum quoting_style style;-
69-
70 /* Additional flags. Bitwise combination of enum quoting_flags. */-
71 int flags;-
72-
73 /* Quote the characters indicated by this bit vector even if the-
74 quoting style would not normally require them to be quoted. */-
75 unsigned int quote_these_too[(UCHAR_MAX / INT_BITS) + 1];-
76-
77 /* The left quote for custom_quoting_style. */-
78 char const *left_quote;-
79-
80 /* The right quote for custom_quoting_style. */-
81 char const *right_quote;-
82};-
83-
84/* Names of quoting styles. */-
85char const *const quoting_style_args[] =-
86{-
87 "literal",-
88 "shell",-
89 "shell-always",-
90 "shell-escape",-
91 "shell-escape-always",-
92 "c",-
93 "c-maybe",-
94 "escape",-
95 "locale",-
96 "clocale",-
97 0-
98};-
99-
100/* Correspondences to quoting style names. */-
101enum quoting_style const quoting_style_vals[] =-
102{-
103 literal_quoting_style,-
104 shell_quoting_style,-
105 shell_always_quoting_style,-
106 shell_escape_quoting_style,-
107 shell_escape_always_quoting_style,-
108 c_quoting_style,-
109 c_maybe_quoting_style,-
110 escape_quoting_style,-
111 locale_quoting_style,-
112 clocale_quoting_style-
113};-
114-
115/* The default quoting options. */-
116static struct quoting_options default_quoting_options;-
117-
118/* Allocate a new set of quoting options, with contents initially identical-
119 to O if O is not null, or to the default if O is null.-
120 It is the caller's responsibility to free the result. */-
121struct quoting_options *-
122clone_quoting_options (struct quoting_options *o)-
123{-
124 int e = errno;-
125 struct quoting_options *p = xmemdup (o ? o : &default_quoting_options,-
126 sizeof *o);-
127 errno = e;-
128 return p;
executed 2332 times by 3 tests
Executed by:
  • dir
  • ls
  • vdir
2332
129}-
130-
131/* Get the value of O's quoting style. If O is null, use the default. */-
132enum quoting_style-
133get_quoting_style (struct quoting_options const *o)-
134{-
135 return (o ? o : &default_quoting_options)->style;
executed 2349 times by 4 tests
Executed by:
  • dir
  • ls
  • stat
  • vdir
2349
136}-
137-
138/* In O (or in the default if O is null),-
139 set the value of the quoting style to S. */-
140void-
141set_quoting_style (struct quoting_options *o, enum quoting_style s)-
142{-
143 (o ? o : &default_quoting_options)->style = s;-
144}
executed 236 times by 4 tests
Executed by:
  • dir
  • ls
  • stat
  • vdir
236
145-
146/* In O (or in the default if O is null),-
147 set the value of the quoting options for character C to I.-
148 Return the old value. Currently, the only values defined for I are-
149 0 (the default) and 1 (which means to quote the character even if-
150 it would not otherwise be quoted). */-
151int-
152set_char_quoting (struct quoting_options *o, char c, int i)-
153{-
154 unsigned char uc = c;-
155 unsigned int *p =-
156 (o ? o : &default_quoting_options)->quote_these_too + uc / INT_BITS;
Description
TRUEevaluated 1365 times by 27 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dir
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • paste
  • pathchk
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • ...
FALSEnever evaluated
0-1365
157 int shift = uc % INT_BITS;-
158 int r = (*p >> shift) & 1;-
159 *p ^= ((i & 1) ^ r) << shift;-
160 return r;
executed 1365 times by 27 tests
Executed by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dir
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • paste
  • pathchk
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • ...
1365
161}-
162-
163/* In O (or in the default if O is null),-
164 set the value of the quoting options flag to I, which can be a-
165 bitwise combination of enum quoting_flags, or 0 for default-
166 behavior. Return the old value. */-
167int-
168set_quoting_flags (struct quoting_options *o, int i)-
169{-
170 int r;-
171 if (!o)
=Description
TRUEnever evaluated
FALSEnever evaluated
0
172 o = &default_quoting_options;
never executed: = o->flags;
0
173 r = o->flags;-
174 o->flags = i;-
175 return r;
never executed
0
176}-
177-
178void-
179set_custom_quoting (struct quoting_options *o,-
180 char const *left_quote, char const *right_quote)-
181{-
182 if (!o)
=Description
TRUEnever evaluated
FALSEnever evaluated
0
183 o = &default_quoting_options;
never executed: >style = custom_quoting_style
0
184 o->style = custom_quoting_style;-
185 if (!left_quote || !right_quote)
ort ();Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
186 abort ();
never executed: >left_quo
0
187 o->left_quote = left_quote;-
188 o->right_quote = right_quote;-
189}
never executed
0
190-
191/* Return quoting options for STYLE, with no extra quoting. */-
192static struct quoting_options /* NOT PURE!! */-
193quoting_options_from_style (enum quoting_style style)-
194{-
195 struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL };-
196 if (style == custom_quoting_style)
ort ();Description
TRUEnever evaluated
FALSEevaluated 1443 times by 50 tests
Evaluated by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expr
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • numfmt
  • ...
0-1443
197 abort ();
never executed: style = s
0
198 o.style = style;-
199 return o;
executed 1443 times by 50 tests
Executed by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expr
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • numfmt
  • ...
1443
200}-
201-
202/* MSGID approximates a quotation mark. Return its translation if it-
203 has one; otherwise, return either it or "\"", depending on S.-
204-
205 S is either clocale_quoting_style or locale_quoting_style. */-
206static char const *-
207gettext_quote (char const *msgid, enum quoting_style s)-
208{-
209 char const *translation = _(msgid);-
210 char const *locale_code;-
211-
212 if (translation != msgid)
turn translation;Description
TRUEnever evaluated
FALSEevaluated 1638 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
0-1638
213 return translation;
never executed: cale_code = locale_
0
214-
215 /* For UTF-8 and GB-18030, use single quotes U+2018 and U+2019.-
216 Here is a list of other locales that include U+2018 and U+2019:-
217-
218 ISO-8859-7 0xA1 KOI8-T 0x91-
219 CP869 0x8B CP874 0x91-
220 CP932 0x81 0x65 CP936 0xA1 0xAE-
221 CP949 0xA1 0xAE CP950 0xA1 0xA5-
222 CP1250 0x91 CP1251 0x91-
223 CP1252 0x91 CP1253 0x91-
224 CP1254 0x91 CP1255 0x91-
225 CP1256 0x91 CP1257 0x91-
226 EUC-JP 0xA1 0xC6 EUC-KR 0xA1 0xAE-
227 EUC-TW 0xA1 0xE4 BIG5 0xA1 0xA5-
228 BIG5-HKSCS 0xA1 0xA5 EUC-CN 0xA1 0xAE-
229 GBK 0xA1 0xAE Georgian-PS 0x91-
230 PT154 0x91-
231-
232 None of these is still in wide use; using iconv is overkill. */-
233 locale_code = locale_charset ();-
234 if (STRCASEEQ (locale_code, "UTF-8", 'U','T','F','-','8',0,0,0,0))
turn msgid[0] ...\xe2\x80\x99";Description
TRUEnever evaluated
FALSEevaluated 1638 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
0-1638
235 return msgid[0] == '`' ? "\xe2\x80\x98": "\xe2\x80\x99";
never executed: (strcaseeq0 (locale_code, "GB18030", 'G', 'B', '1', '8'
0
236 if (STRCASEEQ (locale_code, "GB18030", 'G','B','1','8','0','3','0',0,0))
turn msgid[0] ...": "\xa1\xaf";Description
TRUEnever evaluated
FALSEevaluated 1638 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
0-1638
237 return msgid[0] == '`' ? "\xa1\ae": "\xa1\xaf";
never executed
0
238-
239 return (s == clocale_quoting_style ? "\"" : "'");
executed 1638 times by 58 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
1638
240}-
241-
242/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of-
243 argument ARG (of size ARGSIZE), using QUOTING_STYLE, FLAGS, and-
244 QUOTE_THESE_TOO to control quoting.-
245 Terminate the output with a null character, and return the written-
246 size of the output, not counting the terminating null.-
247 If BUFFERSIZE is too small to store the output string, return the-
248 value that would have been returned had BUFFERSIZE been large enough.-
249 If ARGSIZE is SIZE_MAX, use the string length of the argument for ARGSIZE.-
250-
251 This function acts like quotearg_buffer (BUFFER, BUFFERSIZE, ARG,-
252 ARGSIZE, O), except it breaks O into its component pieces and is-
253 not careful about errno. */-
254-
255static size_t-
256quotearg_buffer_restyled (char *buffer, size_t buffersize,-
257 char const *arg, size_t argsize,-
258 enum quoting_style quoting_style, int flags,-
259 unsigned int const *quote_these_too,-
260 char const *left_quote,-
261 char const *right_quote)-
262{-
263 size_t i;-
264 size_t len = 0;-
265 size_t orig_buffersize = 0;-
266 char const *quote_string = 0;-
267 size_t quote_string_len = 0;-
268 bool backslash_escapes = false;-
269 bool unibyte_locale = MB_CUR_MAX == 1;-
270 bool elide_outer_quotes = (flags & QA_ELIDE_OUTER_QUOTES) != 0;-
271 bool pending_shell_escape_end = false;-
272 bool encountered_single_quote = false;-
273 bool all_c_and_shell_quote_compat = true;-
274-
275#define STORE(c) \-
276 do \-
277 { \-
278 if (len < buffersize) \-
279 buffer[len] = (c); \-
280 len++; \-
281 } \-
282 while (0)-
283-
284#define START_ESC() \-
285 do \-
286 { \-
287 if (elide_outer_quotes) \-
288 goto force_outer_quoting_style; \-
289 escaping = true; \-
290 if (quoting_style == shell_always_quoting_style \-
291 && ! pending_shell_escape_end) \-
292 { \-
293 STORE ('\''); \-
294 STORE ('$'); \-
295 STORE ('\''); \-
296 pending_shell_escape_end = true; \-
297 } \-
298 STORE ('\\'); \-
299 } \-
300 while (0)-
301-
302#define END_ESC() \-
303 do \-
304 { \-
305 if (pending_shell_escape_end && ! escaping) \-
306 { \-
307 STORE ('\''); \-
308 STORE ('\''); \-
309 pending_shell_escape_end = false; \-
310 } \-
311 } \-
312 while (0)-
313-
314 process_input:
code before this statement executed 3544 times by 77 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
3544
315-
316 switch (quoting_style)-
317 {-
318 case c_maybe_quoting_style:
executed 2 times by 1 test: quoting_style = c_quoting
Executed by:
  • paste
2
319 quoting_style = c_quoting_style;-
320 elide_outer_quotes = true;-
321 FALLTHROUGH;-
322 case c_quoting_style:
code before this statement executed 2 times by 1 test: if (!elide_outer_qu
Executed by:
  • paste
executed 10 times by 3 tests: if (!elide_outer_qu
Executed by:
  • ls
  • printf
  • stat
2-10
323 if (!elide_outer_quotes)
{ if (len < bufferDescription
TRUEevaluated 10 times by 3 tests
Evaluated by:
  • ls
  • printf
  • stat
FALSEevaluated 2 times by 1 test
Evaluated by:
  • paste
2-10
324 STORE ('"');
executed 10 times by 3 tests
Executed by:
  • ls
  • printf
  • stat
executed 10 times by 3 tests
Executed by:
  • ls
  • printf
  • stat
scapes =Description
TRUEevaluated 10 times by 3 tests
Evaluated by:
  • ls
  • printf
  • stat
FALSEnever evaluated
0-10
325 backslash_escapes = true;-
326 quote_string = "\"";-
327 quote_string_len = 1;-
328 break;
executed 12 times by 4 tests
Executed by:
  • ls
  • paste
  • printf
  • stat
12
329-
330 case escape_quoting_style:
executed 46 times by 3 tests: backslash_escapes =
Executed by:
  • dir
  • ls
  • vdir
46
331 backslash_escapes = true;-
332 elide_outer_quotes = false;-
333 break;
executed 46 times by 3 tests
Executed by:
  • dir
  • ls
  • vdir
46
334-
335 case locale_quoting_style:
executed 815 times by 58 tests: case clocale_quoting_style
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
815
336 case clocale_quoting_style:
executed 4 times by 1 test: case custom_quoting_style:
Executed by:
  • ls
4
337 case custom_quoting_style:
never executed: {
0
338 {-
339 if (quoting_style != custom_quoting_style)
Description
TRUEevaluated 819 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-819
340 {-
341 /* TRANSLATORS:-
342 Get translations for open and closing quotation marks.-
343 The message catalog should translate "`" to a left-
344 quotation mark suitable for the locale, and similarly for-
345 "'". For example, a French Unicode local should translate-
346 these to U+00AB (LEFT-POINTING DOUBLE ANGLE-
347 QUOTATION MARK), and U+00BB (RIGHT-POINTING DOUBLE ANGLE-
348 QUOTATION MARK), respectively.-
349-
350 If the catalog has no translation, we will try to-
351 use Unicode U+2018 (LEFT SINGLE QUOTATION MARK) and-
352 Unicode U+2019 (RIGHT SINGLE QUOTATION MARK). If the-
353 current locale is not Unicode, locale_quoting_style-
354 will quote 'like this', and clocale_quoting_style will-
355 quote "like this". You should always include translations-
356 for "`" and "'" even if U+2018 and U+2019 are appropriate-
357 for your locale.-
358-
359 If you don't know what to put here, please see-
360 <https://en.wikipedia.org/wiki/Quotation_marks_in_other_languages>-
361 and use glyphs suitable for your language. */-
362 left_quote = gettext_quote (N_("`"), quoting_style);-
363 right_quote = gettext_quote (N_("'"), quoting_style);-
364 }
executed 819 times by 58 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
819
365 if (!elide_outer_quotes)
r (quote_string = lDescription
TRUEevaluated 819 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-819
366 for (quote_string = left_quote; *quote_string; quote_string++)
fer[len] = (*Description
TRUEevaluated 819 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 819 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
819
367 STORE (*quote_string);
executed 752 times by 58 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
executed 819 times by 58 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
apes =Description
TRUEevaluated 752 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 67 times by 14 tests
Evaluated by:
  • cp
  • date
  • dd
  • dir
  • numfmt
  • od
  • ptx
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
67-819
368 backslash_escapes = true;-
369 quote_string = right_quote;-
370 quote_string_len = strlen (quote_string);-
371 }-
372 break;
executed 819 times by 58 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
819
373-
374 case shell_escape_quoting_style:
executed 145 times by 25 tests: backslash_escapes =
Executed by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
145
375 backslash_escapes = true;-
376 FALLTHROUGH;-
377 case shell_quoting_style:
code before this statement executed 145 times by 25 tests: elide_outer_quotes =
Executed by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
executed 4 times by 1 test: elide_outer_quotes =
Executed by:
  • ls
4-145
378 elide_outer_quotes = true;-
379 FALLTHROUGH;-
380 case shell_escape_always_quoting_style:
code before this statement executed 149 times by 25 tests: if (!elide_outer_quotes)
Executed by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
executed 1407 times by 31 tests: if (!elide_outer_quotes)
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
149-1407
381 if (!elide_outer_quotes)
ckslash_escapes =Description
TRUEevaluated 1407 times by 31 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
FALSEevaluated 149 times by 25 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
149-1407
382 backslash_escapes = true;
executed 1407 times by 31 tests: 1 ; ((void) 0);
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
1407
383 FALLTHROUGH;-
384 case shell_always_quoting_style:
code before this statement executed 1556 times by 41 tests: quoting_style = shell_always_q
Executed by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • df
  • dircolors
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • pathchk
  • printf
  • readlink
  • realpath
  • ...
executed 4 times by 1 test: quoting_style = shell_always_q
Executed by:
  • ls
4-1556
385 quoting_style = shell_always_quoting_style;-
386 if (!elide_outer_quotes)
{ if (len < bufferDescription
TRUEevaluated 1411 times by 31 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
FALSEevaluated 149 times by 25 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
149-1411
387 STORE ('\'');
executed 1286 times by 31 tests
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
executed 1411 times by 31 tests
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
g = "'";Description
TRUEevaluated 1286 times by 31 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
FALSEevaluated 125 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • ginstall
  • ln
  • mv
  • rm
125-1411
388 quote_string = "'";-
389 quote_string_len = 1;-
390 break;
executed 1560 times by 41 tests
Executed by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • df
  • dircolors
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • pathchk
  • printf
  • readlink
  • realpath
  • ...
1560
391-
392 case literal_quoting_style:
executed 1107 times by 2 tests: elide_outer_quotes =
Executed by:
  • ls
  • stat
1107
393 elide_outer_quotes = false;-
394 break;
executed 1107 times by 2 tests
Executed by:
  • ls
  • stat
1107
395-
396 default:
never executed: abort
0
397 abort ();
never executed
0
398 }-
399-
400 for (i = 0; ! (argsize == SIZE_MAX ? arg[i] == '\0' : i == argsize); i++)
(1844674407370...gsize); i++) {Description
TRUEevaluated 42132 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 3520 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
(1844674407370... arg[i] == '\0Description
TRUEnever evaluated
FALSEnever evaluated
0-42132
401 {-
402 unsigned char c;-
403 unsigned char esc;-
404 bool is_right_quote = false;-
405 bool escaping = false;-
406 bool c_and_shell_quote_compat = false;-
407-
408 if (backslash_escapes
&& quoting_styleDescription
TRUEevaluated 14648 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 27484 times by 2 tests
Evaluated by:
  • ls
  • stat
14648-27484
409 && quoting_style != shell_always_quoting_style
quote_string_lenDescription
TRUEevaluated 5270 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 9378 times by 41 tests
Evaluated by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • df
  • dircolors
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • pathchk
  • printf
  • readlink
  • realpath
  • ...
5270-9378
410 && quote_string_len
(i + quote_strinDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 292 times by 3 tests
Evaluated by:
  • dir
  • ls
  • vdir
292-4978
411 && (i + quote_string_len
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-4978
412 <= (argsize == SIZE_MAX && 1 < quote_string_len
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
(1844674407370...& 1 < quote_stDescription
TRUEevaluated 4971 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 7 times by 1 test
Evaluated by:
  • dd
Description
TRUEnever evaluated
FALSEevaluated 4971 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
0-4978
413 /* Use strlen only if we must: when argsize is SIZE_MAX,
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-4978
414 and when the quote string is more than 1 byte long.
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-4978
415 If we do call strlen, save the result. */
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-4978
416 ? (argsize = strlen (arg)) : argsize))
<= (argsize ==..., quote_stringDescription
TRUEevaluated 4978 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEnever evaluated
0-4978
417 && memcmp (arg + i, quote_string, quote_string_len) == 0)
Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • numfmt
  • stat
FALSEevaluated 4976 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
2-4976
418 {-
419 if (elide_outer_quotes)
to force_outer_quoDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • numfmt
  • stat
0-2
420 goto force_outer_quoting_style;
never executed: _right_quote =
0
421 is_right_quote = true;-
422 }
executed 2 times by 2 tests
Executed by:
  • numfmt
  • stat
2
423-
424 c = arg[i];-
425 switch (c)-
426 {-
427 case '\0':
never executed: if (back
0
428 if (backslash_escapes)
Description
TRUEnever evaluated
FALSEnever evaluated
0
429 {-
430 START_ESC ();
never executed
never executed
never executed
never executed
never executed
never executed
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
431 /* If quote_string were to begin with digits, we'd need to-
432 test for the end of the arg as well. However, it's-
433 hard to imagine any locale that would use digits in-
434 quotes, and set_custom_quoting is documented not to-
435 accept them. Use only a single \0 with shell-escape-
436 as currently digits are not printed within $'...' */-
437 if (quoting_style != shell_always_quoting_style
&& i + 1 < arg... arg[i + 1] &&Description
TRUEnever evaluated
FALSEnever evaluated
0
438 && i + 1 < argsize && '0' <= arg[i + 1] && arg[i + 1] <= '9')
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
439 {-
440 STORE ('0');
never executed: buffer[len] = ('0');
len < buffersizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
441 STORE ('0');
never executed
Description
TRUEnever evaluated
FALSEnever evaluated
0
442 }
never executed: =
0
443 c = '0';-
444 /* We don't have to worry that this last '0' will be-
445 backslash-escaped because, again, quote_string should-
446 not start with it and because quote_these_too is-
447 documented as not accepting it. */-
448 }
never executed: s
0
449 else if (flags & QA_ELIDE_NULL_BYTES)
e;Description
TRUEnever evaluated
FALSEnever evaluated
0
450 continue;
never executed: eak;
0
451 break;
never executed
0
452-
453 case '?':
executed 10 times by 1 test: switch
Executed by:
  • stat
10
454 switch (quoting_style)-
455 {-
456 case shell_always_quoting_style:
executed 10 times by 1 test: if (elide_outer_quotes)
Executed by:
  • stat
10
457 if (elide_outer_quotes)
to force_outer_quoDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • stat
0-10
458 goto force_outer_quoting_style;
never executed: eak;
0
459 break;
executed 10 times by 1 test
Executed by:
  • stat
10
460-
461 case c_quoting_style:
never executed: if ((flags & QA_SPL
0
462 if ((flags & QA_SPLIT_TRIGRAPHS)
&& i + 2 < argsize && arg[iDescription
TRUEnever evaluated
FALSEnever evaluated
0
463 && i + 2 < argsize && arg[i + 1] == '?')
h (arg[i + 2])Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
464 switch (arg[i + 2])-
465 {-
466 case '!': case '\'':
never executed: case '(':
never executed: case ')':
0
467 case '(': case ')': case '-': case '/':
never executed: case '<':
never executed: case '=':
never executed: case '>':
never executed
0
468 case '<': case '=': case '>':
never executed
never executed
never executed
0
469 /* Escape the second '?' in what would otherwise be-
470 a trigraph. */-
471 if (elide_outer_quotes)
to force_outer_quoDescription
TRUEnever evaluated
FALSEnever evaluated
0
472 goto force_outer_quoting_style;
never executed: = arg[i + 2];
0
473 c = arg[i + 2];-
474 i += 2;-
475 STORE ('?');
never executed: buffer[len] = ('"');
len < buffersizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
476 STORE ('"');
never executed: buffer[len] = ('"');
len < buffersizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
477 STORE ('"');
never executed: buffer[len] = ('?');
len < buffersizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
478 STORE ('?');
never executed
Description
TRUEnever evaluated
FALSEnever evaluated
0
479 break;
never executed
0
480-
481 default:
never executed: break;
0
482 break;
never executed
0
483 }-
484 break;
never executed
0
485-
486 default:
never executed: break;
0
487 break;
never executed
0
488 }-
489 break;
executed 10 times by 1 test
Executed by:
  • stat
10
490-
491 case '\a': esc = 'a'; goto c_escape;
executed 44 times by 1 test: goto c_escape;
Executed by:
  • ls
executed 44 times by 1 test: case '\b':
Executed by:
  • ls
44
492 case '\b': esc = 'b'; goto c_escape;
never executed: goto c_escape;
never executed: case '\f':
0
493 case '\f': esc = 'f'; goto c_escape;
never executed: goto c_and_she
never executed: case '\n':
0
494 case '\n': esc = 'n'; goto c_and_shell_escape;
executed 2 times by 1 test: goto c_and_shell_escape;
Executed by:
  • wc
executed 2 times by 1 test: case '\r':
Executed by:
  • wc
2
495 case '\r': esc = 'r'; goto c_and_shell_escape;
executed 2 times by 1 test: goto c_and_shell_escape;
Executed by:
  • printf
executed 2 times by 1 test: case '\t':
Executed by:
  • printf
2
496 case '\t': esc = 't'; goto c_and_shell_escape;
never executed: goto c_escape;
never executed: case '\v':
0
497 case '\v': esc = 'v'; goto c_escape;
never executed
never executed: case '\\':
0
498 case '\\': esc = c;
executed 2 times by 1 test
Executed by:
  • paste
2
499 /* Never need to escape '\' in shell case. */-
500 if (quoting_style == shell_always_quoting_style)
Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • paste
0-2
501 {-
502 if (elide_outer_quotes)
to force_outer_quoDescription
TRUEnever evaluated
FALSEnever evaluated
0
503 goto force_outer_quoting_style;
never executed: to store_c;
0
504 goto store_c;
never executed
0
505 }-
506-
507 /* No need to escape the escape if we are trying to elide-
508 outer quotes and nothing else is problematic. */-
509 if (backslash_escapes && elide_outer_quotes && quote_string_len)
to store_c;Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • paste
FALSEnever evaluated
Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • paste
FALSEnever evaluated
Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • paste
FALSEnever evaluated
0-2
510 goto store_c;
executed 2 times by 1 test
Executed by:
  • paste
2
511-
512 c_and_shell_escape:
code before this statement never executed: if (quoting_style
0
513 if (quoting_style == shell_always_quoting_style
&& elide_outer_quotes)Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • printf
  • wc
FALSEnever evaluated
0-4
514 && elide_outer_quotes)
force_outer_quotinDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • wc
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • wc
2
515 goto force_outer_quoting_style;
executed 2 times by 2 tests
Executed by:
  • printf
  • wc
2
516 /* fall through */-
517 c_escape:
code before this statement executed 2 times by 2 tests: if (bac
Executed by:
  • printf
  • wc
2
518 if (backslash_escapes)
Description
TRUEevaluated 28 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEevaluated 18 times by 1 test
Evaluated by:
  • ls
18-28
519 {-
520 c = esc;-
521 goto store_escape;
executed 28 times by 3 tests
Executed by:
  • ls
  • printf
  • wc
28
522 }-
523 break;
executed 18 times by 1 test
Executed by:
  • ls
18
524-
525 case '{': case '}': /* sometimes special if isolated */
never executed: if (! (
never executed: rgsize ==
0
526 if (! (argsize == SIZE_MAX ? arg[1] == '\0' : argsize == 1))
(1844674407370... == 1)) break;Description
TRUEnever evaluated
FALSEnever evaluated
(1844674407370... arg[1] == '\0Description
TRUEnever evaluated
FALSEnever evaluated
0
527 break;
never executed: void)
0
528 FALLTHROUGH;-
529 case '#': case '~':
code before this statement never executed: if (i !
never executed: if (i !
executed 21 times by 4 tests: 0)
Executed by:
  • cp
  • ls
  • mv
  • printf
0-21
530 if (i != 0)
eak;Description
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • cp
  • ls
  • mv
  • printf
FALSEevaluated 2 times by 1 test
Evaluated by:
  • printf
2-19
531 break;
executed 19 times by 4 tests: void)
Executed by:
  • cp
  • ls
  • mv
  • printf
19
532 FALLTHROUGH;-
533 case ' ':
code before this statement executed 2 times by 1 test: c_and_s
Executed by:
  • printf
executed 67 times by 11 tests: c_and_s
Executed by:
  • date
  • dd
  • head
  • join
  • numfmt
  • printf
  • sort
  • tac
  • tail
  • tee
  • touch
2-67
534 c_and_shell_quote_compat = true;-
535 FALLTHROUGH;-
536 case '!': /* special in bash */
code before this statement executed 69 times by 11 tests: case '"':
Executed by:
  • date
  • dd
  • head
  • join
  • numfmt
  • printf
  • sort
  • tac
  • tail
  • tee
  • touch
never executed: case '"':
0-69
537 case '"': case '$': case '&':
executed 6 times by 2 tests: case '(':
Executed by:
  • date
  • printf
never executed: case ')':
never executed: case '*':
0-6
538 case '(': case ')': case '*': case ';':
never executed: case '<':
never executed
executed 30 times by 1 test
Executed by:
  • stat
never executed
0-30
539 case '<':
never executed: case '=':
0
540 case '=': /* sometimes special in 0th or (with "set -k") later args */
executed 3 times by 2 tests: case '>':
Executed by:
  • date
  • env
3
541 case '>': case '[':
executed 1 time by 1 test: case '^':
Executed by:
  • truncate
never executed
0-1
542 case '^': /* special in old /bin/sh, e.g. SunOS 4.1.4 */
executed 3 times by 1 test: case '`':
Executed by:
  • ptx
3
543 case '`': case '|':
never executed
never executed
0
544 /* A shell special character. In theory, '$' and '`' could-
545 be the first bytes of multibyte characters, which means-
546 we should check them with mbrtowc, but in practice this-
547 doesn't happen so it's not worth worrying about. */-
548 if (quoting_style == shell_always_quoting_style
&& elide_outer_quotes)Description
TRUEevaluated 75 times by 7 tests
Evaluated by:
  • dd
  • head
  • printf
  • stat
  • tac
  • tail
  • tee
FALSEevaluated 37 times by 9 tests
Evaluated by:
  • date
  • env
  • join
  • numfmt
  • printf
  • ptx
  • sort
  • touch
  • truncate
37-75
549 && elide_outer_quotes)
force_outer_quotinDescription
TRUEevaluated 17 times by 4 tests
Evaluated by:
  • dd
  • printf
  • tac
  • tee
FALSEevaluated 58 times by 7 tests
Evaluated by:
  • dd
  • head
  • printf
  • stat
  • tac
  • tail
  • tee
17-58
550 goto force_outer_quoting_style;
executed 17 times by 4 tests: eak;
Executed by:
  • dd
  • printf
  • tac
  • tee
17
551 break;
executed 95 times by 15 tests
Executed by:
  • date
  • dd
  • env
  • head
  • join
  • numfmt
  • printf
  • ptx
  • sort
  • stat
  • tac
  • tail
  • tee
  • touch
  • truncate
95
552-
553 case '\'':
executed 7 times by 3 tests: encounte
Executed by:
  • numfmt
  • printf
  • stat
7
554 encountered_single_quote = true;-
555 c_and_shell_quote_compat = true;-
556 if (quoting_style == shell_always_quoting_style)
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • printf
  • stat
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • numfmt
  • printf
  • stat
3-4
557 {-
558 if (elide_outer_quotes)
to force_outer_quoDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • printf
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
1-2
559 goto force_outer_quoting_style;
executed 1 time by 1 test
Executed by:
  • printf
1
560-
561 if (buffersize && ! orig_buffersize)
Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
FALSEnever evaluated
Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
FALSEnever evaluated
0-2
562 {-
563 /* Just scan string to see if supports a more concise-
564 representation, rather than writing a longer string-
565 but returning the length of the more concise form. */-
566 orig_buffersize = buffersize;-
567 buffersize = 0;-
568 }
executed 2 times by 2 tests
Executed by:
  • printf
  • stat
2
569-
570 STORE ('\'');
never executed: buffer[len] = ('\\');
len < buffersizeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
0-2
571 STORE ('\\');
never executed: buffer[len] = ('\'');
len < buffersizeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
0-2
572 STORE ('\'');
never executed
hell_escape_endDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
0-2
573 pending_shell_escape_end = false;-
574 }
executed 2 times by 2 tests: e
Executed by:
  • printf
  • stat
2
575 break;
executed 6 times by 3 tests
Executed by:
  • numfmt
  • printf
  • stat
6
576-
577 case '%': case '+': case ',': case '-': case '.': case '/':
executed 21 times by 3 tests: case '0':
Executed by:
  • numfmt
  • seq
  • stat
executed 12 times by 7 tests: case '1':
Executed by:
  • chmod
  • expr
  • numfmt
  • sort
  • tail
  • timeout
  • truncate
executed 4 times by 2 tests: case '2':
Executed by:
  • chmod
  • sort
executed 1168 times by 51 tests: case '3':
Executed by:
  • b2sum
  • base32
  • base64
  • cat
  • chgrp
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • date
  • dd
  • dir
  • du
  • env
  • expand
  • fmt
  • fold
  • head
  • kill
  • ln
  • ls
  • mv
  • nl
  • nohup
  • ...
executed 1350 times by 27 tests: case '4':
Executed by:
  • b2sum
  • cat
  • chown
  • cp
  • dir
  • du
  • env
  • ginstall
  • ls
  • md5sum
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • rm
  • seq
  • sha1sum
  • shred
  • sort
  • split
  • stdbuf
  • tee
  • timeout
  • truncate
  • ...
executed 5842 times by 30 tests: case '5':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • date
  • du
  • env
  • expand
  • ginstall
  • ln
  • ls
  • mktemp
  • mv
  • nohup
  • pathchk
  • readlink
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • stty
  • ...
4-5842
578 case '0': case '1': case '2': case '3': case '4': case '5':
executed 286 times by 26 tests: case '6':
Executed by:
  • base32
  • base64
  • chmod
  • chown
  • csplit
  • cut
  • date
  • dd
  • dir
  • du
  • expand
  • ls
  • mv
  • numfmt
  • pr
  • rm
  • seq
  • shred
  • sort
  • split
  • stat
  • stdbuf
  • test
  • tr
  • truncate
  • ...
executed 273 times by 39 tests: case '7':
Executed by:
  • base32
  • base64
  • cat
  • chown
  • cp
  • csplit
  • cut
  • dir
  • du
  • expand
  • fmt
  • groups
  • kill
  • ls
  • md5sum
  • mv
  • nice
  • nproc
  • numfmt
  • od
  • printf
  • readlink
  • realpath
  • rm
  • seq
  • ...
executed 221 times by 22 tests: case '8':
Executed by:
  • cp
  • date
  • dir
  • du
  • expr
  • fmt
  • groups
  • ls
  • mv
  • numfmt
  • od
  • printf
  • rm
  • shred
  • sleep
  • sort
  • split
  • tail
  • timeout
  • truncate
  • vdir
  • wc
executed 112 times by 20 tests: case '9':
Executed by:
  • cp
  • csplit
  • cut
  • date
  • du
  • expand
  • fmt
  • ginstall
  • groups
  • ls
  • mv
  • numfmt
  • printf
  • rm
  • shred
  • sort
  • split
  • stdbuf
  • timeout
  • truncate
executed 250 times by 19 tests: case ':':
Executed by:
  • cp
  • cut
  • date
  • du
  • expand
  • fmt
  • ginstall
  • ls
  • mv
  • numfmt
  • printf
  • rm
  • shred
  • sleep
  • sort
  • split
  • stdbuf
  • timeout
  • truncate
executed 81 times by 15 tests
Executed by:
  • cut
  • du
  • expand
  • ls
  • md5sum
  • mv
  • numfmt
  • rm
  • sha1sum
  • shred
  • sort
  • split
  • stdbuf
  • timeout
  • truncate
81-286
579 case '6': case '7': case '8': case '9': case ':':
executed 101 times by 19 tests: case 'A':
Executed by:
  • cut
  • date
  • dir
  • du
  • expand
  • fmt
  • ls
  • mv
  • numfmt
  • od
  • printf
  • shred
  • sort
  • split
  • stat
  • stdbuf
  • timeout
  • truncate
  • vdir
executed 119 times by 18 tests: case 'B':
Executed by:
  • chmod
  • cut
  • dir
  • du
  • expand
  • fmt
  • ls
  • mv
  • numfmt
  • printf
  • shred
  • sort
  • split
  • stat
  • stdbuf
  • timeout
  • truncate
  • vdir
executed 110 times by 17 tests: case 'C':
Executed by:
  • chmod
  • cp
  • cut
  • du
  • expand
  • fmt
  • ls
  • mv
  • numfmt
  • printf
  • shred
  • sort
  • split
  • stdbuf
  • timeout
  • tr
  • truncate
executed 465 times by 18 tests: case 'D':
Executed by:
  • cut
  • date
  • du
  • expand
  • expr
  • ls
  • mv
  • numfmt
  • pr
  • printf
  • shred
  • sort
  • split
  • stat
  • stdbuf
  • tail
  • timeout
  • truncate
executed 8 times by 4 tests: case 'E':
Executed by:
  • chown
  • date
  • expr
  • groups
8-465
580 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
executed 28 times by 8 tests: case 'G':
Executed by:
  • date
  • join
  • kill
  • ls
  • mv
  • numfmt
  • shuf
  • touch
executed 11 times by 3 tests: case 'H':
Executed by:
  • ls
  • mv
  • numfmt
executed 126 times by 4 tests: case 'I':
Executed by:
  • chcon
  • join
  • ls
  • numfmt
executed 15 times by 7 tests: case 'J':
Executed by:
  • cp
  • join
  • kill
  • ls
  • numfmt
  • sleep
  • timeout
executed 14 times by 3 tests: case 'K':
Executed by:
  • date
  • join
  • ls
executed 34 times by 5 tests: case 'L':
Executed by:
  • ginstall
  • join
  • ln
  • ls
  • numfmt
11-126
581 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
executed 9 times by 1 test: case 'M':
Executed by:
  • ls
executed 13 times by 3 tests: case 'N':
Executed by:
  • join
  • ls
  • numfmt
executed 17 times by 4 tests: case 'O':
Executed by:
  • join
  • kill
  • ls
  • numfmt
executed 7 times by 2 tests: case 'P':
Executed by:
  • ls
  • numfmt
executed 7 times by 2 tests: case 'Q':
Executed by:
  • ls
  • numfmt
executed 15 times by 4 tests: case 'R':
Executed by:
  • join
  • kill
  • ls
  • numfmt
7-17
582 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
executed 25 times by 5 tests: case 'S':
Executed by:
  • join
  • ls
  • numfmt
  • touch
  • vdir
executed 28 times by 7 tests: case 'T':
Executed by:
  • chcon
  • join
  • kill
  • ls
  • nproc
  • numfmt
  • seq
executed 14 times by 4 tests: case 'U':
Executed by:
  • chcon
  • ginstall
  • ls
  • numfmt
executed 11 times by 2 tests: case 'V':
Executed by:
  • ls
  • touch
executed 22 times by 2 tests: case 'W':
Executed by:
  • ls
  • numfmt
executed 4 times by 3 tests: case 'X':
Executed by:
  • join
  • ls
  • numfmt
4-28
583 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
executed 125 times by 3 tests: case 'Y':
Executed by:
  • ls
  • numfmt
  • touch
executed 8 times by 4 tests: case 'Z':
Executed by:
  • date
  • du
  • ls
  • touch
executed 13 times by 4 tests: case ']':
Executed by:
  • du
  • join
  • ls
  • numfmt
executed 13 times by 3 tests: case '_':
Executed by:
  • kill
  • ls
  • numfmt
executed 17 times by 2 tests: case 'a':
Executed by:
  • ls
  • numfmt
executed 44 times by 4 tests: case 'b':
Executed by:
  • ls
  • mktemp
  • numfmt
  • rm
8-125
584 case 'Y': case 'Z': case ']': case '_': case 'a': case 'b':
executed 8 times by 2 tests: case 'c':
Executed by:
  • ls
  • numfmt
executed 21 times by 4 tests: case 'd':
Executed by:
  • date
  • dir
  • ls
  • vdir
never executed: case 'e':
executed 72 times by 11 tests: case 'f':
Executed by:
  • cp
  • df
  • env
  • ginstall
  • kill
  • mv
  • nice
  • numfmt
  • stdbuf
  • tail
  • timeout
executed 1726 times by 44 tests: case 'g':
Executed by:
  • b2sum
  • chmod
  • chown
  • comm
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • ginstall
  • groups
  • head
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • ...
executed 792 times by 23 tests: case 'h':
Executed by:
  • chmod
  • cp
  • dir
  • du
  • env
  • ginstall
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • numfmt
  • od
  • printf
  • rm
  • seq
  • shred
  • shuf
  • split
  • tail
  • truncate
  • uniq
  • vdir
0-1726
585 case 'c': case 'd': case 'e': case 'f': case 'g': case 'h':
executed 1829 times by 31 tests: case 'i':
Executed by:
  • b2sum
  • basename
  • cat
  • comm
  • cp
  • date
  • dir
  • du
  • env
  • fmt
  • ginstall
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • rm
  • shred
  • sort
  • split
  • stdbuf
  • tac
  • ...
executed 530 times by 43 tests: case 'j':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • ginstall
  • groups
  • head
  • id
  • kill
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nohup
  • numfmt
  • od
  • realpath
  • rm
  • ...
executed 3353 times by 47 tests: case 'k':
Executed by:
  • b2sum
  • base32
  • base64
  • cat
  • chmod
  • chown
  • cp
  • csplit
  • date
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • fmt
  • fold
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nl
  • nproc
  • numfmt
  • ...
executed 719 times by 29 tests: case 'l':
Executed by:
  • chmod
  • cp
  • date
  • dir
  • fmt
  • ginstall
  • id
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • numfmt
  • od
  • pathchk
  • ptx
  • realpath
  • rm
  • sha1sum
  • shred
  • sort
  • split
  • sync
  • tail
  • tee
  • ...
executed 1185 times by 21 tests: case 'm':
Executed by:
  • chmod
  • chown
  • cp
  • df
  • dir
  • du
  • expr
  • ls
  • mv
  • numfmt
  • od
  • rm
  • seq
  • sort
  • split
  • tail
  • touch
  • tsort
  • uniq
  • vdir
  • wc
executed 766 times by 47 tests: case 'n':
Executed by:
  • b2sum
  • base32
  • base64
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • date
  • dir
  • du
  • env
  • expand
  • expr
  • fmt
  • fold
  • head
  • id
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nice
  • nl
  • ...
530-3353
586 case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
executed 1712 times by 39 tests: case 'o':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • env
  • fmt
  • ginstall
  • groups
  • id
  • kill
  • ln
  • ls
  • mktemp
  • mv
  • numfmt
  • od
  • pathchk
  • realpath
  • rm
  • ...
executed 8 times by 4 tests: case 'p':
Executed by:
  • du
  • ls
  • numfmt
  • split
executed 156 times by 24 tests: case 'q':
Executed by:
  • b2sum
  • base32
  • base64
  • cat
  • chgrp
  • chown
  • cp
  • dd
  • dircolors
  • env
  • ln
  • ls
  • mv
  • nohup
  • numfmt
  • rm
  • shred
  • sort
  • split
  • stat
  • tail
  • touch
  • truncate
  • vdir
executed 1281 times by 49 tests: case 'r':
Executed by:
  • b2sum
  • base32
  • base64
  • cat
  • chgrp
  • chmod
  • chown
  • cp
  • csplit
  • date
  • dd
  • dir
  • du
  • env
  • expand
  • expr
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ln
  • ls
  • mv
  • nl
  • ...
executed 791 times by 26 tests: case 's':
Executed by:
  • cp
  • date
  • dd
  • dir
  • du
  • env
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nohup
  • numfmt
  • printf
  • ptx
  • rm
  • seq
  • sha1sum
  • shred
  • sort
  • split
  • tail
  • touch
  • truncate
  • vdir
  • ...
executed 1569 times by 45 tests: case 't':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • comm
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expr
  • fmt
  • groups
  • head
  • kill
  • ln
  • ls
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • od
  • ...
8-1712
587 case 'o': case 'p': case 'q': case 'r': case 's': case 't':
executed 2457 times by 45 tests: case 'u':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • comm
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • env
  • fmt
  • head
  • id
  • kill
  • ln
  • ls
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • printf
  • ptx
  • ...
executed 1644 times by 42 tests: case 'v':
Executed by:
  • b2sum
  • base32
  • base64
  • chown
  • cp
  • csplit
  • date
  • dd
  • dir
  • du
  • env
  • expand
  • fold
  • head
  • id
  • kill
  • ln
  • ls
  • mktemp
  • mv
  • nl
  • nproc
  • numfmt
  • od
  • pr
  • ...
executed 178 times by 5 tests: case 'w':
Executed by:
  • dir
  • ls
  • numfmt
  • split
  • vdir
executed 2666 times by 36 tests: case 'x':
Executed by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • ginstall
  • head
  • ln
  • ls
  • mktemp
  • mv
  • numfmt
  • ptx
  • realpath
  • rm
  • seq
  • shred
  • shuf
  • sort
  • ...
executed 3575 times by 39 tests: case 'y':
Executed by:
  • b2sum
  • cat
  • chgrp
  • chown
  • comm
  • cp
  • date
  • dd
  • df
  • dir
  • du
  • env
  • fmt
  • ginstall
  • head
  • id
  • ln
  • ls
  • md5sum
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • rm
  • ...
executed 1399 times by 34 tests: case 'z':
Executed by:
  • cat
  • chgrp
  • chmod
  • chown
  • cp
  • date
  • dd
  • df
  • dir
  • env
  • expr
  • ginstall
  • head
  • id
  • ln
  • ls
  • mktemp
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • ...
178-3575
588 case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
executed 1225 times by 35 tests: c_and_s
Executed by:
  • cat
  • chmod
  • comm
  • cp
  • dd
  • dir
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mktemp
  • mv
  • nice
  • nohup
  • numfmt
  • printf
  • rm
  • seq
  • shred
  • shuf
  • sort
  • split
  • ...
executed 593 times by 14 tests: ell_quote
Executed by:
  • cp
  • dir
  • groups
  • ls
  • mv
  • numfmt
  • shred
  • sleep
  • sort
  • split
  • tee
  • timeout
  • truncate
  • vdir
executed 280 times by 12 tests: compat =
Executed by:
  • chmod
  • cp
  • dir
  • ls
  • mv
  • numfmt
  • rm
  • shred
  • split
  • stat
  • sync
  • vdir
executed 146 times by 27 tests
Executed by:
  • base32
  • base64
  • chgrp
  • chmod
  • cp
  • csplit
  • dd
  • df
  • dir
  • du
  • env
  • fmt
  • ginstall
  • id
  • join
  • ls
  • numfmt
  • od
  • pathchk
  • pr
  • ptx
  • rm
  • sort
  • split
  • stat
  • ...
executed 106 times by 20 tests
Executed by:
  • chgrp
  • chmod
  • cp
  • dd
  • dir
  • du
  • env
  • ln
  • ls
  • mv
  • numfmt
  • rm
  • shred
  • sleep
  • sort
  • split
  • tail
  • touch
  • truncate
  • vdir
executed 101 times by 12 tests
Executed by:
  • dir
  • ls
  • md5sum
  • numfmt
  • printf
  • rm
  • sha1sum
  • shred
  • split
  • tail
  • truncate
  • vdir
101-1225
589 /* These characters don't cause problems, no matter what the-
590 quoting style is. They cannot start multibyte sequences.-
591 A digit or a special letter would cause trouble if it-
592 appeared at the beginning of quote_string because we'd then-
593 escape by prepending a backslash. However, it's hard to-
594 imagine any locale that would use digits or letters as-
595 quotes, and set_custom_quoting is documented not to accept-
596 them. Also, a digit or a special letter would cause-
597 trouble if it appeared in quote_these_too, but that's also-
598 documented as not accepting them. */-
599 c_and_shell_quote_compat = true;-
600 break;
executed 41931 times by 76 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
41931
601-
602 default:
executed 3 times by 2 tests
Executed by:
  • date
  • ls
3
603 /* If we have a multibyte sequence, copy it until we reach-
604 its end, find an error, or come back to the initial shift-
605 state. For C-like styles, if the sequence has-
606 unprintable characters, escape the whole sequence, since-
607 we can't easily escape single characters within it. */-
608 {-
609 /* Length of multibyte sequence found so far. */-
610 size_t m;-
611-
612 bool printable;-
613-
614 if (unibyte_locale)
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
615 {-
616 m = 1;-
617 printable = isprint (c) != 0;-
618 }
executed 3 times by 2 tests: s
Executed by:
  • date
  • ls
3
619 else-
620 {-
621 mbstate_t mbstate;-
622 memset (&mbstate, 0, sizeof mbstate);-
623-
624 m = 0;-
625 printable = true;-
626 if (argsize == SIZE_MAX)
(18446744073709551615UL) )Description
TRUEnever evaluated
FALSEnever evaluated
0
627 argsize = strlen (arg);
never executed
0
628-
629 do-
630 {-
631 wchar_t w;-
632 size_t bytes = mbrtowc (&w, &arg[i + m],-
633 argsize - (i + m), &mbstate);-
634 if (bytes == 0)
eak;Description
TRUEnever evaluated
FALSEnever evaluated
0
635 break;
never executed: se if
0
636 else if (bytes == (size_t) -1)
Description
TRUEnever evaluated
FALSEnever evaluated
0
637 {-
638 printable = false;-
639 break;
never executed
0
640 }-
641 else if (bytes == (size_t) -2)
Description
TRUEnever evaluated
FALSEnever evaluated
0
642 {-
643 printable = false;-
644 while (i + m < argsize && arg[i + m])
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
645 m++;
never executed: eak;
0
646 break;
never executed
0
647 }-
648 else-
649 {-
650 /* Work around a bug with older shells that "see" a '\'-
651 that is really the 2nd byte of a multibyte character.-
652 In practice the problem is limited to ASCII-
653 chars >= '@' that are shell special chars. */-
654 if ('[' == 0x5b && elide_outer_quotes
&& quoting_Description
TRUEnever evaluated
FALSEnever evaluated
e == shell_always_Description
TRUEnever evaluated
FALSEnever evaluated
0
655 && quoting_style == shell_always_quoting_style)
Description
TRUEnever evaluated
FALSEnever evaluated
0
656 {-
657 size_t j;-
658 for (j = 1; j < bytes; j++)
g[i + m +Description
TRUEnever evaluated
FALSEnever evaluated
0
659 switch (arg[i + m + j])-
660 {-
661 case '[': case '\\': case '^':
never executed: case '`':
never executed: case '|':
never executed
0
662 case '`': case '|':
never executed: goto fo
never executed: ce_outer_
0
663 goto force_outer_quoting_style;
never executed
0
664-
665 default:
never executed: break;
0
666 break;
never executed
0
667 }-
668 }
never executed
0
669-
670 if (! iswprint (w))
intable =Description
TRUEnever evaluated
FALSEnever evaluated
0
671 printable = false;
never executed: 0 ; m += bytes;
0
672 m += bytes;-
673 }
never executed
0
674 }-
675 while (! mbsinit (&mbstate));
Description
TRUEnever evaluated
FALSEnever evaluated
0
676 }
never executed
0
677-
678 c_and_shell_quote_compat = printable;-
679-
680 if (1 < m || (backslash_escapes && ! printable))
Description
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
681 {-
682 /* Output a multibyte sequence, or an escaped-
683 unprintable unibyte character. */-
684 size_t ilim = i + m;-
685-
686 for (;;)-
687 {-
688 if (backslash_escapes && ! printable)
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
689 {-
690 START_ESC ();
never executed
never executed
never executed
never executed
never executed: o
executed 3 times by 2 tests: fer[len] = ('0' + (c
Executed by:
  • date
  • ls
Description
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
< buffersize) bDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
Description
TRUEnever evaluated
FALSEnever evaluated
0-3
691 STORE ('0' + (c >> 6));
executed 3 times by 2 tests: buffer[len] = ('0' + ((c >> 3)
Executed by:
  • date
  • ls
len < buffersizeDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
692 STORE ('0' + ((c >> 3) & 7));
executed 3 times by 2 tests
Executed by:
  • date
  • ls
(c & 7);Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
693 c = '0' + (c & 7);-
694 }
executed 3 times by 2 tests: s
Executed by:
  • date
  • ls
3
695 else if (is_right_quote)
Description
TRUEnever evaluated
FALSEnever evaluated
0
696 {-
697 STORE ('\\');
never executed
quote =Description
TRUEnever evaluated
FALSEnever evaluated
0
698 is_right_quote = false;-
699 }
never executed
0
700 if (ilim <= i + 1)
eak;Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • date
  • ls
FALSEnever evaluated
0-3
701 break;
executed 3 times by 2 tests: { if
Executed by:
  • date
  • ls
3
702 END_ESC ();
never executed
never executed
never executed: o
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
703 STORE (c);
never executed
+i];Description
TRUEnever evaluated
FALSEnever evaluated
0
704 c = arg[++i];-
705 }
never executed
0
706-
707 goto store_c;
executed 3 times by 2 tests
Executed by:
  • date
  • ls
3
708 }-
709 }-
710 }
never executed
0
711-
712 if (! (((backslash_escapes && quoting_style != shell_always_quoting_style)
| elide_outer_quoDescription
TRUEevaluated 14595 times by 76 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 27484 times by 2 tests
Evaluated by:
  • ls
  • stat
Description
TRUEevaluated 5247 times by 58 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
FALSEevaluated 9348 times by 41 tests
Evaluated by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • df
  • dircolors
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • pathchk
  • printf
  • readlink
  • realpath
  • ...
5247-27484
713 || elide_outer_quotes)
uote_these_tooDescription
TRUEevaluated 2312 times by 25 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
FALSEevaluated 34520 times by 30 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • tac
  • ...
2312-34520
714 && quote_these_too
quote_these_tooDescription
TRUEevaluated 7558 times by 70 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
FALSEevaluated 1 time by 1 test
Evaluated by:
  • printf
1-7558
715 && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1)
_right_quote)Description
TRUEnever evaluated
FALSEevaluated 7558 times by 70 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
0-7558
716 && !is_right_quote)
store_c;Description
TRUEevaluated 42077 times by 76 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • numfmt
  • stat
2-42077
717 goto store_c;
executed 42077 times by 76 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
42077
718-
719 store_escape:
code before this statement executed 2 times by 2 tests: do { if (el
Executed by:
  • numfmt
  • stat
2
720 START_ESC ();
executed 4 times by 1 test
Executed by:
  • ls
executed 6 times by 3 tests
Executed by:
  • ls
  • printf
  • wc
executed 6 times by 3 tests
Executed by:
  • ls
  • printf
  • wc
executed 6 times by 3 tests
Executed by:
  • ls
  • printf
  • wc
executed 6 times by 3 tests
Executed by:
  • ls
  • printf
  • wc
executed 26 times by 5 tests
Executed by:
  • ls
  • numfmt
  • printf
  • stat
  • wc
Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • ls
FALSEevaluated 26 times by 5 tests
Evaluated by:
  • ls
  • numfmt
  • printf
  • stat
  • wc
Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEnever evaluated
Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEnever evaluated
Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEnever evaluated
Description
TRUEevaluated 26 times by 5 tests
Evaluated by:
  • ls
  • numfmt
  • printf
  • stat
  • wc
FALSEnever evaluated
Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEevaluated 20 times by 3 tests
Evaluated by:
  • ls
  • numfmt
  • stat
Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEnever evaluated
0-26
721-
722 store_c:
code before this statement executed 26 times by 5 tests: do { i
Executed by:
  • ls
  • numfmt
  • printf
  • stat
  • wc
26
723 END_ESC ();
executed 1 time by 1 test
Executed by:
  • wc
executed 1 time by 1 test
Executed by:
  • wc
executed 1 time by 1 test: o
Executed by:
  • wc
Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • wc
FALSEnever evaluated
Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • wc
FALSEnever evaluated
Description
TRUEevaluated 7 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
FALSEevaluated 42101 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • wc
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • ls
  • printf
  • wc
0-42101
724 STORE (c);
executed 40275 times by 77 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
Description
TRUEevaluated 40275 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 1833 times by 23 tests
Evaluated by:
  • cat
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • printf
  • ptx
  • rm
  • seq
  • shred
  • sort
  • stat
  • touch
  • truncate
  • uniq
  • vdir
1833-40275
725-
726 if (! c_and_shell_quote_compat)
l_c_and_shell_quote_compatDescription
TRUEevaluated 119 times by 11 tests
Evaluated by:
  • cp
  • date
  • env
  • ls
  • mv
  • paste
  • printf
  • ptx
  • stat
  • truncate
  • wc
FALSEevaluated 41989 times by 76 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
119-41989
727 all_c_and_shell_quote_compat = false;
executed 119 times by 11 tests: 0 ; }
Executed by:
  • cp
  • date
  • env
  • ls
  • mv
  • paste
  • printf
  • ptx
  • stat
  • truncate
  • wc
119
728 }
executed 42108 times by 77 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
42108
729-
730 if (len == 0 && quoting_style == shell_always_quoting_style
&& elideDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • printf
  • realpath
FALSEevaluated 3517 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
er_quotes)Description
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • printf
  • realpath
FALSEnever evaluated
0-3517
731 && elide_outer_quotes)
force_outer_quotinDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • printf
  • realpath
FALSEnever evaluated
0-3
732 goto force_outer_quoting_style;
executed 3 times by 2 tests
Executed by:
  • printf
  • realpath
3
733-
734 /* Single shell quotes (') are commonly enough used as an apostrophe,-
735 that we attempt to minimize the quoting in this case. Note itʼs-
736 better to use the apostrophe modifier "\u02BC" if possible, as that-
737 renders better and works with the word match regex \W+ etc. */-
738 if (quoting_style == shell_always_quoting_style && ! elide_outer_quotes
&& encountered_single_quote)Description
TRUEevaluated 1533 times by 41 tests
Evaluated by:
  • b2sum
  • cat
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • df
  • dircolors
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • md5sum
  • mv
  • nohup
  • pathchk
  • printf
  • readlink
  • realpath
  • ...
FALSEevaluated 1984 times by 59 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • ...
Description
TRUEevaluated 1411 times by 31 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
FALSEevaluated 122 times by 23 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tail
  • tee
  • tsort
  • wc
122-1984
739 && encountered_single_quote)
Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
FALSEevaluated 1409 times by 31 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • realpath
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • ...
2-1409
740 {-
741 if (all_c_and_shell_quote_compat)
turn quotearg_buffer_restyleDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • printf
  • stat
FALSEnever evaluated
0-2
742 return quotearg_buffer_restyled (buffer, orig_buffersize, arg, argsize,
executed 2 times by 2 tests: c_quoting_style, flags, quote_these_too, left_quote, right_quote); else if (! buffersize && orig_buffersize)
Executed by:
  • printf
  • stat
2
743 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:
  • printf
  • stat
2
744 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:
  • printf
  • stat
2
745 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:
  • printf
  • stat
2
746 else if (! buffersize && orig_buffersize)
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
747 {-
748 /* Disable read-only scan, and reprocess to write quoted string. */-
749 buffersize = orig_buffersize;-
750 len = 0;-
751 goto process_input;
never executed
0
752 }-
753 }
never executed
0
754-
755 if (quote_string && !elide_outer_quotes)
r (; *quote_Description
TRUEevaluated 2362 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 1153 times by 4 tests
Evaluated by:
  • dir
  • ls
  • stat
  • vdir
ng; quote_string++)Description
TRUEevaluated 2238 times by 71 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
FALSEevaluated 124 times by 24 tests
Evaluated by:
  • b2sum
  • cat
  • chmod
  • df
  • dircolors
  • du
  • ln
  • ls
  • md5sum
  • paste
  • pathchk
  • printf
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tail
  • tee
  • tsort
  • wc
124-2362
756 for (; *quote_string; quote_string++)
if (len < bufDescription
TRUEevaluated 2238 times by 71 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
FALSEevaluated 2238 times by 71 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
2238
757 STORE (*quote_string);
executed 2045 times by 71 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
executed 2238 times by 71 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
Description
TRUEevaluated 2045 times by 71 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • fold
  • ginstall
  • ...
FALSEevaluated 193 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
193-2238
758-
759 if (len < buffersize)
ffer[len] = '\0'Description
TRUEevaluated 3319 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
FALSEevaluated 196 times by 21 tests
Evaluated by:
  • cat
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
196-3319
760 buffer[len] = '\0';
executed 3319 times by 77 tests: turn len;
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
3319
761 return len;
executed 3515 times by 77 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
3515
762-
763 force_outer_quoting_style:-
764 /* Don't reuse quote_these_too, since the addition of outer quotes-
765 sufficiently quotes the specified characters. */-
766 if (quoting_style == shell_always_quoting_style && backslash_escapes)
oting_style = ...ways_quoting_sDescription
TRUEevaluated 27 times by 7 tests
Evaluated by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
FALSEnever evaluated
;Description
TRUEevaluated 27 times by 7 tests
Evaluated by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
FALSEnever evaluated
0-27
767 quoting_style = shell_escape_always_quoting_style;
executed 27 times by 7 tests: turn quotearg_buffer_restyled (buffer, buffersize,
Executed by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
27
768 return quotearg_buffer_restyled (buffer, buffersize, arg, argsize,
executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }
Executed by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
27
769 quoting_style,
executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }
Executed by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
27
770 flags & ~QA_ELIDE_OUTER_QUOTES, NULL,
executed 27 times by 7 tests: quoting_style, flags & ~QA_ELIDE_OUTER_QUOTES, ((void *)0) , left_quote, right_quote); }
Executed by:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
27
771 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:
  • dd
  • ls
  • printf
  • realpath
  • tac
  • tee
  • wc
27
772}-
773-
774/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of-
775 argument ARG (of size ARGSIZE), using O to control quoting.-
776 If O is null, use the default.-
777 Terminate the output with a null character, and return the written-
778 size of the output, not counting the terminating null.-
779 If BUFFERSIZE is too small to store the output string, return the-
780 value that would have been returned had BUFFERSIZE been large enough.-
781 If ARGSIZE is SIZE_MAX, use the string length of the argument for-
782 ARGSIZE. */-
783size_t-
784quotearg_buffer (char *buffer, size_t buffersize,-
785 char const *arg, size_t argsize,-
786 struct quoting_options const *o)-
787{-
788 struct quoting_options const *p = o ? o : &default_quoting_options;
Description
TRUEevaluated 1180 times by 3 tests
Evaluated by:
  • dir
  • ls
  • vdir
FALSEnever evaluated
0-1180
789 int e = errno;-
790 size_t r = quotearg_buffer_restyled (buffer, buffersize, arg, argsize,-
791 p->style, p->flags, p->quote_these_too,-
792 p->left_quote, p->right_quote);-
793 errno = e;-
794 return r;
executed 1180 times by 3 tests
Executed by:
  • dir
  • ls
  • vdir
1180
795}-
796-
797/* Equivalent to quotearg_alloc (ARG, ARGSIZE, NULL, O). */-
798char *-
799quotearg_alloc (char const *arg, size_t argsize,-
800 struct quoting_options const *o)-
801{-
802 return quotearg_alloc_mem (arg, argsize, NULL, o);
never executed: ((void *)0) , o); }
0
803}-
804-
805/* Like quotearg_buffer (..., ARG, ARGSIZE, O), except return newly-
806 allocated storage containing the quoted string, and store the-
807 resulting size into *SIZE, if non-NULL. The result can contain-
808 embedded null bytes only if ARGSIZE is not SIZE_MAX, SIZE is not-
809 NULL, and set_quoting_flags has not set the null byte elision-
810 flag. */-
811char *-
812quotearg_alloc_mem (char const *arg, size_t argsize, size_t *size,-
813 struct quoting_options const *o)-
814{-
815 struct quoting_options const *p = o ? o : &default_quoting_options;
Description
TRUEnever evaluated
FALSEnever evaluated
0
816 int e = errno;-
817 /* Elide embedded null bytes if we can't return a size. */-
818 int flags = p->flags | (size ? 0 : QA_ELIDE_NULL_BYTES);-
819 size_t bufsize = quotearg_buffer_restyled (0, 0, arg, argsize, p->style,-
820 flags, p->quote_these_too,-
821 p->left_quote,-
822 p->right_quote) + 1;-
823 char *buf = xcharalloc (bufsize);-
824 quotearg_buffer_restyled (buf, bufsize, arg, argsize, p->style, flags,-
825 p->quote_these_too,-
826 p->left_quote, p->right_quote);-
827 errno = e;-
828 if (size)
izeDescription
TRUEnever evaluated
FALSEnever evaluated
0
829 *size = bufsize - 1;
never executed: turn buf;
0
830 return buf;
never executed
0
831}-
832-
833/* A storage slot with size and pointer to a value. */-
834struct slotvec-
835{-
836 size_t size;-
837 char *val;-
838};-
839-
840/* Preallocate a slot 0 buffer, so that the caller can always quote-
841 one small component of a "memory exhausted" message in slot 0. */-
842static char slot0[256];-
843static int nslots = 1;-
844static struct slotvec slotvec0 = {sizeof slot0, slot0};-
845static struct slotvec *slotvec = &slotvec0;-
846-
847void-
848quotearg_free (void)-
849{-
850 struct slotvec *sv = slotvec;-
851 int i;-
852 for (i = 1; i < nslots; i++)
].val);Description
TRUEnever evaluated
FALSEnever evaluated
0
853 free (sv[i].val);
never executed: (sv[0].val != sl
0
854 if (sv[0].val != slot0)
Description
TRUEnever evaluated
FALSEnever evaluated
0
855 {-
856 free (sv[0].val);-
857 slotvec0.size = sizeof slot0;-
858 slotvec0.val = slot0;-
859 }
never executed
0
860 if (sv != &slotvec0)
Description
TRUEnever evaluated
FALSEnever evaluated
0
861 {-
862 free (sv);-
863 slotvec = &slotvec0;-
864 }
never executed: l
0
865 nslots = 1;-
866}
never executed: s
0
867-
868/* Use storage slot N to return a quoted version of argument ARG.-
869 ARG is of size ARGSIZE, but if that is SIZE_MAX, ARG is a-
870 null-terminated string.-
871 OPTIONS specifies the quoting options.-
872 The returned value points to static storage that can be-
873 reused by the next call to this function with the same value of N.-
874 N must be nonnegative. N is deliberately declared with type "int"-
875 to allow for future extensions (using negative values). */-
876static char *-
877quotearg_n_options (int n, char const *arg, size_t argsize,-
878 struct quoting_options const *options)-
879{-
880 int e = errno;-
881-
882 struct slotvec *sv = slotvec;-
883-
884 if (n < 0)
ort (Description
TRUEnever evaluated
FALSEevaluated 2139 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
0-2139
885 abort ();
never executed
0
886-
887 if (nslots <= n)
Description
TRUEevaluated 185 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
FALSEevaluated 1954 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
185-1954
888 {-
889 bool preallocated = (sv == &slotvec0);-
890 int nmax = MIN (INT_MAX, MIN (PTRDIFF_MAX, SIZE_MAX) / sizeof *sv) - 1;
sizeof *sv ))?...9551615UL))) /Description
TRUEevaluated 185 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-185
891-
892 if (nmax < n)
lloc_dieDescription
TRUEnever evaluated
FALSEevaluated 185 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
0-185
893 xalloc_die ();
never executed
0
894-
895 slotvec = sv = xrealloc (preallocated ? NULL : sv, (n + 1) * sizeof *sv);-
896 if (preallocated)
v = slotvec0Description
TRUEevaluated 185 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
FALSEnever evaluated
0-185
897 *sv = slotvec0;
executed 185 times by 20 tests: mset (sv + nslo
Executed by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
185
898 memset (sv + nslots, 0, (n + 1 - nslots) * sizeof *sv);-
899 nslots = n + 1;-
900 }
executed 185 times by 20 tests
Executed by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
185
901-
902 {-
903 size_t size = sv[n].size;-
904 char *val = sv[n].val;-
905 /* Elide embedded null bytes since we don't return a size. */-
906 int flags = options->flags | QA_ELIDE_NULL_BYTES;-
907 size_t qsize = quotearg_buffer_restyled (val, size, arg, argsize,-
908 options->style, flags,-
909 options->quote_these_too,-
910 options->left_quote,-
911 options->right_quote);-
912-
913 if (size <= qsize)
Description
TRUEevaluated 196 times by 21 tests
Evaluated by:
  • cat
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
FALSEevaluated 1943 times by 77 tests
Evaluated by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
196-1943
914 {-
915 sv[n].size = size = qsize + 1;-
916 if (val != slot0)
ee (val);Description
TRUEevaluated 195 times by 20 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
FALSEevaluated 1 time by 1 test
Evaluated by:
  • cat
1-195
917 free (val);
executed 195 times by 20 tests: [n].val = v
Executed by:
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
195
918 sv[n].val = val = xcharalloc (size);-
919 quotearg_buffer_restyled (val, size, arg, argsize, options->style,-
920 flags, options->quote_these_too,-
921 options->left_quote,-
922 options->right_quote);-
923 }
executed 196 times by 21 tests
Executed by:
  • cat
  • chgrp
  • chown
  • cp
  • date
  • dd
  • dir
  • ginstall
  • ln
  • mv
  • numfmt
  • od
  • ptx
  • rm
  • seq
  • shred
  • sort
  • touch
  • truncate
  • uniq
  • vdir
196
924-
925 errno = e;-
926 return val;
executed 2139 times by 77 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • cat
  • chcon
  • chgrp
  • chmod
  • chown
  • chroot
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • dircolors
  • du
  • env
  • expand
  • expr
  • factor
  • fmt
  • ...
2139
927 }-
928}-
929-
930char *-
931quotearg_n (int n, char const *arg)-
932{-
933 return quotearg_n_options (n, arg, SIZE_MAX, &default_quoting_options);
never executed: (18446744073709551615UL) , &default_quoting_options); }
0
934}-
935-
936char *-
937quotearg_n_mem (int n, char const *arg, size_t argsize)-
938{-
939 return quotearg_n_options (n, arg, argsize, &default_quoting_options);
never executed
0
940}-
941-
942char *-
943quotearg (char const *arg)-
944{-
945 return quotearg_n (0, arg);
never executed
0
946}-
947-
948char *-
949quotearg_mem (char const *arg, size_t argsize)-
950{-
951 return quotearg_n_mem (0, arg, argsize);
never executed
0
952}-
953-
954char *-
955quotearg_n_style (int n, enum quoting_style s, char const *arg)-
956{-
957 struct quoting_options const o = quoting_options_from_style (s);-
958 return quotearg_n_options (n, arg, SIZE_MAX, &o);
executed 1307 times by 38 tests: (18446744073709551615UL) , &o); }
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • date
  • dd
  • dir
  • du
  • env
  • expr
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • numfmt
  • od
  • pathchk
  • printf
  • ptx
  • rm
  • ...
1307
959}-
960-
961char *-
962quotearg_n_style_mem (int n, enum quoting_style s,-
963 char const *arg, size_t argsize)-
964{-
965 struct quoting_options const o = quoting_options_from_style (s);-
966 return quotearg_n_options (n, arg, argsize, &o);
executed 1 time by 1 test
Executed by:
  • dd
1
967}-
968-
969char *-
970quotearg_style (enum quoting_style s, char const *arg)-
971{-
972 return quotearg_n_style (0, s, arg);
executed 1014 times by 29 tests
Executed by:
  • chgrp
  • chmod
  • chown
  • chroot
  • cp
  • csplit
  • dd
  • du
  • env
  • fmt
  • ginstall
  • head
  • ln
  • ls
  • mv
  • nohup
  • pathchk
  • printf
  • rm
  • rmdir
  • sort
  • split
  • stat
  • sync
  • tac
  • ...
1014
973}-
974-
975char *-
976quotearg_style_mem (enum quoting_style s, char const *arg, size_t argsize)-
977{-
978 return quotearg_n_style_mem (0, s, arg, argsize);
never executed
0
979}-
980-
981char *-
982quotearg_char_mem (char const *arg, size_t argsize, char ch)-
983{-
984 struct quoting_options options;-
985 options = default_quoting_options;-
986 set_char_quoting (&options, ch, 1);-
987 return quotearg_n_options (0, arg, argsize, &options);
never executed
0
988}-
989-
990char *-
991quotearg_char (char const *arg, char ch)-
992{-
993 return quotearg_char_mem (arg, SIZE_MAX, ch);
never executed: (18446744073709551615UL) , ch); }
0
994}-
995-
996char *-
997quotearg_colon (char const *arg)-
998{-
999 return quotearg_char (arg, ':');
never executed
0
1000}-
1001-
1002char *-
1003quotearg_colon_mem (char const *arg, size_t argsize)-
1004{-
1005 return quotearg_char_mem (arg, argsize, ':');
never executed
0
1006}-
1007-
1008char *-
1009quotearg_n_style_colon (int n, enum quoting_style s, char const *arg)-
1010{-
1011 struct quoting_options options;-
1012 options = quoting_options_from_style (s);-
1013 set_char_quoting (&options, ':', 1);-
1014 return quotearg_n_options (n, arg, SIZE_MAX, &options);
executed 135 times by 24 tests: (18446744073709551615UL) , &options); }
Executed by:
  • b2sum
  • cat
  • chmod
  • dd
  • df
  • dircolors
  • du
  • ln
  • md5sum
  • paste
  • pathchk
  • readlink
  • realpath
  • rm
  • sha1sum
  • shred
  • shuf
  • sort
  • split
  • tac
  • tail
  • tee
  • tsort
  • wc
135
1015}-
1016-
1017char *-
1018quotearg_n_custom (int n, char const *left_quote,-
1019 char const *right_quote, char const *arg)-
1020{-
1021 return quotearg_n_custom_mem (n, left_quote, right_quote, arg,
never executed: (18446744073709551615UL) ); }
0
1022 SIZE_MAX);
never executed: (18446744073709551615UL) ); }
0
1023}-
1024-
1025char *-
1026quotearg_n_custom_mem (int n, char const *left_quote,-
1027 char const *right_quote,-
1028 char const *arg, size_t argsize)-
1029{-
1030 struct quoting_options o = default_quoting_options;-
1031 set_custom_quoting (&o, left_quote, right_quote);-
1032 return quotearg_n_options (n, arg, argsize, &o);
never executed
0
1033}-
1034-
1035char *-
1036quotearg_custom (char const *left_quote, char const *right_quote,-
1037 char const *arg)-
1038{-
1039 return quotearg_n_custom (0, left_quote, right_quote, arg);
never executed
0
1040}-
1041-
1042char *-
1043quotearg_custom_mem (char const *left_quote, char const *right_quote,-
1044 char const *arg, size_t argsize)-
1045{-
1046 return quotearg_n_custom_mem (0, left_quote, right_quote, arg,
never executed: argsize); }
0
1047 argsize);
never executed: argsize); }
0
1048}-
1049-
1050-
1051/* The quoting option used by the functions of quote.h. */-
1052struct quoting_options quote_quoting_options =-
1053 {-
1054 locale_quoting_style,-
1055 0,-
1056 { 0 },-
1057 NULL, NULL-
1058 };-
1059-
1060char const *-
1061quote_n_mem (int n, char const *arg, size_t argsize)-
1062{-
1063 return quotearg_n_options (n, arg, argsize, &quote_quoting_options);
executed 696 times by 56 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • id
  • ...
696
1064}-
1065-
1066char const *-
1067quote_mem (char const *arg, size_t argsize)-
1068{-
1069 return quote_n_mem (0, arg, argsize);
never executed
0
1070}-
1071-
1072char const *-
1073quote_n (int n, char const *arg)-
1074{-
1075 return quote_n_mem (n, arg, SIZE_MAX);
executed 696 times by 56 tests: (18446744073709551615UL) ); }
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • dd
  • df
  • dir
  • du
  • env
  • expand
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • id
  • ...
696
1076}-
1077-
1078char const *-
1079quote (char const *arg)-
1080{-
1081 return quote_n (0, arg);
executed 593 times by 55 tests
Executed by:
  • b2sum
  • base32
  • base64
  • basename
  • chcon
  • chmod
  • chown
  • comm
  • cp
  • csplit
  • cut
  • date
  • df
  • dir
  • du
  • env
  • expand
  • factor
  • fmt
  • fold
  • ginstall
  • groups
  • head
  • id
  • join
  • ...
593
1082}-
1083-
1084/*-
1085 * Hey Emacs!-
1086 * Local Variables:-
1087 * coding: utf-8-
1088 * End:-
1089 */-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2