| Line | Source | Count |
| 1 | This file is type.def, from which is created type.c. | - |
| 2 | It implements the builtin "type" in Bash. | - |
| 3 | | - |
| 4 | Copyright (C) 1987-2015 Free Software Foundation, Inc. | - |
| 5 | | - |
| 6 | This file is part of GNU Bash, the Bourne Again SHell. | - |
| 7 | | - |
| 8 | Bash is free software: you can redistribute it and/or modify | - |
| 9 | it under the terms of the GNU General Public License as published by | - |
| 10 | the Free Software Foundation, either version 3 of the License, or | - |
| 11 | (at your option) any later version. | - |
| 12 | | - |
| 13 | Bash is distributed in the hope that it will be useful, | - |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | - |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | - |
| 16 | GNU General Public License for more details. | - |
| 17 | | - |
| 18 | You should have received a copy of the GNU General Public License | - |
| 19 | along with Bash. If not, see <http: | - |
| 20 | | - |
| 21 | $PRODUCES type.c | - |
| 22 | | - |
| 23 | $BUILTIN type | - |
| 24 | $FUNCTION type_builtin | - |
| 25 | $SHORT_DOC type [-afptP] name [name ...] | - |
| 26 | Display information about command type. | - |
| 27 | | - |
| 28 | For each NAME, indicate how it would be interpreted if used as a | - |
| 29 | command name. | - |
| 30 | | - |
| 31 | Options: | - |
| 32 | -a display all locations containing an executable named NAME; | - |
| 33 | includes aliases, builtins, and functions, if and only if | - |
| 34 | the `-p' option is not also used | - |
| 35 | -f suppress shell function lookup | - |
| 36 | -P force a PATH search for each NAME, even if it is an alias, | - |
| 37 | builtin, or function, and returns the name of the disk file | - |
| 38 | that would be executed | - |
| 39 | -p returns either the name of the disk file that would be executed, | - |
| 40 | or nothing if `type -t NAME' would not return `file' | - |
| 41 | -t output a single word which is one of `alias', `keyword', | - |
| 42 | `function', `builtin', `file' or `', if NAME is an alias, | - |
| 43 | shell reserved word, shell function, shell builtin, disk file, | - |
| 44 | or not found, respectively | - |
| 45 | | - |
| 46 | Arguments: | - |
| 47 | NAME Command name to be interpreted. | - |
| 48 | | - |
| 49 | Exit Status: | - |
| 50 | Returns success if all of the NAMEs are found; fails if any are not found. | - |
| 51 | $END | - |
| 52 | | - |
| 53 | #include <config.h> | - |
| 54 | | - |
| 55 | #include "../bashtypes.h" | - |
| 56 | #include "posixstat.h" | - |
| 57 | | - |
| 58 | #if defined (HAVE_UNISTD_H) | - |
| 59 | # include <unistd.h> | - |
| 60 | #endif | - |
| 61 | | - |
| 62 | #include <stdio.h> | - |
| 63 | #include "../bashansi.h" | - |
| 64 | #include "../bashintl.h" | - |
| 65 | | - |
| 66 | #include "../shell.h" | - |
| 67 | #include "../parser.h" | - |
| 68 | #include "../execute_cmd.h" | - |
| 69 | #include "../findcmd.h" | - |
| 70 | #include "../hashcmd.h" | - |
| 71 | | - |
| 72 | #if defined (ALIAS) | - |
| 73 | #include "../alias.h" | - |
| 74 | #endif /* ALIAS */ | - |
| 75 | | - |
| 76 | #include "common.h" | - |
| 77 | #include "bashgetopt.h" | - |
| 78 | | - |
| 79 | extern int find_reserved_word __P((char *)); | - |
| 80 | | - |
| 81 | | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | | - |
| 86 | | - |
| 87 | | - |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | | - |
| 97 | | - |
| 98 | | - |
| 99 | | - |
| 100 | | - |
| 101 | | - |
| 102 | | - |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | int | - |
| 110 | type_builtin (list) | - |
| 111 | WORD_LIST *list; | - |
| 112 | { | - |
| 113 | int dflags, any_failed, opt; | - |
| 114 | WORD_LIST *this; | - |
| 115 | | - |
| 116 | if (list == 0)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 336 times by 1 test |
| 2-336 |
| 117 | return (EXECUTION_SUCCESS);executed 2 times by 1 test: return (0); | 2 |
| 118 | | - |
| 119 | dflags = CDESC_SHORTDESC; | - |
| 120 | any_failed = 0; | - |
| 121 | | - |
| 122 | | - |
| 123 | | - |
| 124 | | - |
| 125 | | - |
| 126 | for (this = list; this && this->word->word[0] == '-'; this = this->next)| TRUE | evaluated 365 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 29 times by 1 test | | FALSE | evaluated 336 times by 1 test |
| 0-365 |
| 127 | { | - |
| 128 | char *flag = &(this->word->word[1]); | - |
| 129 | | - |
| 130 | if (STREQ (flag, "type") || STREQ (flag, "-type")) never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "type" ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "-type" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 21 times by 1 test | | FALSE | evaluated 8 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 29 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-29 |
| 131 | { | - |
| 132 | this->word->word[1] = 't'; | - |
| 133 | this->word->word[2] = '\0'; | - |
| 134 | } never executed: end of block | 0 |
| 135 | else if (STREQ (flag, "path") || STREQ (flag, "-path")) never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "path" ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "-path" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 25 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 29 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-29 |
| 136 | { | - |
| 137 | this->word->word[1] = 'p'; | - |
| 138 | this->word->word[2] = '\0'; | - |
| 139 | } never executed: end of block | 0 |
| 140 | else if (STREQ (flag, "all") || STREQ (flag, "-all")) never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "all" ))[3] - __s2[3]); never executed: end of block executed 2 times by 1 test: end of block never executed: __result = (((const unsigned char *) (const char *) ( flag ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "-all" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 27 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 29 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-29 |
| 141 | { | - |
| 142 | this->word->word[1] = 'a'; | - |
| 143 | this->word->word[2] = '\0'; | - |
| 144 | } never executed: end of block | 0 |
| 145 | }executed 29 times by 1 test: end of block | 29 |
| 146 | | - |
| 147 | reset_internal_getopt (); | - |
| 148 | while ((opt = internal_getopt (list, "afptP")) != -1)| TRUE | evaluated 29 times by 1 test | | FALSE | evaluated 334 times by 1 test |
| 29-334 |
| 149 | { | - |
| 150 | switch (opt) | - |
| 151 | { | - |
| 152 | case 'a':executed 2 times by 1 test: case 'a': | 2 |
| 153 | dflags |= CDESC_ALL; | - |
| 154 | break;executed 2 times by 1 test: break; | 2 |
| 155 | case 'f': never executed: case 'f': | 0 |
| 156 | dflags |= CDESC_NOFUNCS; | - |
| 157 | break; never executed: break; | 0 |
| 158 | case 'p':executed 4 times by 1 test: case 'p': | 4 |
| 159 | dflags |= CDESC_PATH_ONLY; | - |
| 160 | dflags &= ~(CDESC_TYPE|CDESC_SHORTDESC); | - |
| 161 | break;executed 4 times by 1 test: break; | 4 |
| 162 | case 't':executed 21 times by 1 test: case 't': | 21 |
| 163 | dflags |= CDESC_TYPE; | - |
| 164 | dflags &= ~(CDESC_PATH_ONLY|CDESC_SHORTDESC); | - |
| 165 | break;executed 21 times by 1 test: break; | 21 |
| 166 | case 'P': never executed: case 'P': | 0 |
| 167 | dflags |= (CDESC_PATH_ONLY|CDESC_FORCE_PATH); | - |
| 168 | dflags &= ~(CDESC_TYPE|CDESC_SHORTDESC); | - |
| 169 | break; never executed: break; | 0 |
| 170 | CASE_HELPOPT; never executed: return (258); never executed: case -99: | 0 |
| 171 | default:executed 2 times by 1 test: default: | 2 |
| 172 | builtin_usage (); | - |
| 173 | return (EX_USAGE);executed 2 times by 1 test: return (258); | 2 |
| 174 | } | - |
| 175 | } | - |
| 176 | list = loptend; | - |
| 177 | | - |
| 178 | while (list)| TRUE | evaluated 334 times by 1 test | | FALSE | evaluated 334 times by 1 test |
| 334 |
| 179 | { | - |
| 180 | int found; | - |
| 181 | | - |
| 182 | found = describe_command (list->word->word, dflags); | - |
| 183 | | - |
| 184 | if (!found && (dflags & (CDESC_PATH_ONLY|CDESC_TYPE)) == 0)| TRUE | evaluated 11 times by 1 test | | FALSE | evaluated 323 times by 1 test |
| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-323 |
| 185 | sh_notfound (list->word->word);executed 9 times by 1 test: sh_notfound (list->word->word); | 9 |
| 186 | | - |
| 187 | any_failed += found == 0; | - |
| 188 | list = list->next; | - |
| 189 | }executed 334 times by 1 test: end of block | 334 |
| 190 | | - |
| 191 | opt = (any_failed == 0) ? EXECUTION_SUCCESS : EXECUTION_FAILURE;| TRUE | evaluated 323 times by 1 test | | FALSE | evaluated 11 times by 1 test |
| 11-323 |
| 192 | return (sh_chkwrite (opt));executed 334 times by 1 test: return (sh_chkwrite (opt)); | 334 |
| 193 | } | - |
| 194 | | - |
| 195 | | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| 201 | | - |
| 202 | | - |
| 203 | | - |
| 204 | | - |
| 205 | | - |
| 206 | | - |
| 207 | | - |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | int | - |
| 213 | describe_command (command, dflags) | - |
| 214 | char *command; | - |
| 215 | int dflags; | - |
| 216 | { | - |
| 217 | int found, i, found_file, f, all; | - |
| 218 | char *full_path, *x, *pathlist; | - |
| 219 | SHELL_VAR *func; | - |
| 220 | #if defined (ALIAS) | - |
| 221 | alias_t *alias; | - |
| 222 | #endif | - |
| 223 | | - |
| 224 | all = (dflags & CDESC_ALL) != 0; | - |
| 225 | found = found_file = 0; | - |
| 226 | full_path = (char *)NULL; | - |
| 227 | | - |
| 228 | #if defined (ALIAS) | - |
| 229 | | - |
| 230 | if (((dflags & CDESC_FORCE_PATH) == 0) && expand_aliases && (alias = find_alias (command)))| TRUE | evaluated 368 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 21 times by 1 test | | FALSE | evaluated 347 times by 1 test |
| TRUE | evaluated 8 times by 1 test | | FALSE | evaluated 13 times by 1 test |
| 0-368 |
| 231 | { | - |
| 232 | if (dflags & CDESC_TYPE)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 6 times by 1 test |
| 2-6 |
| 233 | puts ("alias");executed 2 times by 1 test: puts ("alias"); | 2 |
| 234 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-4 |
| 235 | printf (_("%s is aliased to `%s'\n"), command, alias->value);executed 4 times by 1 test: printf ( dcgettext (((void *)0), "%s is aliased to `%s'\n" , 5) , command, alias->value); | 4 |
| 236 | else if (dflags & CDESC_REUSABLE)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 237 | { | - |
| 238 | x = sh_single_quote (alias->value); | - |
| 239 | printf ("alias %s=%s\n", command, x); | - |
| 240 | free (x); | - |
| 241 | }executed 2 times by 1 test: end of block | 2 |
| 242 | | - |
| 243 | found = 1; | - |
| 244 | | - |
| 245 | if (all == 0)| TRUE | evaluated 8 times by 1 test | | FALSE | never evaluated |
| 0-8 |
| 246 | return (1);executed 8 times by 1 test: return (1); | 8 |
| 247 | } never executed: end of block | 0 |
| 248 | #endif /* ALIAS */ | - |
| 249 | | - |
| 250 | | - |
| 251 | if (((dflags & CDESC_FORCE_PATH) == 0) && (i = find_reserved_word (command)) >= 0)| TRUE | evaluated 360 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 350 times by 1 test |
| 0-360 |
| 252 | { | - |
| 253 | if (dflags & CDESC_TYPE)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 8 times by 1 test |
| 2-8 |
| 254 | puts ("keyword");executed 2 times by 1 test: puts ("keyword"); | 2 |
| 255 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-6 |
| 256 | printf (_("%s is a shell keyword\n"), command);executed 6 times by 1 test: printf ( dcgettext (((void *)0), "%s is a shell keyword\n" , 5) , command); | 6 |
| 257 | else if (dflags & CDESC_REUSABLE)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 258 | printf ("%s\n", command);executed 2 times by 1 test: printf ("%s\n", command); | 2 |
| 259 | | - |
| 260 | found = 1; | - |
| 261 | | - |
| 262 | if (all == 0)| TRUE | evaluated 8 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-8 |
| 263 | return (1);executed 8 times by 1 test: return (1); | 8 |
| 264 | }executed 2 times by 1 test: end of block | 2 |
| 265 | | - |
| 266 | | - |
| 267 | if (((dflags & (CDESC_FORCE_PATH|CDESC_NOFUNCS)) == 0) && (func = find_function (command)))| TRUE | evaluated 352 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 283 times by 1 test | | FALSE | evaluated 69 times by 1 test |
| 0-352 |
| 268 | { | - |
| 269 | if (dflags & CDESC_TYPE)| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 280 times by 1 test |
| 3-280 |
| 270 | puts ("function");executed 3 times by 1 test: puts ("function"); | 3 |
| 271 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 278 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-278 |
| 272 | { | - |
| 273 | char *result; | - |
| 274 | | - |
| 275 | printf (_("%s is a function\n"), command); | - |
| 276 | | - |
| 277 | | - |
| 278 | | - |
| 279 | result = named_function_string (command, function_cell (func), FUNC_MULTILINE|FUNC_EXTERNAL); | - |
| 280 | printf ("%s\n", result); | - |
| 281 | }executed 278 times by 1 test: end of block | 278 |
| 282 | else if (dflags & CDESC_REUSABLE)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 283 | printf ("%s\n", command);executed 2 times by 1 test: printf ("%s\n", command); | 2 |
| 284 | | - |
| 285 | found = 1; | - |
| 286 | | - |
| 287 | if (all == 0)| TRUE | evaluated 283 times by 1 test | | FALSE | never evaluated |
| 0-283 |
| 288 | return (1);executed 283 times by 1 test: return (1); | 283 |
| 289 | } never executed: end of block | 0 |
| 290 | | - |
| 291 | | - |
| 292 | if (((dflags & CDESC_FORCE_PATH) == 0) && find_shell_builtin (command))| TRUE | evaluated 69 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 60 times by 1 test |
| 0-69 |
| 293 | { | - |
| 294 | if (dflags & CDESC_TYPE)| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 6 times by 1 test |
| 3-6 |
| 295 | puts ("builtin");executed 3 times by 1 test: puts ("builtin"); | 3 |
| 296 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-4 |
| 297 | { | - |
| 298 | if (posixly_correct && find_special_builtin (command) != 0)| TRUE | never evaluated | | FALSE | evaluated 4 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-4 |
| 299 | printf (_("%s is a special shell builtin\n"), command); never executed: printf ( dcgettext (((void *)0), "%s is a special shell builtin\n" , 5) , command); | 0 |
| 300 | else | - |
| 301 | printf (_("%s is a shell builtin\n"), command);executed 4 times by 1 test: printf ( dcgettext (((void *)0), "%s is a shell builtin\n" , 5) , command); | 4 |
| 302 | } | - |
| 303 | else if (dflags & CDESC_REUSABLE)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 304 | printf ("%s\n", command);executed 2 times by 1 test: printf ("%s\n", command); | 2 |
| 305 | | - |
| 306 | found = 1; | - |
| 307 | | - |
| 308 | if (all == 0)| TRUE | evaluated 9 times by 1 test | | FALSE | never evaluated |
| 0-9 |
| 309 | return (1);executed 9 times by 1 test: return (1); | 9 |
| 310 | } never executed: end of block | 0 |
| 311 | | - |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | if (absolute_program (command))| TRUE | evaluated 10 times by 1 test | | FALSE | evaluated 50 times by 1 test |
| 10-50 |
| 316 | { | - |
| 317 | f = file_status (command); | - |
| 318 | if (f & FS_EXECABLE)| TRUE | evaluated 10 times by 1 test | | FALSE | never evaluated |
| 0-10 |
| 319 | { | - |
| 320 | if (dflags & CDESC_TYPE)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 6 times by 1 test |
| 4-6 |
| 321 | puts ("file");executed 4 times by 1 test: puts ("file"); | 4 |
| 322 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 4 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-4 |
| 323 | printf (_("%s is %s\n"), command, command);executed 4 times by 1 test: printf ( dcgettext (((void *)0), "%s is %s\n" , 5) , command, command); | 4 |
| 324 | else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY))| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 325 | printf ("%s\n", command);executed 2 times by 1 test: printf ("%s\n", command); | 2 |
| 326 | | - |
| 327 | | - |
| 328 | | - |
| 329 | | - |
| 330 | return (1);executed 10 times by 1 test: return (1); | 10 |
| 331 | } | - |
| 332 | } never executed: end of block | 0 |
| 333 | | - |
| 334 | | - |
| 335 | | - |
| 336 | if (all == 0 || (dflags & CDESC_FORCE_PATH))| TRUE | evaluated 48 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| 0-48 |
| 337 | { | - |
| 338 | if (full_path = phash_search (command))| TRUE | evaluated 8 times by 1 test | | FALSE | evaluated 40 times by 1 test |
| 8-40 |
| 339 | { | - |
| 340 | if (dflags & CDESC_TYPE)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 6 times by 1 test |
| 2-6 |
| 341 | puts ("file");executed 2 times by 1 test: puts ("file"); | 2 |
| 342 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 4 times by 1 test |
| 2-4 |
| 343 | printf (_("%s is hashed (%s)\n"), command, full_path);executed 2 times by 1 test: printf ( dcgettext (((void *)0), "%s is hashed (%s)\n" , 5) , command, full_path); | 2 |
| 344 | else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY))| TRUE | evaluated 4 times by 1 test | | FALSE | never evaluated |
| 0-4 |
| 345 | printf ("%s\n", full_path);executed 4 times by 1 test: printf ("%s\n", full_path); | 4 |
| 346 | | - |
| 347 | free (full_path); | - |
| 348 | return (1);executed 8 times by 1 test: return (1); | 8 |
| 349 | } | - |
| 350 | }executed 40 times by 1 test: end of block | 40 |
| 351 | | - |
| 352 | | - |
| 353 | while (1) | - |
| 354 | { | - |
| 355 | if (dflags & CDESC_STDPATH) | TRUE | evaluated 6 times by 1 test | | FALSE | evaluated 36 times by 1 test |
| 6-36 |
| 356 | { | - |
| 357 | pathlist = conf_standard_path (); | - |
| 358 | full_path = find_in_path (command, pathlist, FS_EXEC_PREFERRED|FS_NODIRS); | - |
| 359 | free (pathlist); | - |
| 360 | | - |
| 361 | }executed 6 times by 1 test: end of block | 6 |
| 362 | else if (all == 0)| TRUE | evaluated 34 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-34 |
| 363 | full_path = find_user_command (command);executed 34 times by 1 test: full_path = find_user_command (command); | 34 |
| 364 | else | - |
| 365 | full_path = user_command_matches (command, FS_EXEC_ONLY, found_file); executed 2 times by 1 test: full_path = user_command_matches (command, 0x8, found_file); | 2 |
| 366 | | - |
| 367 | if (full_path == 0)| TRUE | evaluated 19 times by 1 test | | FALSE | evaluated 23 times by 1 test |
| 19-23 |
| 368 | break;executed 19 times by 1 test: break; | 19 |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | | - |
| 373 | | - |
| 374 | if (STREQ (full_path, command) || posixly_correct) never executed: __result = (((const unsigned char *) (const char *) ( full_path ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( command ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 21 times by 1 test |
| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| 0-21 |
| 375 | { | - |
| 376 | f = file_status (full_path); | - |
| 377 | if ((f & FS_EXECABLE) == 0)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 378 | { | - |
| 379 | free (full_path); | - |
| 380 | full_path = (char *)NULL; | - |
| 381 | if (all == 0)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 382 | break;executed 2 times by 1 test: break; | 2 |
| 383 | } never executed: end of block | 0 |
| 384 | else if (ABSPATH (full_path))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 385 | ; never executed: ; | 0 |
| 386 | else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY|CDESC_SHORTDESC))| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 387 | { | - |
| 388 | f = MP_DOCWD | ((dflags & CDESC_ABSPATH) ? MP_RMDOT : 0); | - |
| 389 | x = sh_makepath ((char *)NULL, full_path, f); | - |
| 390 | free (full_path); | - |
| 391 | full_path = x; | - |
| 392 | } never executed: end of block | 0 |
| 393 | } never executed: end of block | 0 |
| 394 | | - |
| 395 | else if ((dflags & CDESC_ABSPATH) && ABSPATH (full_path) == 0)| TRUE | never evaluated | | FALSE | evaluated 21 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-21 |
| 396 | { | - |
| 397 | x = sh_makepath ((char *)NULL, full_path, MP_DOCWD|MP_RMDOT); | - |
| 398 | free (full_path); | - |
| 399 | full_path = x; | - |
| 400 | } never executed: end of block | 0 |
| 401 | | - |
| 402 | found_file++; | - |
| 403 | found = 1; | - |
| 404 | | - |
| 405 | if (dflags & CDESC_TYPE)| TRUE | evaluated 3 times by 1 test | | FALSE | evaluated 18 times by 1 test |
| 3-18 |
| 406 | puts ("file");executed 3 times by 1 test: puts ("file"); | 3 |
| 407 | else if (dflags & CDESC_SHORTDESC)| TRUE | evaluated 12 times by 1 test | | FALSE | evaluated 6 times by 1 test |
| 6-12 |
| 408 | printf (_("%s is %s\n"), command, full_path);executed 12 times by 1 test: printf ( dcgettext (((void *)0), "%s is %s\n" , 5) , command, full_path); | 12 |
| 409 | else if (dflags & (CDESC_REUSABLE|CDESC_PATH_ONLY))| TRUE | evaluated 6 times by 1 test | | FALSE | never evaluated |
| 0-6 |
| 410 | printf ("%s\n", full_path);executed 6 times by 1 test: printf ("%s\n", full_path); | 6 |
| 411 | | - |
| 412 | free (full_path); | - |
| 413 | full_path = (char *)NULL; | - |
| 414 | | - |
| 415 | if (all == 0)| TRUE | evaluated 21 times by 1 test | | FALSE | never evaluated |
| 0-21 |
| 416 | break;executed 21 times by 1 test: break; | 21 |
| 417 | } never executed: end of block | 0 |
| 418 | | - |
| 419 | return (found);executed 42 times by 1 test: return (found); | 42 |
| 420 | } | - |
| | |