OpenCoverage

test.c #1

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/test.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* GNU test program (ksb and mjb) */-
2-
3/* Modified to run with the GNU shell by bfox. */-
4-
5/* Copyright (C) 1987-2018 Free Software Foundation, Inc.-
6-
7 This program is free software: you can redistribute it and/or modify-
8 it under the terms of the GNU General Public License as published by-
9 the Free Software Foundation, either version 3 of the License, or-
10 (at your option) any later version.-
11-
12 This program is distributed in the hope that it will be useful,-
13 but WITHOUT ANY WARRANTY; without even the implied warranty of-
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-
15 GNU General Public License for more details.-
16-
17 You should have received a copy of the GNU General Public License-
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */-
19-
20/* Define TEST_STANDALONE to get the /bin/test version. Otherwise, you get-
21 the shell builtin version. */-
22-
23/* Without this pragma, gcc 4.6.2 20111027 mistakenly suggests that-
24 the advance function might be candidate for attribute 'pure'. */-
25#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__-
26# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"-
27#endif-
28-
29#include <config.h>-
30#include <stdio.h>-
31#include <sys/types.h>-
32-
33#define TEST_STANDALONE 1-
34-
35#ifndef LBRACKET-
36# define LBRACKET 0-
37#endif-
38-
39/* The official name of this program (e.g., no 'g' prefix). */-
40#if LBRACKET-
41# define PROGRAM_NAME "["-
42#else-
43# define PROGRAM_NAME "test"-
44#endif-
45-
46#include "system.h"-
47#include "quote.h"-
48#include "stat-time.h"-
49#include "strnumcmp.h"-
50-
51#include <stdarg.h>-
52#include "verror.h"-
53-
54#if HAVE_SYS_PARAM_H-
55# include <sys/param.h>-
56#endif-
57-
58/* Exit status for syntax errors, etc. */-
59enum { TEST_TRUE, TEST_FALSE, TEST_FAILURE };-
60-
61#if defined TEST_STANDALONE-
62# define test_exit(val) exit (val)-
63# define test_main_return(val) return val-
64#else-
65 static jmp_buf test_exit_buf;-
66 static int test_error_return = 0;-
67# define test_exit(val) test_error_return = val, longjmp (test_exit_buf, 1)-
68# define test_main_return(val) test_exit (val)-
69#endif /* !TEST_STANDALONE */-
70-
71static int pos; /* The offset of the current argument in ARGV. */-
72static int argc; /* The number of arguments present in ARGV. */-
73static char **argv; /* The argument list. */-
74-
75static bool test_unop (char const *s);-
76static bool unary_operator (void);-
77static bool binary_operator (bool);-
78static bool two_arguments (void);-
79static bool three_arguments (void);-
80static bool posixtest (int);-
81-
82static bool expr (void);-
83static bool term (void);-
84static bool and (void);-
85static bool or (void);-
86-
87static void test_syntax_error (char const *format, ...)-
88 ATTRIBUTE_NORETURN;-
89static void beyond (void) ATTRIBUTE_NORETURN;-
90-
91static void-
92test_syntax_error (char const *format, ...)-
93{-
94 va_list ap;-
95 va_start (ap, format);-
96 verror (0, 0, format, ap);-
97 test_exit (TEST_FAILURE);
executed 2 times by 1 test
Executed by:
  • test
2
98}-
99-
100/* Increment our position in the argument list. Check that we're not-
101 past the end of the argument list. This check is suppressed if the-
102 argument is false. */-
103-
104static void-
105advance (bool f)-
106{-
107 ++pos;-
108-
109 if (f && pos >= argc)
yDescription
TRUEevaluated 472 times by 1 test
Evaluated by:
  • test
FALSEevaluated 362 times by 1 test
Evaluated by:
  • test
();Description
TRUEnever evaluated
FALSEevaluated 472 times by 1 test
Evaluated by:
  • test
0-472
110 beyond ();
never executed
0
111}
executed 834 times by 1 test
Executed by:
  • test
834
112-
113static void-
114unary_advance (void)-
115{-
116 advance (true);-
117 ++pos;-
118}
executed 43 times by 1 test
Executed by:
  • test
43
119-
120/*-
121 * beyond - call when we're beyond the end of the argument list (an-
122 * error condition)-
123 */-
124static void-
125beyond (void)-
126{-
127 test_syntax_error (_("missing argument after %s"), quote (argv[argc - 1]));-
128}
never executed
0
129-
130/* If the characters pointed to by STRING constitute a valid number,-
131 return a pointer to the start of the number, skipping any blanks or-
132 leading '+'. Otherwise, report an error and exit. */-
133static char const *-
134find_int (char const *string)-
135{-
136 char const *p;-
137 char const *number_start;-
138-
139 for (p = string; isblank (to_uchar (*p)); p++)
to_uchar (*p) ...Sblank) ; p++)Description
TRUEnever evaluated
FALSEevaluated 326 times by 1 test
Evaluated by:
  • test
0-326
140 continue;
never executed
0
141-
142 if (*p == '+')
Description
TRUEnever evaluated
FALSEevaluated 326 times by 1 test
Evaluated by:
  • test
0-326
143 {-
144 p++;-
145 number_start = p;-
146 }
never executed: s
0
147 else-
148 {-
149 number_start = p;-
150 p += (*p == '-');-
151 }
executed 326 times by 1 test
Executed by:
  • test
326
152-
153 if (ISDIGIT (*p++))
Description
TRUEevaluated 326 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-326
154 {-
155 while (ISDIGIT (*p))
Description
TRUEevaluated 940 times by 1 test
Evaluated by:
  • test
FALSEevaluated 326 times by 1 test
Evaluated by:
  • test
326-940
156 p++;
executed 940 times by 1 test: ile
Executed by:
  • test
940
157 while (isblank (to_uchar (*p)))
to_uchar (*p) ...t) _ISblank) )Description
TRUEnever evaluated
FALSEevaluated 326 times by 1 test
Evaluated by:
  • test
0-326
158 p++;
never executed: (!*
0
159 if (!*p)
turDescription
TRUEevaluated 325 times by 1 test
Evaluated by:
  • test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test
1-325
160 return number_start;
executed 325 times by 1 test
Executed by:
  • test
325
161 }
executed 1 time by 1 test
Executed by:
  • test
1
162-
163 test_syntax_error (_("invalid integer %s"), quote (string));-
164}
never executed
0
165-
166/* Find the modification time of FILE, and stuff it into *MTIME.-
167 Return true if successful. */-
168static bool-
169get_mtime (char const *filename, struct timespec *mtime)-
170{-
171 struct stat finfo;-
172 bool ok = (stat (filename, &finfo) == 0);-
173#ifdef lint-
174 static struct timespec const zero;-
175 *mtime = zero;-
176#endif-
177 if (ok)
tiDescription
TRUEnever evaluated
FALSEnever evaluated
0
178 *mtime = get_stat_mtime (&finfo);
never executed: turn ok;
0
179 return ok;
never executed
0
180}-
181-
182/* Return true if S is one of the test command's binary operators. */-
183static bool-
184binop (char const *s)-
185{-
186 return ((STREQ (s, "=")) || (STREQ (s, "!=")) || (STREQ (s, "==")) ||
executed 340 times by 1 test: __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( s ) && __builtin_constant_p ( "=" ) && (__s1_len = __builtin_strlen ( s ), __s2_len = __builtin_strlen ( "=" ), (!((size_t)(const void *)(( s ) + 1) - (size_t)(const void *)( s ) == 1) ||...ult = (((const unsigned char *) (const char *) ( "-ge" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "-ge" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s , "-ge" )))); }) == 0))); }
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "="
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
never executed
executed 37 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "!="
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
executed 27 times by 1 test
Executed by:
  • test
executed 29 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "=="
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
executed 10 times by 1 test
Executed by:
  • test
executed 10 times by 1 test
Executed by:
  • test
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
TRUEevaluated 340 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • test
FALSEevaluated 303 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 37 times by 1 test
Evaluated by:
  • test
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
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEevaluated 313 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • test
FALSEevaluated 284 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEevaluated 2 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 286 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test
FALSEevaluated 276 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
0-340
187 (STREQ (s, "-nt")) ||
executed 340 times by 1 test: __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( s ) && __builtin_constant_p ( "=" ) && (__s1_len = __builtin_strlen ( s ), __s2_len = __builtin_strlen ( "=" ), (!((size_t)(const void *)(( s ) + 1) - (size_t)(const void *)( s ) == 1) ||...ult = (((const unsigned char *) (const char *) ( "-ge" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "-ge" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s , "-ge" )))); }) == 0))); }
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-nt"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
executed 31 times by 1 test
Executed by:
  • test
executed 264 times by 1 test
Executed by:
  • test
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
TRUEevaluated 276 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEevaluated 233 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test
0-340
188 (STREQ (s, "-ot")) || (STREQ (s, "-ef")) || (STREQ (s, "-eq")) ||
executed 340 times by 1 test: __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( s ) && __builtin_constant_p ( "=" ) && (__s1_len = __builtin_strlen ( s ), __s2_len = __builtin_strlen ( "=" ), (!((size_t)(const void *)(( s ) + 1) - (size_t)(const void *)( s ) == 1) ||...ult = (((const unsigned char *) (const char *) ( "-ge" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "-ge" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s , "-ge" )))); }) == 0))); }
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-ot"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
executed 40 times by 1 test
Executed by:
  • test
executed 264 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-ef"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
executed 31 times by 1 test
Executed by:
  • test
executed 264 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-eq"
never executed
never executed
executed 31 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 31 times by 1 test
Executed by:
  • test
executed 264 times by 1 test
Executed by:
  • test
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
TRUEevaluated 276 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEevaluated 224 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 276 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEevaluated 233 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 276 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 264 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEevaluated 233 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-340
189 (STREQ (s, "-ne")) || (STREQ (s, "-lt")) || (STREQ (s, "-le")) ||
executed 340 times by 1 test: __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( s ) && __builtin_constant_p ( "=" ) && (__s1_len = __builtin_strlen ( s ), __s2_len = __builtin_strlen ( "=" ), (!((size_t)(const void *)(( s ) + 1) - (size_t)(const void *)( s ) == 1) ||...ult = (((const unsigned char *) (const char *) ( "-ge" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "-ge" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s , "-ge" )))); }) == 0))); }
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-ne"
never executed
never executed
executed 30 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 31 times by 1 test
Executed by:
  • test
executed 233 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-lt"
never executed
never executed
executed 25 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 50 times by 1 test
Executed by:
  • test
executed 203 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-le"
never executed
never executed
executed 25 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 25 times by 1 test
Executed by:
  • test
executed 178 times by 1 test
Executed by:
  • test
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
TRUEevaluated 245 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 233 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 233 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEevaluated 202 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • test
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test
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
TRUEevaluated 215 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 203 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 203 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEevaluated 153 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEevaluated 25 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 190 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 178 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 178 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEevaluated 153 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-340
190 (STREQ (s, "-gt")) || (STREQ (s, "-ge")));
executed 340 times by 1 test: __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( s ) && __builtin_constant_p ( "=" ) && (__s1_len = __builtin_strlen ( s ), __s2_len = __builtin_strlen ( "=" ), (!((size_t)(const void *)(( s ) + 1) - (size_t)(const void *)( s ) == 1) ||...ult = (((const unsigned char *) (const char *) ( "-ge" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "-ge" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s , "-ge" )))); }) == 0))); }
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-gt"
never executed
never executed
executed 25 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 50 times by 1 test
Executed by:
  • test
executed 153 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-ge"
never executed
never executed
executed 25 times by 1 test: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( s
Executed by:
  • test
executed 25 times by 1 test
Executed by:
  • test
executed 128 times by 1 test
Executed by:
  • test
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
TRUEevaluated 165 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 153 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 153 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEevaluated 103 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEevaluated 25 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 140 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • test
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEevaluated 103 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-340
191}-
192-
193/*-
194 * term - parse a term and return 1 or 0 depending on whether the term-
195 * evaluates to true or false, respectively.-
196 *-
197 * term ::=-
198 * '-'('h'|'d'|'f'|'r'|'s'|'w'|'c'|'b'|'p'|'u'|'g'|'k') filename-
199 * '-'('L'|'x') filename-
200 * '-t' int-
201 * '-'('z'|'n') string-
202 * string-
203 * string ('!='|'=') string-
204 * <int> '-'(eq|ne|le|lt|ge|gt) <int>-
205 * file '-'(nt|ot|ef) file-
206 * '(' <expr> ')'-
207 * int ::=-
208 * '-l' string-
209 * positive and negative integers-
210 */-
211static bool-
212term (void)-
213{-
214 bool value;-
215 bool negated = false;-
216-
217 /* Deal with leading 'not's. */-
218 while (pos < argc && argv[pos][0] == '!' && argv[pos][1] == '\0')
Description
TRUEevaluated 434 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 183 times by 1 test
Evaluated by:
  • test
FALSEevaluated 251 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 183 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-434
219 {-
220 advance (true);-
221 negated = !negated;-
222 }
executed 183 times by 1 test
Executed by:
  • test
183
223-
224 if (pos >= argc)
yond ();Description
TRUEnever evaluated
FALSEevaluated 251 times by 1 test
Evaluated by:
  • test
0-251
225 beyond ();
never executed
0
226-
227 /* A paren-bracketed argument. */-
228 if (argv[pos][0] == '(' && argv[pos][1] == '\0')
Description
TRUEevaluated 171 times by 1 test
Evaluated by:
  • test
FALSEevaluated 80 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 171 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-171
229 {-
230 int nargs;-
231-
232 advance (true);-
233-
234 for (nargs = 1;-
235 pos + nargs < argc && ! STREQ (argv[pos + nargs], ")");
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( ")"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos + nargs]
never executed
executed 171 times by 1 test
Executed by:
  • test
Description
TRUEevaluated 489 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
__extension__ ...= 0); nargs++)Description
TRUEevaluated 318 times by 1 test
Evaluated by:
  • test
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 489 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 171 times by 1 test
Evaluated by:
  • test
FALSEevaluated 318 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-489
236 nargs++)-
237 if (nargs == 4)
Description
TRUEnever evaluated
FALSEevaluated 318 times by 1 test
Evaluated by:
  • test
0-318
238 {-
239 nargs = argc - pos;-
240 break;
never executed
0
241 }-
242-
243 value = posixtest (nargs);-
244 if (argv[pos] == 0)
st_syntax_erroDescription
TRUEnever evaluated
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
0-171
245 test_syntax_error (_("%s expected"), quote (")"));
never executed: dcgettext (((void *)0), "%s expected" , 5) , quote (")")); else
0
246 else-
247 if (argv[pos][0] != ')' || argv[pos][1])
st_syntax_error (Description
TRUEnever evaluated
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
0-171
248 test_syntax_error (_("%s expected, found %s"),
never executed: dcgettext (((void *)0), "%s expected, found %s" , 5) , quote_n (0, ")"), quote_n (1, argv[pos])); advance (
0
249 quote_n (0, ")"), quote_n (1, argv[pos]));
never executed: dcgettext (((void *)0), "%s expected, found %s" , 5) , quote_n (0, ")"), quote_n (1, argv[pos])); advance (
0
250 advance (false);-
251 }
executed 171 times by 1 test
Executed by:
  • test
171
252-
253 /* Are there enough arguments left that this could be dyadic? */-
254 else if (4 <= argc - pos && STREQ (argv[pos], "-l") && binop (argv[pos + 2]))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-l"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
never executed
Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • test
FALSEevaluated 56 times by 1 test
Evaluated by:
  • test
_extension__ (...ary_operator (Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 24 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 24 times by 1 test
Evaluated by:
  • test
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-56
255 value = binary_operator (true);
never executed: 1 ); else if (3 <= argc - pos && bino
0
256 else if (3 <= argc - pos && binop (argv[pos + 1]))
binary_operatoDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test
0-40
257 value = binary_operator (false);
never executed: 0 );
0
258-
259 /* It might be a switch type argument. */-
260 else if (argv[pos][0] == '-' && argv[pos][1] && argv[pos][2] == '\0')
Description
TRUEnever evaluated
FALSEevaluated 80 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-80
261 {-
262 if (test_unop (argv[pos]))
lue = unary_operatorDescription
TRUEnever evaluated
FALSEnever evaluated
0
263 value = unary_operator ();
never executed: se
0
264 else-
265 test_syntax_error (_("%s: unary operator expected"), quote (argv[pos]));
never executed: dcgettext (((void *)0), "%s: unary operator expected" , 5) , quote (argv[pos])); }
0
266 }-
267 else-
268 {-
269 value = (argv[pos][0] != '\0');-
270 advance (false);-
271 }
executed 80 times by 1 test
Executed by:
  • test
80
272-
273 return negated ^ value;
executed 251 times by 1 test
Executed by:
  • test
251
274}-
275-
276static bool-
277binary_operator (bool l_is_l)-
278{-
279 int op;-
280 struct stat stat_buf, stat_spare;-
281 /* Is the right integer expression of the form '-l string'? */-
282 bool r_is_l;-
283-
284 if (l_is_l)
vanceDescription
TRUEnever evaluated
FALSEevaluated 225 times by 1 test
Evaluated by:
  • test
0-225
285 advance (false);
never executed: 0 ); op = pos + 1;
0
286 op = pos + 1;-
287-
288 if ((op < argc - 2) && STREQ (argv[op + 1], "-l"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-l"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[op + 1]
never executed
executed 18 times by 1 test
Executed by:
  • test
Description
TRUEevaluated 132 times by 1 test
Evaluated by:
  • test
FALSEevaluated 93 times by 1 test
Evaluated by:
  • test
_extension__ (...); }) == 0)) {Description
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 132 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • test
FALSEevaluated 114 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-132
289 {-
290 r_is_l = true;-
291 advance (false);-
292 }
never executed: s
0
293 else-
294 r_is_l = false;
executed 225 times by 1 test: 0 ;
Executed by:
  • test
225
295-
296 if (argv[op][0] == '-')
Description
TRUEevaluated 161 times by 1 test
Evaluated by:
  • test
FALSEevaluated 64 times by 1 test
Evaluated by:
  • test
64-161
297 {-
298 /* check for eq, nt, and stuff */-
299 if ((((argv[op][1] == 'l' || argv[op][1] == 'g')
& (argv[op][2] ==Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEevaluated 111 times by 1 test
Evaluated by:
  • test
|| argv[op][2] ==Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEevaluated 61 times by 1 test
Evaluated by:
  • test
50-111
300 && (argv[op][2] == 'e' || argv[op][2] == 't'))
rgv[op][1] == 'e'Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEevaluated 50 times by 1 test
Evaluated by:
  • test
rgv[op][2] == 'q')Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-50
301 || (argv[op][1] == 'e' && argv[op][2] == 'q')
argv[op][1] == 'n'Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test
argv[op][2] == 'e'Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-31
302 || (argv[op][1] == 'n' && argv[op][2] == 'e'))
rgv[op][3])Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-30
303 && !argv[op][3])
Description
TRUEevaluated 161 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-161
304 {-
305 char lbuf[INT_BUFSIZE_BOUND (uintmax_t)];-
306 char rbuf[INT_BUFSIZE_BOUND (uintmax_t)];-
307 char const *l = (l_is_l
? umaxDescription
TRUEnever evaluated
FALSEevaluated 161 times by 1 test
Evaluated by:
  • test
0-161
308 ? umaxtostr (strlen (argv[op - 1]), lbuf)-
309 : find_int (argv[op - 1]));-
310 char const *r = (r_is_l
? umaxDescription
TRUEnever evaluated
FALSEevaluated 160 times by 1 test
Evaluated by:
  • test
0-160
311 ? umaxtostr (strlen (argv[op + 2]), rbuf)-
312 : find_int (argv[op + 1]));-
313 int cmp = strintcmp (l, r);-
314 bool xe_operator = (argv[op][2] == 'e');-
315 pos += 3;-
316 return (argv[op][1] == 'l' ? cmp < xe_operator
executed 160 times by 1 test: : argv[op][1] == 'g' ? cmp > - xe_operator : (cmp != 0) == xe_operator); }
Executed by:
  • test
160
317 : argv[op][1] == 'g' ? cmp > - xe_operator
executed 160 times by 1 test: : argv[op][1] == 'g' ? cmp > - xe_operator : (cmp != 0) == xe_operator); }
Executed by:
  • test
160
318 : (cmp != 0) == xe_operator);
executed 160 times by 1 test: : argv[op][1] == 'g' ? cmp > - xe_operator : (cmp != 0) == xe_operator); }
Executed by:
  • test
160
319 }-
320-
321 switch (argv[op][1])-
322 {-
323 default:
never executed: break;
0
324 break;
never executed
0
325-
326 case 'n':
never executed: if (arg
0
327 if (argv[op][2] == 't' && !argv[op][3])
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
328 {-
329 /* nt - newer than */-
330 struct timespec lt, rt;-
331 bool le, re;-
332 pos += 3;-
333 if (l_is_l || r_is_l)
st_synDescription
TRUEnever evaluated
FALSEnever evaluated
errorDescription
TRUEnever evaluated
FALSEnever evaluated
0
334 test_syntax_error (_("-nt does not accept -l"), NULL);
never executed: dcgettext (((void *)0), "-nt does not accept -l" , 5) , ((void *)0) ); le = get_mtime (argv[op - 1], &lt);
0
335 le = get_mtime (argv[op - 1], &lt);-
336 re = get_mtime (argv[op + 1], &rt);-
337 return le && (!re || timespec_cmp (lt, rt) > 0);
never executed
0
338 }-
339 break;
never executed
0
340-
341 case 'e':
never executed: if (arg
0
342 if (argv[op][2] == 'f' && !argv[op][3])
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
343 {-
344 /* ef - hard link? */-
345 pos += 3;-
346 if (l_is_l || r_is_l)
st_synDescription
TRUEnever evaluated
FALSEnever evaluated
errorDescription
TRUEnever evaluated
FALSEnever evaluated
0
347 test_syntax_error (_("-ef does not accept -l"), NULL);
never executed: dcgettext (((void *)0), "-ef does not accept -l" , 5) , ((void *)0) ); return (stat (argv[op - 1], &stat_buf) == 0
0
348 return (stat (argv[op - 1], &stat_buf) == 0
never executed: && stat (argv[op + 1], &stat_spare) == 0 && stat_buf.st_dev == stat_spare.st_dev && stat_buf.st_ino == stat_spare.st_ino); }
0
349 && stat (argv[op + 1], &stat_spare) == 0
never executed: && stat (argv[op + 1], &stat_spare) == 0 && stat_buf.st_dev == stat_spare.st_dev && stat_buf.st_ino == stat_spare.st_ino); }
0
350 && stat_buf.st_dev == stat_spare.st_dev
never executed: && stat (argv[op + 1], &stat_spare) == 0 && stat_buf.st_dev == stat_spare.st_dev && stat_buf.st_ino == stat_spare.st_ino); }
0
351 && stat_buf.st_ino == stat_spare.st_ino);
never executed: && stat (argv[op + 1], &stat_spare) == 0 && stat_buf.st_dev == stat_spare.st_dev && stat_buf.st_ino == stat_spare.st_ino); }
0
352 }-
353 break;
never executed
0
354-
355 case 'o':
never executed: if ('t'
0
356 if ('t' == argv[op][2] && '\000' == argv[op][3])
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0
357 {-
358 /* ot - older than */-
359 struct timespec lt, rt;-
360 bool le, re;-
361 pos += 3;-
362 if (l_is_l || r_is_l)
st_synDescription
TRUEnever evaluated
FALSEnever evaluated
errorDescription
TRUEnever evaluated
FALSEnever evaluated
0
363 test_syntax_error (_("-ot does not accept -l"), NULL);
never executed: dcgettext (((void *)0), "-ot does not accept -l" , 5) , ((void *)0) ); le = get_mtime (argv[op - 1], &lt);
0
364 le = get_mtime (argv[op - 1], &lt);-
365 re = get_mtime (argv[op + 1], &rt);-
366 return re && (!le || timespec_cmp (lt, rt) < 0);
never executed
0
367 }-
368 break;
never executed
0
369 }-
370-
371 /* FIXME: is this dead code? */-
372 test_syntax_error (_("%s: unknown binary operator"), quote (argv[op]));-
373 }
never executed
0
374-
375 if (argv[op][0] == '='
&& (!argv[op][1] |Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • test
FALSEevaluated 27 times by 1 test
Evaluated by:
  • test
27-37
376 && (!argv[op][1] || ((argv[op][1] == '=') && !argv[op][2])))
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-27
377 {-
378 bool value = STREQ (argv[pos], argv[pos + 2]);
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( argv[pos + 2]
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
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
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
379 pos += 3;-
380 return value;
executed 37 times by 1 test
Executed by:
  • test
37
381 }-
382-
383 if (STREQ (argv[op], "!="))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "!="
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[op]
executed 27 times by 1 test
Executed by:
  • test
executed 27 times by 1 test
Executed by:
  • test
_extension__ (...); }) == 0)) {Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
0-27
384 {-
385 bool value = !STREQ (argv[pos], argv[pos + 2]);
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( argv[pos + 2]
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
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
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
386 pos += 3;-
387 return value;
executed 27 times by 1 test
Executed by:
  • test
27
388 }-
389-
390 /* Not reached. */-
391 abort ();
never executed
0
392}-
393-
394static bool-
395unary_operator (void)-
396{-
397 struct stat stat_buf;-
398-
399 switch (argv[pos][1])-
400 {-
401 default:
executed 1 time by 1 test: return
Executed by:
  • test
1
402 return false;
executed 1 time by 1 test: 0 ;
Executed by:
  • test
1
403-
404 /* All of the following unary operators use unary_advance (), which-
405 checks to make sure that there is an argument, and then advances-
406 pos right past it. This means that pos - 1 is the location of the-
407 argument. */-
408-
409 case 'a': /* file exists in the file system? */
never executed: case 'e':
0
410 case 'e':
executed 1 time by 1 test: unary_a
Executed by:
  • test
1
411 unary_advance ();-
412 return stat (argv[pos - 1], &stat_buf) == 0;
executed 1 time by 1 test
Executed by:
  • test
1
413-
414 case 'r': /* file is readable? */
never executed: unary_a
0
415 unary_advance ();-
416 return euidaccess (argv[pos - 1], R_OK) == 0;
never executed: 4 ) == 0;
0
417-
418 case 'w': /* File is writable? */
executed 9 times by 1 test: unary_a
Executed by:
  • test
9
419 unary_advance ();-
420 return euidaccess (argv[pos - 1], W_OK) == 0;
executed 9 times by 1 test: 2 ) == 0;
Executed by:
  • test
9
421-
422 case 'x': /* File is executable? */
never executed: unary_a
0
423 unary_advance ();-
424 return euidaccess (argv[pos - 1], X_OK) == 0;
never executed: 1 ) == 0;
0
425-
426 case 'O': /* File is owned by you? */
executed 1 time by 1 test: {
Executed by:
  • test
1
427 {-
428 unary_advance ();-
429 if (stat (argv[pos - 1], &stat_buf) != 0)
turnDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test
0-1
430 return false;
never executed: 0 ;
0
431 errno = 0;-
432 uid_t euid = geteuid ();-
433 uid_t NO_UID = -1;-
434 return ! (euid == NO_UID && errno) && euid == stat_buf.st_uid;
executed 1 time by 1 test: (*__errno_location ()) ) && euid == stat_buf.st_uid; }
Executed by:
  • test
1
435 }-
436-
437 case 'G': /* File is owned by your group? */
executed 1 time by 1 test: {
Executed by:
  • test
1
438 {-
439 unary_advance ();-
440 if (stat (argv[pos - 1], &stat_buf) != 0)
turnDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test
0-1
441 return false;
never executed: 0 ;
0
442 errno = 0;-
443 gid_t egid = getegid ();-
444 gid_t NO_GID = -1;-
445 return ! (egid == NO_GID && errno) && egid == stat_buf.st_gid;
executed 1 time by 1 test: (*__errno_location ()) ) && egid == stat_buf.st_gid; }
Executed by:
  • test
1
446 }-
447-
448 case 'f': /* File is a file? */
never executed: unary_a
0
449 unary_advance ();-
450 /* Under POSIX, -f is true if the given file exists-
451 and is a regular file. */-
452 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0100000)) );
0
453 && S_ISREG (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0100000)) );
0
454-
455 case 'd': /* File is a directory? */
never executed: unary_a
0
456 unary_advance ();-
457 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0040000)) );
0
458 && S_ISDIR (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0040000)) );
0
459-
460 case 's': /* File has something in it? */
never executed: unary_a
0
461 unary_advance ();-
462 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && 0 < stat_buf.st_size);
0
463 && 0 < stat_buf.st_size);
never executed: && 0 < stat_buf.st_size);
0
464-
465 case 'S': /* File is a socket? */
never executed: unary_a
0
466 unary_advance ();-
467 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0140000)) );
0
468 && S_ISSOCK (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0140000)) );
0
469-
470 case 'c': /* File is character special? */
never executed: unary_a
0
471 unary_advance ();-
472 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0020000)) );
0
473 && S_ISCHR (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0020000)) );
0
474-
475 case 'b': /* File is block special? */
never executed: unary_a
0
476 unary_advance ();-
477 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0060000)) );
0
478 && S_ISBLK (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0060000)) );
0
479-
480 case 'p': /* File is a named pipe? */
never executed: unary_a
0
481 unary_advance ();-
482 return (stat (argv[pos - 1], &stat_buf) == 0
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0010000)) );
0
483 && S_ISFIFO (stat_buf.st_mode));
never executed: && (((( stat_buf.st_mode )) & 0170000) == (0010000)) );
0
484-
485 case 'L': /* Same as -h */
never executed
0
486 /*FALLTHROUGH*/-
487-
488 case 'h': /* File is a symbolic link? */
executed 6 times by 1 test: unary_a
Executed by:
  • test
6
489 unary_advance ();-
490 return (lstat (argv[pos - 1], &stat_buf) == 0
executed 6 times by 1 test: && (((( stat_buf.st_mode )) & 0170000) == (0120000)) );
Executed by:
  • test
6
491 && S_ISLNK (stat_buf.st_mode));
executed 6 times by 1 test: && (((( stat_buf.st_mode )) & 0170000) == (0120000)) );
Executed by:
  • test
6
492-
493 case 'u': /* File is setuid? */
executed 2 times by 1 test: unary_a
Executed by:
  • test
2
494 unary_advance ();-
495 return (stat (argv[pos - 1], &stat_buf) == 0
executed 2 times by 1 test: && (stat_buf.st_mode & 04000 ));
Executed by:
  • test
2
496 && (stat_buf.st_mode & S_ISUID));
executed 2 times by 1 test: && (stat_buf.st_mode & 04000 ));
Executed by:
  • test
2
497-
498 case 'g': /* File is setgid? */
executed 4 times by 1 test: unary_a
Executed by:
  • test
4
499 unary_advance ();-
500 return (stat (argv[pos - 1], &stat_buf) == 0
executed 4 times by 1 test: && (stat_buf.st_mode & 02000 ));
Executed by:
  • test
4
501 && (stat_buf.st_mode & S_ISGID));
executed 4 times by 1 test: && (stat_buf.st_mode & 02000 ));
Executed by:
  • test
4
502-
503 case 'k': /* File has sticky bit set? */
executed 4 times by 1 test: unary_a
Executed by:
  • test
4
504 unary_advance ();-
505 return (stat (argv[pos - 1], &stat_buf) == 0
executed 4 times by 1 test: && (stat_buf.st_mode & 01000 ));
Executed by:
  • test
4
506 && (stat_buf.st_mode & S_ISVTX));
executed 4 times by 1 test: && (stat_buf.st_mode & 01000 ));
Executed by:
  • test
4
507-
508 case 't': /* File (fd) is a terminal? */
executed 5 times by 1 test: {
Executed by:
  • test
5
509 {-
510 long int fd;-
511 char const *arg;-
512 unary_advance ();-
513 arg = find_int (argv[pos - 1]);-
514 errno = 0;-
515 fd = strtol (arg, NULL, 10);-
516 return (errno != ERANGE && 0 <= fd && fd <= INT_MAX && isatty (fd));
executed 5 times by 1 test: (*__errno_location ()) != 34 && 0 <= fd && fd <= 0x7fffffff && isatty (fd)); }
Executed by:
  • test
5
517 }-
518-
519 case 'n': /* True if arg has some length. */
executed 5 times by 1 test: unary_a
Executed by:
  • test
5
520 unary_advance ();-
521 return argv[pos - 1][0] != 0;
executed 5 times by 1 test
Executed by:
  • test
5
522-
523 case 'z': /* True if arg has no length. */
executed 5 times by 1 test: unary_a
Executed by:
  • test
5
524 unary_advance ();-
525 return argv[pos - 1][0] == '\0';
executed 5 times by 1 test
Executed by:
  • test
5
526 }-
527}-
528-
529/*-
530 * and:-
531 * term-
532 * term '-a' and-
533 */-
534static bool-
535and (void)-
536{-
537 bool value = true;-
538-
539 while (true)-
540 {-
541 value &= term ();-
542 if (! (pos < argc && STREQ (argv[pos], "-a")))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-a"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
executed 20 times by 1 test
Executed by:
  • test
executed 40 times by 1 test
Executed by:
  • test
Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • test
FALSEevaluated 187 times by 1 test
Evaluated by:
  • test
_extension__ (... return value;Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 44 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 64 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEevaluated 24 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
0-187
543 return value;
executed 231 times by 1 test: vance (
Executed by:
  • test
231
544 advance (false);-
545 }
executed 20 times by 1 test
Executed by:
  • test
20
546}
never executed
0
547-
548/*-
549 * or:-
550 * and-
551 * and '-o' or-
552 */-
553static bool-
554or (void)-
555{-
556 bool value = false;-
557-
558 while (true)-
559 {-
560 value |= and ();-
561 if (! (pos < argc && STREQ (argv[pos], "-o")))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-o"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
executed 20 times by 1 test
Executed by:
  • test
executed 20 times by 1 test
Executed by:
  • test
Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEevaluated 187 times by 1 test
Evaluated by:
  • test
_extension__ (... return value;Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 24 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 24 times by 1 test
Evaluated by:
  • test
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
0-187
562 return value;
executed 211 times by 1 test: vance (
Executed by:
  • test
211
563 advance (false);-
564 }
executed 20 times by 1 test
Executed by:
  • test
20
565}
never executed
0
566-
567/*-
568 * expr:-
569 * or-
570 */-
571static bool-
572expr (void)-
573{-
574 if (pos >= argc)
yond ();Description
TRUEnever evaluated
FALSEevaluated 211 times by 1 test
Evaluated by:
  • test
0-211
575 beyond ();
never executed
0
576-
577 return or (); /* Same with this. */
executed 211 times by 1 test
Executed by:
  • test
211
578}-
579-
580/* Return true if OP is one of the test command's unary operators. */-
581static bool-
582test_unop (char const *op)-
583{-
584 if (op[0] != '-')
turnDescription
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • test
0-44
585 return false;
never executed: 0 ;
0
586-
587 switch (op[1])-
588 {-
589 case 'a': case 'b': case 'c': case 'd': case 'e':
never executed: case 'f':
never executed: case 'g':
never executed: case 'h':
never executed: case 'k':
executed 1 time by 1 test: case 'n':
Executed by:
  • test
0-1
590 case 'f': case 'g': case 'h': case 'k': case 'n':
never executed: case 'o':
executed 4 times by 1 test: case 'p':
Executed by:
  • test
executed 6 times by 1 test: case 'r':
Executed by:
  • test
executed 4 times by 1 test: case 's':
Executed by:
  • test
executed 5 times by 1 test: case 't':
Executed by:
  • test
0-6
591 case 'o': case 'p': case 'r': case 's': case 't':
executed 1 time by 1 test: case 'u':
Executed by:
  • test
never executed: case 'w':
never executed: case 'x':
never executed: case 'z':
executed 5 times by 1 test
Executed by:
  • test
0-5
592 case 'u': case 'w': case 'x': case 'z':
executed 2 times by 1 test: case 'G':
Executed by:
  • test
executed 9 times by 1 test: case 'L':
Executed by:
  • test
never executed: case 'O':
executed 5 times by 1 test: case 'S':
Executed by:
  • test
0-9
593 case 'G': case 'L': case 'O': case 'S': case 'N':
executed 1 time by 1 test: return
Executed by:
  • test
never executed
executed 1 time by 1 test
Executed by:
  • test
never executed
never executed
0-1
594 return true;
executed 44 times by 1 test: 1 ; default:
Executed by:
  • test
44
595 default:
never executed: return
0
596 return false;
never executed: 0 ; }
0
597 }-
598}-
599-
600static bool-
601one_argument (void)-
602{-
603 return argv[pos++][0] != '\0';
executed 64 times by 2 tests
Executed by:
  • [
  • test
64
604}-
605-
606static bool-
607two_arguments (void)-
608{-
609 bool value;-
610-
611 if (STREQ (argv[pos], "!"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "!"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
executed 9 times by 1 test
Executed by:
  • test
_extension__ (...); }) == 0)) {Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • test
FALSEevaluated 44 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 53 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • test
FALSEevaluated 44 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-53
612 {-
613 advance (false);-
614 value = ! one_argument ();-
615 }
executed 9 times by 1 test: s
Executed by:
  • test
9
616 else if (argv[pos][0] == '-'
&& argv[pos][1] !=Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-44
617 && argv[pos][1] != '\0'
argv[pos][2] == '\0'Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-44
618 && argv[pos][2] == '\0')
Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-44
619 {-
620 if (test_unop (argv[pos]))
lue = unary_operatorDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
0-44
621 value = unary_operator ();
executed 44 times by 1 test: se
Executed by:
  • test
44
622 else-
623 test_syntax_error (_("%s: unary operator expected"), quote (argv[pos]));
never executed: dcgettext (((void *)0), "%s: unary operator expected" , 5) , quote (argv[pos])); }
0
624 }-
625 else-
626 beyond ();
never executed: turn (valu
0
627 return (value);
executed 53 times by 1 test
Executed by:
  • test
53
628}-
629-
630static bool-
631three_arguments (void)-
632{-
633 bool value;-
634-
635 if (binop (argv[pos + 1]))
lue = binary_operatorDescription
TRUEevaluated 225 times by 1 test
Evaluated by:
  • test
FALSEevaluated 75 times by 1 test
Evaluated by:
  • test
75-225
636 value = binary_operator (false);
executed 225 times by 1 test: 0 ); else if ((
Executed by:
  • test
225
637 else if (STREQ (argv[pos], "!"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "!"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
executed 7 times by 1 test
Executed by:
  • test
_extension__ (...); }) == 0)) {Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test
FALSEevaluated 68 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 75 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test
FALSEevaluated 68 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-75
638 {-
639 advance (true);-
640 value = !two_arguments ();-
641 }
executed 7 times by 1 test: s
Executed by:
  • test
7
642 else if (STREQ (argv[pos], "(") && STREQ (argv[pos + 2], ")"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "("
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
executed 28 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( ")"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos + 2]
never executed
executed 28 times by 1 test
Executed by:
  • test
_extension__ (... }) == 0) && (Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • test
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 68 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • test
FALSEevaluated 40 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ ...); }) == 0)) {Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 28 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-68
643 {-
644 advance (false);-
645 value = one_argument ();-
646 advance (false);-
647 }
executed 28 times by 1 test: s
Executed by:
  • test
28
648 else if (STREQ (argv[pos + 1], "-a") || STREQ (argv[pos + 1], "-o"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-a"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos + 1]
executed 20 times by 1 test
Executed by:
  • test
executed 40 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "-o"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos + 1]
executed 20 times by 1 test
Executed by:
  • test
executed 20 times by 1 test
Executed by:
  • test
_extension__ (... }) == 0) || (Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ ...lue = expr ();Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
0-40
649 value = expr ();
executed 40 times by 1 test: se
Executed by:
  • test
40
650 else-
651 test_syntax_error (_("%s: binary operator expected"), quote (argv[pos+1]));
never executed: dcgettext (((void *)0), "%s: binary operator expected" , 5) , quote (argv[pos+1])); return (value);
0
652 return (value);
executed 299 times by 1 test
Executed by:
  • test
299
653}-
654-
655/* This is an implementation of a Posix.2 proposal by David Korn. */-
656static bool-
657posixtest (int nargs)-
658{-
659 bool value;-
660-
661 switch (nargs)-
662 {-
663 case 1:
executed 27 times by 2 tests: value
Executed by:
  • [
  • test
27
664 value = one_argument ();-
665 break;
executed 27 times by 2 tests
Executed by:
  • [
  • test
27
666-
667 case 2:
executed 43 times by 1 test: value
Executed by:
  • test
43
668 value = two_arguments ();-
669 break;
executed 43 times by 1 test
Executed by:
  • test
43
670-
671 case 3:
executed 232 times by 1 test: value
Executed by:
  • test
232
672 value = three_arguments ();-
673 break;
executed 231 times by 1 test
Executed by:
  • test
231
674-
675 case 4:
executed 71 times by 1 test: if ((
Executed by:
  • test
71
676 if (STREQ (argv[pos], "!"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "!"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
executed 68 times by 1 test
Executed by:
  • test
_extension__ (...); }) == 0)) {Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test
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
TRUEevaluated 71 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • test
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEevaluated 68 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-71
677 {-
678 advance (true);-
679 value = !three_arguments ();-
680 break;
executed 68 times by 1 test
Executed by:
  • test
68
681 }-
682 if (STREQ (argv[pos], "(") && STREQ (argv[pos + 3], ")"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "("
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos]
never executed
executed 3 times by 1 test
Executed by:
  • test
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( ")"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( argv[pos + 3]
never executed
executed 3 times by 1 test
Executed by:
  • test
_extension__ (... }) == 0) && (Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ ...); }) == 0)) {Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
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
Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-3
683 {-
684 advance (false);-
685 value = two_arguments ();-
686 advance (false);-
687 break;
executed 3 times by 1 test
Executed by:
  • test
3
688 }-
689 FALLTHROUGH;-
690 case 5:
code before this statement never executed: default
executed 64 times by 1 test: default
Executed by:
  • test
0-64
691 default:
executed 107 times by 1 test: if (na
Executed by:
  • test
107
692 if (nargs <= 0)
ort ();Description
TRUEnever evaluated
FALSEevaluated 171 times by 1 test
Evaluated by:
  • test
0-171
693 abort ();
never executed: lue = exp
0
694 value = expr ();-
695 }
executed 171 times by 1 test
Executed by:
  • test
171
696-
697 return (value);
executed 543 times by 2 tests
Executed by:
  • [
  • test
543
698}-
699-
700#if defined TEST_STANDALONE-
701-
702void-
703usage (int status)-
704{-
705 if (status != EXIT_SUCCESS)
0Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • [
0-2
706 emit_try_help ();
never executed
0
707 else-
708 {-
709 fputs (_("\-
710Usage: test EXPRESSION\n\-
711 or: test\n\-
712 or: [ EXPRESSION ]\n\-
713 or: [ ]\n\-
714 or: [ OPTION\n\-
715"), stdout);-
716 fputs (_("\-
717Exit with the status determined by EXPRESSION.\n\-
718\n\-
719"), stdout);-
720 fputs (HELP_OPTION_DESCRIPTION, stdout);-
721 fputs (VERSION_OPTION_DESCRIPTION, stdout);-
722 fputs (_("\-
723\n\-
724An omitted EXPRESSION defaults to false. Otherwise,\n\-
725EXPRESSION is true or false and sets exit status. It is one of:\n\-
726"), stdout);-
727 fputs (_("\-
728\n\-
729 ( EXPRESSION ) EXPRESSION is true\n\-
730 ! EXPRESSION EXPRESSION is false\n\-
731 EXPRESSION1 -a EXPRESSION2 both EXPRESSION1 and EXPRESSION2 are true\n\-
732 EXPRESSION1 -o EXPRESSION2 either EXPRESSION1 or EXPRESSION2 is true\n\-
733"), stdout);-
734 fputs (_("\-
735\n\-
736 -n STRING the length of STRING is nonzero\n\-
737 STRING equivalent to -n STRING\n\-
738 -z STRING the length of STRING is zero\n\-
739 STRING1 = STRING2 the strings are equal\n\-
740 STRING1 != STRING2 the strings are not equal\n\-
741"), stdout);-
742 fputs (_("\-
743\n\-
744 INTEGER1 -eq INTEGER2 INTEGER1 is equal to INTEGER2\n\-
745 INTEGER1 -ge INTEGER2 INTEGER1 is greater than or equal to INTEGER2\n\-
746 INTEGER1 -gt INTEGER2 INTEGER1 is greater than INTEGER2\n\-
747 INTEGER1 -le INTEGER2 INTEGER1 is less than or equal to INTEGER2\n\-
748 INTEGER1 -lt INTEGER2 INTEGER1 is less than INTEGER2\n\-
749 INTEGER1 -ne INTEGER2 INTEGER1 is not equal to INTEGER2\n\-
750"), stdout);-
751 fputs (_("\-
752\n\-
753 FILE1 -ef FILE2 FILE1 and FILE2 have the same device and inode numbers\n\-
754 FILE1 -nt FILE2 FILE1 is newer (modification date) than FILE2\n\-
755 FILE1 -ot FILE2 FILE1 is older than FILE2\n\-
756"), stdout);-
757 fputs (_("\-
758\n\-
759 -b FILE FILE exists and is block special\n\-
760 -c FILE FILE exists and is character special\n\-
761 -d FILE FILE exists and is a directory\n\-
762 -e FILE FILE exists\n\-
763"), stdout);-
764 fputs (_("\-
765 -f FILE FILE exists and is a regular file\n\-
766 -g FILE FILE exists and is set-group-ID\n\-
767 -G FILE FILE exists and is owned by the effective group ID\n\-
768 -h FILE FILE exists and is a symbolic link (same as -L)\n\-
769 -k FILE FILE exists and has its sticky bit set\n\-
770"), stdout);-
771 fputs (_("\-
772 -L FILE FILE exists and is a symbolic link (same as -h)\n\-
773 -O FILE FILE exists and is owned by the effective user ID\n\-
774 -p FILE FILE exists and is a named pipe\n\-
775 -r FILE FILE exists and read permission is granted\n\-
776 -s FILE FILE exists and has a size greater than zero\n\-
777"), stdout);-
778 fputs (_("\-
779 -S FILE FILE exists and is a socket\n\-
780 -t FD file descriptor FD is opened on a terminal\n\-
781 -u FILE FILE exists and its set-user-ID bit is set\n\-
782 -w FILE FILE exists and write permission is granted\n\-
783 -x FILE FILE exists and execute (or search) permission is granted\n\-
784"), stdout);-
785 fputs (_("\-
786\n\-
787Except for -h and -L, all FILE-related tests dereference symbolic links.\n\-
788Beware that parentheses need to be escaped (e.g., by backslashes) for shells.\n\-
789INTEGER may also be -l STRING, which evaluates to the length of STRING.\n\-
790"), stdout);-
791 fputs (_("\-
792\n\-
793NOTE: Binary -a and -o are inherently ambiguous. Use 'test EXPR1 && test\n\-
794EXPR2' or 'test EXPR1 || test EXPR2' instead.\n\-
795"), stdout);-
796 fputs (_("\-
797\n\-
798NOTE: [ honors the --help and --version options, but test does not.\n\-
799test treats each of those as it treats any other nonempty STRING.\n\-
800"), stdout);-
801 printf (USAGE_BUILTIN_WARNING, _("test and/or ["));-
802 emit_ancillary_info (PROGRAM_NAME);-
803 }
executed 2 times by 1 test: i
Executed by:
  • [
2
804 exit (status);
executed 2 times by 1 test
Executed by:
  • [
2
805}-
806#endif /* TEST_STANDALONE */-
807-
808#if !defined TEST_STANDALONE-
809# define main test_command-
810#endif-
811-
812#define AUTHORS \-
813 proper_name ("Kevin Braunsdorf"), \-
814 proper_name ("Matthew Bradburn")-
815-
816/*-
817 * [:-
818 * '[' expr ']'-
819 * test:-
820 * test expr-
821 */-
822int-
823main (int margc, char **margv)-
824{-
825 bool value;-
826-
827#if !defined TEST_STANDALONE-
828 int code;-
829-
830 code = setjmp (test_exit_buf);-
831-
832 if (code)-
833 return (test_error_return);-
834#else /* TEST_STANDALONE */-
835 initialize_main (&margc, &margv);-
836 set_program_name (margv[0]);-
837 setlocale (LC_ALL, "");-
838 bindtextdomain (PACKAGE, LOCALEDIR);-
839 textdomain (PACKAGE);-
840-
841 initialize_exit_failure (TEST_FAILURE);-
842 atexit (close_stdout);-
843#endif /* TEST_STANDALONE */-
844-
845 argv = margv;-
846-
847 if (LBRACKET)-
848 {-
849 /* Recognize --help or --version, but only when invoked in the-
850 "[" form, when the last argument is not "]". Use direct-
851 parsing, rather than parse_long_options, to avoid accepting-
852 abbreviations. POSIX allows "[ --help" and "[ --version" to-
853 have the usual GNU behavior, but it requires "test --help"-
854 and "test --version" to exit silently with status 0. */-
855 if (margc == 2)
Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • [
FALSEevaluated 1 time by 1 test
Evaluated by:
  • [
1-5
856 {-
857 if (STREQ (margv[1], "--help"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "--help"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( margv[1]
never executed
never executed
_extension__ (...) == 0)) usageDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • [
FALSEevaluated 3 times by 1 test
Evaluated by:
  • [
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
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-3
858 usage (EXIT_SUCCESS);
executed 2 times by 1 test: 0 );
Executed by:
  • [
2
859-
860 if (STREQ (margv[1], "--version"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "--version"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( margv[1]
never executed
never executed
_extension__ (...); }) == 0)) {Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • [
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
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-3
861 {-
862 version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS,-
863 (char *) NULL);-
864 test_main_return (EXIT_SUCCESS);
executed 3 times by 1 test: ; }
Executed by:
  • [
3
865 }-
866 }
never executed
0
867 if (margc < 2 || !STREQ (margv[margc - 1], "]"))
never executed: ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ( "]"
never executed
never executed
never executed: ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( margv[margc - 1]
never executed
executed 1 time by 1 test
Executed by:
  • [
Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • [
__extension__ ...syntax_error (Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • [
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
TRUEevaluated 1 time by 1 test
Evaluated by:
  • [
FALSEnever evaluated
Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • [
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • [
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
Description
TRUEnever evaluated
FALSEnever evaluated
0-1
868 test_syntax_error (_("missing %s"), quote ("]"));
never executed: dcgettext (((void *)0), "missing %s" , 5) , quote ("]"));
0
869-
870 --margc;-
871 }
executed 1 time by 1 test
Executed by:
  • [
1
872-
873 argc = margc;-
874 pos = 1;-
875-
876 if (pos >= argc)
turn TEST_FDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test
FALSEevaluated 373 times by 2 tests
Evaluated by:
  • [
  • test
1-373
877 test_main_return (TEST_FALSE);
executed 1 time by 1 test
Executed by:
  • test
1
878-
879 value = posixtest (argc - 1);-
880-
881 if (pos != argc)
st_syntax_eDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test
FALSEevaluated 371 times by 2 tests
Evaluated by:
  • [
  • test
1-371
882 test_syntax_error (_("extra argument %s"), quote (argv[pos]));
executed 1 time by 1 test: dcgettext (((void *)0), "extra argument %s" , 5) , quote (argv[pos]));
Executed by:
  • test
1
883-
884 test_main_return (value ? TEST_TRUE : TEST_FALSE);
executed 371 times by 2 tests
Executed by:
  • [
  • test
371
885}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.1.2