| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | #define INSTALL_DEBUG_MODE | - |
| 27 | | - |
| 28 | #include "config.h" | - |
| 29 | | - |
| 30 | #include "bashtypes.h" | - |
| 31 | #if !defined (_MINIX) && defined (HAVE_SYS_FILE_H) | - |
| 32 | # include <sys/file.h> | - |
| 33 | #endif | - |
| 34 | #include "posixstat.h" | - |
| 35 | #include "posixtime.h" | - |
| 36 | #include "bashansi.h" | - |
| 37 | #include <stdio.h> | - |
| 38 | #include <signal.h> | - |
| 39 | #include <errno.h> | - |
| 40 | #include "filecntl.h" | - |
| 41 | #if defined (HAVE_PWD_H) | - |
| 42 | # include <pwd.h> | - |
| 43 | #endif | - |
| 44 | | - |
| 45 | #if defined (HAVE_UNISTD_H) | - |
| 46 | # include <unistd.h> | - |
| 47 | #endif | - |
| 48 | | - |
| 49 | #include "bashintl.h" | - |
| 50 | | - |
| 51 | #define NEED_SH_SETLINEBUF_DECL /* used in externs.h */ | - |
| 52 | | - |
| 53 | #include "shell.h" | - |
| 54 | #include "parser.h" | - |
| 55 | #include "flags.h" | - |
| 56 | #include "trap.h" | - |
| 57 | #include "mailcheck.h" | - |
| 58 | #include "builtins.h" | - |
| 59 | #include "builtins/common.h" | - |
| 60 | | - |
| 61 | #if defined (JOB_CONTROL) | - |
| 62 | #include "jobs.h" | - |
| 63 | #else | - |
| 64 | extern int running_in_background; | - |
| 65 | extern int initialize_job_control __P((int)); | - |
| 66 | extern int get_tty_state __P((void)); | - |
| 67 | #endif /* JOB_CONTROL */ | - |
| 68 | | - |
| 69 | #include "input.h" | - |
| 70 | #include "execute_cmd.h" | - |
| 71 | #include "findcmd.h" | - |
| 72 | | - |
| 73 | #if defined (USING_BASH_MALLOC) && defined (DEBUG) && !defined (DISABLE_MALLOC_WRAPPERS) | - |
| 74 | # include <malloc/shmalloc.h> | - |
| 75 | #endif | - |
| 76 | | - |
| 77 | #if defined (HISTORY) | - |
| 78 | # include "bashhist.h" | - |
| 79 | # include <readline/history.h> | - |
| 80 | #endif | - |
| 81 | | - |
| 82 | #if defined (READLINE) | - |
| 83 | # include <readline/readline.h> | - |
| 84 | # include "bashline.h" | - |
| 85 | #endif | - |
| 86 | | - |
| 87 | #include <tilde/tilde.h> | - |
| 88 | #include <glob/strmatch.h> | - |
| 89 | | - |
| 90 | #if defined (__OPENNT) | - |
| 91 | # include <opennt/opennt.h> | - |
| 92 | #endif | - |
| 93 | | - |
| 94 | #if !defined (HAVE_GETPW_DECLS) | - |
| 95 | extern struct passwd *getpwuid (); | - |
| 96 | #endif /* !HAVE_GETPW_DECLS */ | - |
| 97 | | - |
| 98 | #if !defined (errno) | - |
| 99 | extern int errno; | - |
| 100 | #endif | - |
| 101 | | - |
| 102 | #if defined (NO_MAIN_ENV_ARG) | - |
| 103 | extern char **environ; | - |
| 104 | #endif | - |
| 105 | | - |
| 106 | extern int gnu_error_format; | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | int shell_initialized = 0; | - |
| 111 | int bash_argv_initialized = 0; | - |
| 112 | | - |
| 113 | COMMAND *global_command = (COMMAND *)NULL; | - |
| 114 | | - |
| 115 | | - |
| 116 | struct user_info current_user = | - |
| 117 | { | - |
| 118 | (uid_t)-1, (uid_t)-1, (gid_t)-1, (gid_t)-1, | - |
| 119 | (char *)NULL, (char *)NULL, (char *)NULL | - |
| 120 | }; | - |
| 121 | | - |
| 122 | | - |
| 123 | char *current_host_name = (char *)NULL; | - |
| 124 | | - |
| 125 | | - |
| 126 | | - |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | | - |
| 132 | int login_shell = 0; | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | int interactive = 0; | - |
| 138 | | - |
| 139 | | - |
| 140 | int interactive_shell = 0; | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | int hup_on_exit = 0; | - |
| 145 | | - |
| 146 | | - |
| 147 | int check_jobs_at_exit = 0; | - |
| 148 | | - |
| 149 | | - |
| 150 | int autocd = 0; | - |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | | - |
| 155 | | - |
| 156 | | - |
| 157 | | - |
| 158 | | - |
| 159 | int startup_state = 0; | - |
| 160 | int reading_shell_script = 0; | - |
| 161 | | - |
| 162 | | - |
| 163 | int debugging_login_shell = 0; | - |
| 164 | | - |
| 165 | | - |
| 166 | char **shell_environment; | - |
| 167 | | - |
| 168 | | - |
| 169 | int executing = 0; | - |
| 170 | | - |
| 171 | | - |
| 172 | int current_command_number = 1; | - |
| 173 | | - |
| 174 | | - |
| 175 | int indirection_level = 0; | - |
| 176 | | - |
| 177 | | - |
| 178 | char *shell_name = (char *)NULL; | - |
| 179 | | - |
| 180 | | - |
| 181 | time_t shell_start_time; | - |
| 182 | | - |
| 183 | | - |
| 184 | int running_under_emacs; | - |
| 185 | | - |
| 186 | | - |
| 187 | #ifdef HAVE_DEV_FD | - |
| 188 | int have_devfd = HAVE_DEV_FD; | - |
| 189 | #else | - |
| 190 | int have_devfd = 0; | - |
| 191 | #endif | - |
| 192 | | - |
| 193 | | - |
| 194 | static char *bashrc_file = DEFAULT_BASHRC; | - |
| 195 | | - |
| 196 | | - |
| 197 | static int act_like_sh; | - |
| 198 | | - |
| 199 | | - |
| 200 | static int su_shell; | - |
| 201 | | - |
| 202 | | - |
| 203 | static int sourced_env; | - |
| 204 | | - |
| 205 | | - |
| 206 | static int running_setuid; | - |
| 207 | | - |
| 208 | | - |
| 209 | static int debugging; | - |
| 210 | static int no_rc; | - |
| 211 | static int no_profile; | - |
| 212 | static int do_version; | - |
| 213 | static int make_login_shell; | - |
| 214 | static int want_initial_help; | - |
| 215 | | - |
| 216 | int debugging_mode = 0; | - |
| 217 | #if defined (READLINE) | - |
| 218 | int no_line_editing = 0; | - |
| 219 | #else | - |
| 220 | int no_line_editing = 1; | - |
| 221 | #endif | - |
| 222 | int dump_translatable_strings; | - |
| 223 | int dump_po_strings; | - |
| 224 | int wordexp_only = 0; | - |
| 225 | int protected_mode = 0; | - |
| 226 | | - |
| 227 | int pretty_print_mode = 0; | - |
| 228 | | - |
| 229 | #if defined (STRICT_POSIX) | - |
| 230 | int posixly_correct = 1; | - |
| 231 | #else | - |
| 232 | int posixly_correct = 0; | - |
| 233 | #endif | - |
| 234 | | - |
| 235 | | - |
| 236 | #define Int 1 | - |
| 237 | #define Charp 2 | - |
| 238 | static const struct { | - |
| 239 | const char *name; | - |
| 240 | int type; | - |
| 241 | int *int_value; | - |
| 242 | char **char_value; | - |
| 243 | } long_args[] = { | - |
| 244 | { "debug", Int, &debugging, (char **)0x0 }, | - |
| 245 | #if defined (DEBUGGER) | - |
| 246 | { "debugger", Int, &debugging_mode, (char **)0x0 }, | - |
| 247 | #endif | - |
| 248 | { "dump-po-strings", Int, &dump_po_strings, (char **)0x0 }, | - |
| 249 | { "dump-strings", Int, &dump_translatable_strings, (char **)0x0 }, | - |
| 250 | { "help", Int, &want_initial_help, (char **)0x0 }, | - |
| 251 | { "init-file", Charp, (int *)0x0, &bashrc_file }, | - |
| 252 | { "login", Int, &make_login_shell, (char **)0x0 }, | - |
| 253 | { "noediting", Int, &no_line_editing, (char **)0x0 }, | - |
| 254 | { "noprofile", Int, &no_profile, (char **)0x0 }, | - |
| 255 | { "norc", Int, &no_rc, (char **)0x0 }, | - |
| 256 | { "posix", Int, &posixly_correct, (char **)0x0 }, | - |
| 257 | { "pretty-print", Int, &pretty_print_mode, (char **)0x0 }, | - |
| 258 | #if defined (WORDEXP_OPTION) | - |
| 259 | { "protected", Int, &protected_mode, (char **)0x0 }, | - |
| 260 | #endif | - |
| 261 | { "rcfile", Charp, (int *)0x0, &bashrc_file }, | - |
| 262 | #if defined (RESTRICTED_SHELL) | - |
| 263 | { "restricted", Int, &restricted, (char **)0x0 }, | - |
| 264 | #endif | - |
| 265 | { "verbose", Int, &verbose_flag, (char **)0x0 }, | - |
| 266 | { "version", Int, &do_version, (char **)0x0 }, | - |
| 267 | #if defined (WORDEXP_OPTION) | - |
| 268 | { "wordexp", Int, &wordexp_only, (char **)0x0 }, | - |
| 269 | #endif | - |
| 270 | { (char *)0x0, Int, (int *)0x0, (char **)0x0 } | - |
| 271 | }; | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | procenv_t subshell_top_level; | - |
| 278 | int subshell_argc; | - |
| 279 | char **subshell_argv; | - |
| 280 | char **subshell_envp; | - |
| 281 | | - |
| 282 | char *exec_argv0; | - |
| 283 | | - |
| 284 | #if defined (BUFFERED_INPUT) | - |
| 285 | | - |
| 286 | int default_buffered_input = -1; | - |
| 287 | #endif | - |
| 288 | | - |
| 289 | | - |
| 290 | int read_from_stdin; | - |
| 291 | int want_pending_command; | - |
| 292 | | - |
| 293 | | - |
| 294 | char *command_execution_string; | - |
| 295 | char *shell_script_filename; | - |
| 296 | | - |
| 297 | int malloc_trace_at_exit = 0; | - |
| 298 | | - |
| 299 | static int shell_reinitialized = 0; | - |
| 300 | | - |
| 301 | static FILE *default_input; | - |
| 302 | | - |
| 303 | static STRING_INT_ALIST *shopt_alist; | - |
| 304 | static int shopt_ind = 0, shopt_len = 0; | - |
| 305 | | - |
| 306 | static int parse_long_options __P((char **, int, int)); | - |
| 307 | static int parse_shell_options __P((char **, int, int)); | - |
| 308 | static int bind_args __P((char **, int, int, int)); | - |
| 309 | | - |
| 310 | static void start_debugger __P((void)); | - |
| 311 | | - |
| 312 | static void add_shopt_to_alist __P((char *, int)); | - |
| 313 | static void run_shopt_alist __P((void)); | - |
| 314 | | - |
| 315 | static void execute_env_file __P((char *)); | - |
| 316 | static void run_startup_files __P((void)); | - |
| 317 | static int open_shell_script __P((char *)); | - |
| 318 | static void set_bash_input __P((void)); | - |
| 319 | static int run_one_command __P((char *)); | - |
| 320 | #if defined (WORDEXP_OPTION) | - |
| 321 | static int run_wordexp __P((char *)); | - |
| 322 | #endif | - |
| 323 | | - |
| 324 | static int uidget __P((void)); | - |
| 325 | | - |
| 326 | static void init_interactive __P((void)); | - |
| 327 | static void init_noninteractive __P((void)); | - |
| 328 | static void init_interactive_script __P((void)); | - |
| 329 | | - |
| 330 | static void set_shell_name __P((char *)); | - |
| 331 | static void shell_initialize __P((void)); | - |
| 332 | static void shell_reinitialize __P((void)); | - |
| 333 | | - |
| 334 | static void show_shell_usage __P((FILE *, int)); | - |
| 335 | | - |
| 336 | #ifdef __CYGWIN__ | - |
| 337 | static void | - |
| 338 | _cygwin32_check_tmp () | - |
| 339 | { | - |
| 340 | struct stat sb; | - |
| 341 | | - |
| 342 | if (stat ("/tmp", &sb) < 0) | - |
| 343 | internal_warning (_("could not find /tmp, please create!")); | - |
| 344 | else | - |
| 345 | { | - |
| 346 | if (S_ISDIR (sb.st_mode) == 0) | - |
| 347 | internal_warning (_("/tmp must be a valid directory name")); | - |
| 348 | } | - |
| 349 | } | - |
| 350 | #endif /* __CYGWIN__ */ | - |
| 351 | | - |
| 352 | #if defined (NO_MAIN_ENV_ARG) | - |
| 353 | | - |
| 354 | int | - |
| 355 | main (argc, argv) | - |
| 356 | int argc; | - |
| 357 | char **argv; | - |
| 358 | #else /* !NO_MAIN_ENV_ARG */ | - |
| 359 | int | - |
| 360 | main (argc, argv, env) | - |
| 361 | int argc; | - |
| 362 | char **argv, **env; | - |
| 363 | #endif /* !NO_MAIN_ENV_ARG */ | - |
| 364 | { | - |
| 365 | register int i; | - |
| 366 | int code, old_errexit_flag; | - |
| 367 | #if defined (RESTRICTED_SHELL) | - |
| 368 | int saverst; | - |
| 369 | #endif | - |
| 370 | volatile int locally_skip_execution; | - |
| 371 | volatile int arg_index, top_level_arg_index; | - |
| 372 | #ifdef __OPENNT | - |
| 373 | char **env; | - |
| 374 | | - |
| 375 | env = environ; | - |
| 376 | #endif /* __OPENNT */ | - |
| 377 | | - |
| 378 | USE_VAR(argc); | - |
| 379 | USE_VAR(argv); | - |
| 380 | USE_VAR(env); | - |
| 381 | USE_VAR(code); | - |
| 382 | USE_VAR(old_errexit_flag); | - |
| 383 | #if defined (RESTRICTED_SHELL) | - |
| 384 | USE_VAR(saverst); | - |
| 385 | #endif | - |
| 386 | | - |
| 387 | | - |
| 388 | code = setjmp_nosigs (top_level); | - |
| 389 | if (code)| TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 390 | exit (2); never executed: exit (2); | 0 |
| 391 | | - |
| 392 | xtrace_init (); | - |
| 393 | | - |
| 394 | #if defined (USING_BASH_MALLOC) && defined (DEBUG) && !defined (DISABLE_MALLOC_WRAPPERS) | - |
| 395 | malloc_set_register (1); | - |
| 396 | #endif | - |
| 397 | | - |
| 398 | check_dev_tty (); | - |
| 399 | | - |
| 400 | #ifdef __CYGWIN__ | - |
| 401 | _cygwin32_check_tmp (); | - |
| 402 | #endif /* __CYGWIN__ */ | - |
| 403 | | - |
| 404 | | - |
| 405 | while (debugging_login_shell) sleep (3); never executed: sleep (3); | TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 406 | | - |
| 407 | set_default_locale (); | - |
| 408 | | - |
| 409 | running_setuid = uidget (); | - |
| 410 | | - |
| 411 | if (getenv ("POSIXLY_CORRECT") || getenv ("POSIX_PEDANTIC"))| TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 412 | posixly_correct = 1; never executed: posixly_correct = 1; | 0 |
| 413 | | - |
| 414 | #if defined (USE_GNU_MALLOC_LIBRARY) | - |
| 415 | mcheck (programming_error, (void (*) ())0); | - |
| 416 | #endif /* USE_GNU_MALLOC_LIBRARY */ | - |
| 417 | | - |
| 418 | if (setjmp_sigs (subshell_top_level))| TRUE | evaluated 15 times by 1 test | | FALSE | evaluated 5432 times by 1 test |
| 15-5432 |
| 419 | { | - |
| 420 | argc = subshell_argc; | - |
| 421 | argv = subshell_argv; | - |
| 422 | env = subshell_envp; | - |
| 423 | sourced_env = 0; | - |
| 424 | }executed 15 times by 1 test: end of block | 15 |
| 425 | | - |
| 426 | shell_reinitialized = 0; | - |
| 427 | | - |
| 428 | | - |
| 429 | arg_index = 1; | - |
| 430 | if (arg_index > argc)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 431 | arg_index = argc; never executed: arg_index = argc; | 0 |
| 432 | command_execution_string = shell_script_filename = (char *)NULL; | - |
| 433 | want_pending_command = locally_skip_execution = read_from_stdin = 0; | - |
| 434 | default_input = stdin; | - |
| 435 | #if defined (BUFFERED_INPUT) | - |
| 436 | default_buffered_input = -1; | - |
| 437 | #endif | - |
| 438 | | - |
| 439 | | - |
| 440 | | - |
| 441 | login_shell = make_login_shell = 0; | - |
| 442 | | - |
| 443 | | - |
| 444 | | - |
| 445 | if (shell_initialized || shell_name)| TRUE | evaluated 15 times by 1 test | | FALSE | evaluated 5432 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 446 | { | - |
| 447 | | - |
| 448 | if (*shell_name == '-')| TRUE | never evaluated | | FALSE | evaluated 15 times by 1 test |
| 0-15 |
| 449 | shell_name++; never executed: shell_name++; | 0 |
| 450 | | - |
| 451 | shell_reinitialize (); | - |
| 452 | if (setjmp_nosigs (top_level))| TRUE | never evaluated | | FALSE | evaluated 15 times by 1 test |
| 0-15 |
| 453 | exit (2); never executed: exit (2); | 0 |
| 454 | }executed 15 times by 1 test: end of block | 15 |
| 455 | | - |
| 456 | shell_environment = env; | - |
| 457 | set_shell_name (argv[0]); | - |
| 458 | shell_start_time = NOW; | - |
| 459 | | - |
| 460 | | - |
| 461 | | - |
| 462 | | - |
| 463 | arg_index = parse_long_options (argv, arg_index, argc); | - |
| 464 | | - |
| 465 | if (want_initial_help)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 466 | { | - |
| 467 | show_shell_usage (stdout, 1); | - |
| 468 | exit (EXECUTION_SUCCESS); never executed: exit (0); | 0 |
| 469 | } | - |
| 470 | | - |
| 471 | if (do_version)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 472 | { | - |
| 473 | show_shell_version (1); | - |
| 474 | exit (EXECUTION_SUCCESS); never executed: exit (0); | 0 |
| 475 | } | - |
| 476 | | - |
| 477 | echo_input_at_read = verbose_flag; | - |
| 478 | | - |
| 479 | | - |
| 480 | this_command_name = shell_name; | - |
| 481 | arg_index = parse_shell_options (argv, arg_index, argc); | - |
| 482 | | - |
| 483 | | - |
| 484 | | - |
| 485 | if (make_login_shell)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 486 | { | - |
| 487 | login_shell++; | - |
| 488 | login_shell = -login_shell; | - |
| 489 | } never executed: end of block | 0 |
| 490 | | - |
| 491 | set_login_shell ("login_shell", login_shell != 0); | - |
| 492 | | - |
| 493 | if (dump_po_strings)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 494 | dump_translatable_strings = 1; never executed: dump_translatable_strings = 1; | 0 |
| 495 | | - |
| 496 | if (dump_translatable_strings)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 497 | read_but_dont_execute = 1; never executed: read_but_dont_execute = 1; | 0 |
| 498 | | - |
| 499 | if (running_setuid && privileged_mode == 0)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5447 |
| 500 | disable_priv_mode (); never executed: disable_priv_mode (); | 0 |
| 501 | | - |
| 502 | | - |
| 503 | | - |
| 504 | | - |
| 505 | if (want_pending_command)| TRUE | evaluated 177 times by 1 test | | FALSE | evaluated 5270 times by 1 test |
| 177-5270 |
| 506 | { | - |
| 507 | command_execution_string = argv[arg_index]; | - |
| 508 | if (command_execution_string == 0)| TRUE | never evaluated | | FALSE | evaluated 177 times by 1 test |
| 0-177 |
| 509 | { | - |
| 510 | report_error (_("%s: option requires an argument"), "-c"); | - |
| 511 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 512 | } | - |
| 513 | arg_index++; | - |
| 514 | }executed 177 times by 1 test: end of block | 177 |
| 515 | this_command_name = (char *)NULL; | - |
| 516 | | - |
| 517 | | - |
| 518 | | - |
| 519 | | - |
| 520 | | - |
| 521 | | - |
| 522 | | - |
| 523 | | - |
| 524 | | - |
| 525 | | - |
| 526 | if (forced_interactive || | TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
| 527 | (!command_execution_string && | TRUE | evaluated 5268 times by 1 test | | FALSE | evaluated 177 times by 1 test |
| 177-5268 |
| 528 | wordexp_only == 0 && | TRUE | evaluated 5268 times by 1 test | | FALSE | never evaluated |
| 0-5268 |
| 529 | ((arg_index == argc) || | TRUE | evaluated 5 times by 1 test | | FALSE | evaluated 5263 times by 1 test |
| 5-5263 |
| 530 | read_from_stdin) && | TRUE | never evaluated | | FALSE | evaluated 5263 times by 1 test |
| 0-5263 |
| 531 | isatty (fileno (stdin)) && | TRUE | never evaluated | | FALSE | evaluated 5 times by 1 test |
| 0-5 |
| 532 | isatty (fileno (stderr)))) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 533 | init_interactive ();executed 2 times by 1 test: init_interactive (); | 2 |
| 534 | else | - |
| 535 | init_noninteractive ();executed 5445 times by 1 test: init_noninteractive (); | 5445 |
| 536 | | - |
| 537 | | - |
| 538 | | - |
| 539 | | - |
| 540 | | - |
| 541 | | - |
| 542 | | - |
| 543 | | - |
| 544 | | - |
| 545 | | - |
| 546 | if (login_shell && interactive_shell)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5446 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
| 0-5446 |
| 547 | { | - |
| 548 | for (i = 3; i < 20; i++)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 549 | SET_CLOSE_ON_EXEC (i); never executed: (fcntl ((i), 2 , 1 )); | 0 |
| 550 | } never executed: end of block | 0 |
| 551 | | - |
| 552 | | - |
| 553 | | - |
| 554 | if (posixly_correct)| TRUE | evaluated 17 times by 1 test | | FALSE | evaluated 5430 times by 1 test |
| 17-5430 |
| 555 | { | - |
| 556 | bind_variable ("POSIXLY_CORRECT", "y", 0); | - |
| 557 | sv_strict_posix ("POSIXLY_CORRECT"); | - |
| 558 | }executed 17 times by 1 test: end of block | 17 |
| 559 | | - |
| 560 | | - |
| 561 | if (shopt_alist)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 562 | run_shopt_alist (); never executed: run_shopt_alist (); | 0 |
| 563 | | - |
| 564 | | - |
| 565 | | - |
| 566 | shell_initialize (); | - |
| 567 | | - |
| 568 | set_default_lang (); | - |
| 569 | set_default_locale_vars (); | - |
| 570 | | - |
| 571 | | - |
| 572 | | - |
| 573 | | - |
| 574 | | - |
| 575 | | - |
| 576 | | - |
| 577 | | - |
| 578 | | - |
| 579 | | - |
| 580 | | - |
| 581 | if (interactive_shell)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
| 582 | { | - |
| 583 | char *term, *emacs, *inside_emacs; | - |
| 584 | int emacs_term, in_emacs; | - |
| 585 | | - |
| 586 | term = get_string_value ("TERM"); | - |
| 587 | emacs = get_string_value ("EMACS"); | - |
| 588 | inside_emacs = get_string_value ("INSIDE_EMACS"); | - |
| 589 | | - |
| 590 | if (inside_emacs)| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| 0-2 |
| 591 | { | - |
| 592 | emacs_term = strstr (inside_emacs, ",term:") != 0; | - |
| 593 | in_emacs = 1; | - |
| 594 | } never executed: end of block | 0 |
| 595 | else if (emacs)| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| 0-2 |
| 596 | { | - |
| 597 | | - |
| 598 | emacs_term = strstr (emacs, " (term:") != 0; | - |
| 599 | in_emacs = emacs_term || STREQ (emacs, "t"); never executed: __result = (((const unsigned char *) (const char *) ( emacs ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "t" ))[3] - __s2[3]); never executed: end of block never executed: end of block | 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 |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 600 | } never executed: end of block | 0 |
| 601 | else | - |
| 602 | in_emacs = emacs_term = 0;executed 2 times by 1 test: in_emacs = emacs_term = 0; | 2 |
| 603 | | - |
| 604 | | - |
| 605 | no_line_editing |= STREQ (term, "emacs"); never executed: __result = (((const unsigned char *) (const char *) ( term ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "emacs" ))[3] - __s2[3]); never executed: end of block never executed: end of block | 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 | 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-2 |
| 606 | no_line_editing |= in_emacs && STREQ (term, "dumb"); never executed: __result = (((const unsigned char *) (const char *) ( term ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "dumb" ))[3] - __s2[3]); never executed: end of block never executed: end of block | 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 | 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-2 |
| 607 | | - |
| 608 | | - |
| 609 | running_under_emacs = in_emacs || STREQN (term, "emacs", 5); never executed: __result = (((const unsigned char *) (const char *) ( term ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "emacs" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 2 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 | 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-2 |
| 610 | running_under_emacs += emacs_term && STREQN (term, "eterm", 5); never executed: __result = (((const unsigned char *) (const char *) ( term ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "eterm" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | never evaluated | | 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 | 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 | 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-2 |
| 611 | | - |
| 612 | if (running_under_emacs)| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| 0-2 |
| 613 | gnu_error_format = 1; never executed: gnu_error_format = 1; | 0 |
| 614 | }executed 2 times by 1 test: end of block | 2 |
| 615 | | - |
| 616 | top_level_arg_index = arg_index; | - |
| 617 | old_errexit_flag = exit_immediately_on_error; | - |
| 618 | | - |
| 619 | | - |
| 620 | | - |
| 621 | | - |
| 622 | code = setjmp_sigs (top_level); | - |
| 623 | if (code)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 624 | { | - |
| 625 | if (code == EXITPROG || code == ERREXIT)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 626 | exit_shell (last_command_exit_value); never executed: exit_shell (last_command_exit_value); | 0 |
| 627 | else | - |
| 628 | { | - |
| 629 | #if defined (JOB_CONTROL) | - |
| 630 | | - |
| 631 | set_job_control (interactive_shell); | - |
| 632 | #endif | - |
| 633 | | - |
| 634 | | - |
| 635 | exit_immediately_on_error += old_errexit_flag; | - |
| 636 | locally_skip_execution++; | - |
| 637 | } never executed: end of block | 0 |
| 638 | } | - |
| 639 | | - |
| 640 | arg_index = top_level_arg_index; | - |
| 641 | | - |
| 642 | | - |
| 643 | | - |
| 644 | if (interactive_shell == 0)| TRUE | evaluated 5445 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| 2-5445 |
| 645 | { | - |
| 646 | unbind_variable ("PS1"); | - |
| 647 | unbind_variable ("PS2"); | - |
| 648 | interactive = 0; | - |
| 649 | #if 0 | - |
| 650 | | - |
| 651 | expand_aliases = posixly_correct; | - |
| 652 | #endif | - |
| 653 | }executed 5445 times by 1 test: end of block | 5445 |
| 654 | else | - |
| 655 | { | - |
| 656 | change_flag ('i', FLAG_ON); | - |
| 657 | interactive = 1; | - |
| 658 | }executed 2 times by 1 test: end of block | 2 |
| 659 | | - |
| 660 | #if defined (RESTRICTED_SHELL) | - |
| 661 | | - |
| 662 | | - |
| 663 | | - |
| 664 | restricted_shell = shell_is_restricted (shell_name); | - |
| 665 | | - |
| 666 | | - |
| 667 | | - |
| 668 | saverst = restricted; | - |
| 669 | restricted = 0; | - |
| 670 | #endif | - |
| 671 | | - |
| 672 | | - |
| 673 | | - |
| 674 | | - |
| 675 | | - |
| 676 | if (wordexp_only)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| 0-5447 |
| 677 | ; never executed: ; | 0 |
| 678 | else if (command_execution_string)| TRUE | evaluated 177 times by 1 test | | FALSE | evaluated 5270 times by 1 test |
| 177-5270 |
| 679 | arg_index = bind_args (argv, arg_index, argc, 0); executed 177 times by 1 test: arg_index = bind_args (argv, arg_index, argc, 0); | 177 |
| 680 | else if (arg_index != argc && read_from_stdin == 0)| TRUE | evaluated 5265 times by 1 test | | FALSE | evaluated 5 times by 1 test |
| TRUE | evaluated 5265 times by 1 test | | FALSE | never evaluated |
| 0-5265 |
| 681 | { | - |
| 682 | shell_script_filename = argv[arg_index++]; | - |
| 683 | arg_index = bind_args (argv, arg_index, argc, 1); | - |
| 684 | }executed 5265 times by 1 test: end of block | 5265 |
| 685 | else | - |
| 686 | arg_index = bind_args (argv, arg_index, argc, 1); executed 5 times by 1 test: arg_index = bind_args (argv, arg_index, argc, 1); | 5 |
| 687 | | - |
| 688 | | - |
| 689 | if (locally_skip_execution == 0 && running_setuid == 0)| TRUE | evaluated 5447 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 5447 times by 1 test | | FALSE | never evaluated |
| 0-5447 |
| 690 | { | - |
| 691 | old_errexit_flag = exit_immediately_on_error; | - |
| 692 | exit_immediately_on_error = 0; | - |
| 693 | | - |
| 694 | run_startup_files (); | - |
| 695 | exit_immediately_on_error += old_errexit_flag; | - |
| 696 | }executed 5446 times by 1 test: end of block | 5446 |
| 697 | | - |
| 698 | | - |
| 699 | if (act_like_sh)| TRUE | evaluated 38 times by 1 test | | FALSE | evaluated 5408 times by 1 test |
| 38-5408 |
| 700 | { | - |
| 701 | bind_variable ("POSIXLY_CORRECT", "y", 0); | - |
| 702 | sv_strict_posix ("POSIXLY_CORRECT"); | - |
| 703 | }executed 38 times by 1 test: end of block | 38 |
| 704 | | - |
| 705 | #if defined (RESTRICTED_SHELL) | - |
| 706 | | - |
| 707 | | - |
| 708 | | - |
| 709 | restricted = saverst || restricted;| TRUE | never evaluated | | FALSE | evaluated 5446 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5446 times by 1 test |
| 0-5446 |
| 710 | if (shell_reinitialized == 0)| TRUE | evaluated 5431 times by 1 test | | FALSE | evaluated 15 times by 1 test |
| 15-5431 |
| 711 | maybe_make_restricted (shell_name);executed 5431 times by 1 test: maybe_make_restricted (shell_name); | 5431 |
| 712 | #endif /* RESTRICTED_SHELL */ | - |
| 713 | | - |
| 714 | #if defined (WORDEXP_OPTION) | - |
| 715 | if (wordexp_only) | - |
| 716 | { | - |
| 717 | startup_state = 3; | - |
| 718 | last_command_exit_value = run_wordexp (argv[top_level_arg_index]); | - |
| 719 | exit_shell (last_command_exit_value); | - |
| 720 | } | - |
| 721 | #endif | - |
| 722 | | - |
| 723 | cmd_init (); | - |
| 724 | uwp_init (); | - |
| 725 | | - |
| 726 | if (command_execution_string)| TRUE | evaluated 177 times by 1 test | | FALSE | evaluated 5269 times by 1 test |
| 177-5269 |
| 727 | { | - |
| 728 | startup_state = 2; | - |
| 729 | | - |
| 730 | if (debugging_mode)| TRUE | never evaluated | | FALSE | evaluated 177 times by 1 test |
| 0-177 |
| 731 | start_debugger (); never executed: start_debugger (); | 0 |
| 732 | | - |
| 733 | #if defined (ONESHOT) | - |
| 734 | executing = 1; | - |
| 735 | run_one_command (command_execution_string); | - |
| 736 | exit_shell (last_command_exit_value); | - |
| 737 | #else /* ONESHOT */ | - |
| 738 | with_input_from_string (command_execution_string, "-c"); | - |
| 739 | goto read_and_execute; | - |
| 740 | #endif /* !ONESHOT */ | - |
| 741 | } never executed: end of block | 0 |
| 742 | | - |
| 743 | | - |
| 744 | | - |
| 745 | if (shell_script_filename)| TRUE | evaluated 5264 times by 1 test | | FALSE | evaluated 5 times by 1 test |
| 5-5264 |
| 746 | open_shell_script (shell_script_filename);executed 5264 times by 1 test: open_shell_script (shell_script_filename); | 5264 |
| 747 | else if (interactive == 0)| TRUE | evaluated 5 times by 1 test | | FALSE | never evaluated |
| 0-5 |
| 748 | { | - |
| 749 | | - |
| 750 | | - |
| 751 | #if defined (BUFFERED_INPUT) | - |
| 752 | default_buffered_input = fileno (stdin); | - |
| 753 | #else | - |
| 754 | setbuf (default_input, (char *)NULL); | - |
| 755 | #endif /* !BUFFERED_INPUT */ | - |
| 756 | read_from_stdin = 1; | - |
| 757 | }executed 5 times by 1 test: end of block | 5 |
| 758 | else if (top_level_arg_index == argc) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 759 | | - |
| 760 | | - |
| 761 | read_from_stdin = 1; never executed: read_from_stdin = 1; | 0 |
| 762 | | - |
| 763 | set_bash_input (); | - |
| 764 | | - |
| 765 | if (debugging_mode && locally_skip_execution == 0 && running_setuid == 0 && (reading_shell_script || interactive_shell == 0))| TRUE | never evaluated | | FALSE | evaluated 5266 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 |
| 0-5266 |
| 766 | start_debugger (); never executed: start_debugger (); | 0 |
| 767 | | - |
| 768 | | - |
| 769 | if (interactive_shell)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5265 times by 1 test |
| 1-5265 |
| 770 | { | - |
| 771 | | - |
| 772 | reset_mail_timer (); | - |
| 773 | init_mail_dates (); | - |
| 774 | | - |
| 775 | #if defined (HISTORY) | - |
| 776 | | - |
| 777 | bash_initialize_history (); | - |
| 778 | | - |
| 779 | | - |
| 780 | | - |
| 781 | if (shell_initialized == 0 && history_lines_this_session == 0)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 782 | load_history ();executed 1 time by 1 test: load_history (); | 1 |
| 783 | #endif /* HISTORY */ | - |
| 784 | | - |
| 785 | | - |
| 786 | | - |
| 787 | get_tty_state (); | - |
| 788 | }executed 1 time by 1 test: end of block | 1 |
| 789 | | - |
| 790 | #if !defined (ONESHOT) | - |
| 791 | read_and_execute: | - |
| 792 | #endif /* !ONESHOT */ | - |
| 793 | | - |
| 794 | shell_initialized = 1; | - |
| 795 | | - |
| 796 | if (pretty_print_mode && interactive_shell)| TRUE | never evaluated | | FALSE | evaluated 5266 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5266 |
| 797 | { | - |
| 798 | internal_warning (_("pretty-printing mode ignored in interactive shells")); | - |
| 799 | pretty_print_mode = 0; | - |
| 800 | } never executed: end of block | 0 |
| 801 | if (pretty_print_mode)| TRUE | never evaluated | | FALSE | evaluated 5266 times by 1 test |
| 0-5266 |
| 802 | exit_shell (pretty_print_loop ()); never executed: exit_shell (pretty_print_loop ()); | 0 |
| 803 | | - |
| 804 | | - |
| 805 | reader_loop (); | - |
| 806 | exit_shell (last_command_exit_value); | - |
| 807 | } never executed: end of block | 0 |
| 808 | | - |
| 809 | static int | - |
| 810 | parse_long_options (argv, arg_start, arg_end) | - |
| 811 | char **argv; | - |
| 812 | int arg_start, arg_end; | - |
| 813 | { | - |
| 814 | int arg_index, longarg, i; | - |
| 815 | char *arg_string; | - |
| 816 | | - |
| 817 | arg_index = arg_start; | - |
| 818 | while ((arg_index != arg_end) && (arg_string = argv[arg_index]) &&| TRUE | evaluated 5443 times by 1 test | | FALSE | evaluated 4 times by 1 test |
| TRUE | evaluated 5443 times by 1 test | | FALSE | never evaluated |
| 0-5443 |
| 819 | (*arg_string == '-'))| TRUE | evaluated 185 times by 1 test | | FALSE | evaluated 5258 times by 1 test |
| 185-5258 |
| 820 | { | - |
| 821 | longarg = 0; | - |
| 822 | | - |
| 823 | | - |
| 824 | if (arg_string[1] == '-' && arg_string[2])| TRUE | never evaluated | | FALSE | evaluated 185 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-185 |
| 825 | { | - |
| 826 | longarg = 1; | - |
| 827 | arg_string++; | - |
| 828 | } never executed: end of block | 0 |
| 829 | | - |
| 830 | for (i = 0; long_args[i].name; i++)| TRUE | evaluated 2960 times by 1 test | | FALSE | evaluated 185 times by 1 test |
| 185-2960 |
| 831 | { | - |
| 832 | if (STREQ (arg_string + 1, long_args[i].name)) never executed: __result = (((const unsigned char *) (const char *) ( arg_string + 1 ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( long_args[i].name ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 2958 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 | 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-2958 |
| 833 | { | - |
| 834 | if (long_args[i].type == Int)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 835 | *long_args[i].int_value = 1; never executed: *long_args[i].int_value = 1; | 0 |
| 836 | else if (argv[++arg_index] == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 837 | { | - |
| 838 | report_error (_("%s: option requires an argument"), long_args[i].name); | - |
| 839 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 840 | } | - |
| 841 | else | - |
| 842 | *long_args[i].char_value = argv[arg_index]; never executed: *long_args[i].char_value = argv[arg_index]; | 0 |
| 843 | | - |
| 844 | break; never executed: break; | 0 |
| 845 | } | - |
| 846 | }executed 2960 times by 1 test: end of block | 2960 |
| 847 | if (long_args[i].name == 0)| TRUE | evaluated 185 times by 1 test | | FALSE | never evaluated |
| 0-185 |
| 848 | { | - |
| 849 | if (longarg)| TRUE | never evaluated | | FALSE | evaluated 185 times by 1 test |
| 0-185 |
| 850 | { | - |
| 851 | report_error (_("%s: invalid option"), argv[arg_index]); | - |
| 852 | show_shell_usage (stderr, 0); | - |
| 853 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 854 | } | - |
| 855 | break; executed 185 times by 1 test: break; | 185 |
| 856 | } | - |
| 857 | | - |
| 858 | arg_index++; | - |
| 859 | } never executed: end of block | 0 |
| 860 | | - |
| 861 | return (arg_index);executed 5447 times by 1 test: return (arg_index); | 5447 |
| 862 | } | - |
| 863 | | - |
| 864 | static int | - |
| 865 | parse_shell_options (argv, arg_start, arg_end) | - |
| 866 | char **argv; | - |
| 867 | int arg_start, arg_end; | - |
| 868 | { | - |
| 869 | int arg_index; | - |
| 870 | int arg_character, on_or_off, next_arg, i; | - |
| 871 | char *o_option, *arg_string; | - |
| 872 | | - |
| 873 | arg_index = arg_start; | - |
| 874 | while (arg_index != arg_end && (arg_string = argv[arg_index]) &&| TRUE | evaluated 5639 times by 1 test | | FALSE | evaluated 5 times by 1 test |
| TRUE | evaluated 5639 times by 1 test | | FALSE | never evaluated |
| 0-5639 |
| 875 | (*arg_string == '-' || *arg_string == '+'))| TRUE | evaluated 197 times by 1 test | | FALSE | evaluated 5442 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5442 times by 1 test |
| 0-5442 |
| 876 | { | - |
| 877 | | - |
| 878 | next_arg = arg_index + 1; | - |
| 879 | | - |
| 880 | | - |
| 881 | | - |
| 882 | | - |
| 883 | if (arg_string[0] == '-' &&| TRUE | evaluated 197 times by 1 test | | FALSE | never evaluated |
| 0-197 |
| 884 | (arg_string[1] == '\0' ||| TRUE | never evaluated | | FALSE | evaluated 197 times by 1 test |
| 0-197 |
| 885 | (arg_string[1] == '-' && arg_string[2] == '\0')))| TRUE | never evaluated | | FALSE | evaluated 197 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-197 |
| 886 | return (next_arg); never executed: return (next_arg); | 0 |
| 887 | | - |
| 888 | i = 1; | - |
| 889 | on_or_off = arg_string[0]; | - |
| 890 | while (arg_character = arg_string[i++])| TRUE | evaluated 276 times by 1 test | | FALSE | evaluated 197 times by 1 test |
| 197-276 |
| 891 | { | - |
| 892 | switch (arg_character) | - |
| 893 | { | - |
| 894 | case 'c':executed 177 times by 1 test: case 'c': | 177 |
| 895 | want_pending_command = 1; | - |
| 896 | break;executed 177 times by 1 test: break; | 177 |
| 897 | | - |
| 898 | case 'l': never executed: case 'l': | 0 |
| 899 | make_login_shell = 1; | - |
| 900 | break; never executed: break; | 0 |
| 901 | | - |
| 902 | case 's': never executed: case 's': | 0 |
| 903 | read_from_stdin = 1; | - |
| 904 | break; never executed: break; | 0 |
| 905 | | - |
| 906 | case 'o':executed 17 times by 1 test: case 'o': | 17 |
| 907 | o_option = argv[next_arg]; | - |
| 908 | if (o_option == 0)| TRUE | never evaluated | | FALSE | evaluated 17 times by 1 test |
| 0-17 |
| 909 | { | - |
| 910 | list_minus_o_opts (-1, (on_or_off == '-') ? 0 : 1); | - |
| 911 | break; never executed: break; | 0 |
| 912 | } | - |
| 913 | if (set_minus_o_option (on_or_off, o_option) != EXECUTION_SUCCESS)| TRUE | never evaluated | | FALSE | evaluated 17 times by 1 test |
| 0-17 |
| 914 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 915 | next_arg++; | - |
| 916 | break;executed 17 times by 1 test: break; | 17 |
| 917 | | - |
| 918 | case 'O': never executed: case 'O': | 0 |
| 919 | | - |
| 920 | | - |
| 921 | | - |
| 922 | | - |
| 923 | o_option = argv[next_arg]; | - |
| 924 | if (o_option == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 925 | { | - |
| 926 | shopt_listopt (o_option, (on_or_off == '-') ? 0 : 1); | - |
| 927 | break; never executed: break; | 0 |
| 928 | } | - |
| 929 | add_shopt_to_alist (o_option, on_or_off); | - |
| 930 | next_arg++; | - |
| 931 | break; never executed: break; | 0 |
| 932 | | - |
| 933 | case 'D': never executed: case 'D': | 0 |
| 934 | dump_translatable_strings = 1; | - |
| 935 | break; never executed: break; | 0 |
| 936 | | - |
| 937 | default:executed 82 times by 1 test: default: | 82 |
| 938 | if (change_flag (arg_character, on_or_off) == FLAG_ERROR)| TRUE | never evaluated | | FALSE | evaluated 82 times by 1 test |
| 0-82 |
| 939 | { | - |
| 940 | report_error (_("%c%c: invalid option"), on_or_off, arg_character); | - |
| 941 | show_shell_usage (stderr, 0); | - |
| 942 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 943 | } | - |
| 944 | }executed 82 times by 1 test: end of block | 82 |
| 945 | } | - |
| 946 | | - |
| 947 | | - |
| 948 | arg_index = next_arg; | - |
| 949 | }executed 197 times by 1 test: end of block | 197 |
| 950 | | - |
| 951 | return (arg_index);executed 5447 times by 1 test: return (arg_index); | 5447 |
| 952 | } | - |
| 953 | | - |
| 954 | | - |
| 955 | void | - |
| 956 | exit_shell (s) | - |
| 957 | int s; | - |
| 958 | { | - |
| 959 | fflush (stdout); | - |
| 960 | fflush (stderr); | - |
| 961 | | - |
| 962 | | - |
| 963 | #if defined (READLINE) | - |
| 964 | if (RL_ISSTATE (RL_STATE_TERMPREPPED) && rl_deprep_term_function)| TRUE | never evaluated | | FALSE | evaluated 550 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-550 |
| 965 | (*rl_deprep_term_function) (); never executed: (*rl_deprep_term_function) (); | 0 |
| 966 | #endif | - |
| 967 | if (read_tty_modified ())| TRUE | never evaluated | | FALSE | evaluated 550 times by 1 test |
| 0-550 |
| 968 | read_tty_cleanup (); never executed: read_tty_cleanup (); | 0 |
| 969 | | - |
| 970 | | - |
| 971 | | - |
| 972 | if (signal_is_trapped (0))| TRUE | evaluated 13 times by 1 test | | FALSE | evaluated 537 times by 1 test |
| 13-537 |
| 973 | s = run_exit_trap ();executed 13 times by 1 test: s = run_exit_trap (); | 13 |
| 974 | | - |
| 975 | #if defined (PROCESS_SUBSTITUTION) | - |
| 976 | unlink_fifo_list (); | - |
| 977 | #endif /* PROCESS_SUBSTITUTION */ | - |
| 978 | | - |
| 979 | #if defined (HISTORY) | - |
| 980 | if (remember_on_history)| TRUE | evaluated 9 times by 1 test | | FALSE | evaluated 541 times by 1 test |
| 9-541 |
| 981 | maybe_save_shell_history ();executed 9 times by 1 test: maybe_save_shell_history (); | 9 |
| 982 | #endif /* HISTORY */ | - |
| 983 | | - |
| 984 | #if defined (COPROCESS_SUPPORT) | - |
| 985 | coproc_flush (); | - |
| 986 | #endif | - |
| 987 | | - |
| 988 | #if defined (JOB_CONTROL) | - |
| 989 | | - |
| 990 | | - |
| 991 | if (interactive_shell && login_shell && hup_on_exit)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 549 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-549 |
| 992 | hangup_all_jobs (); never executed: hangup_all_jobs (); | 0 |
| 993 | | - |
| 994 | | - |
| 995 | | - |
| 996 | | - |
| 997 | | - |
| 998 | | - |
| 999 | | - |
| 1000 | if (subshell_environment == 0)| TRUE | evaluated 546 times by 1 test | | FALSE | evaluated 4 times by 1 test |
| 4-546 |
| 1001 | end_job_control ();executed 546 times by 1 test: end_job_control (); | 546 |
| 1002 | #endif /* JOB_CONTROL */ | - |
| 1003 | | - |
| 1004 | | - |
| 1005 | sh_exit (s); | - |
| 1006 | } never executed: end of block | 0 |
| 1007 | | - |
| 1008 | | - |
| 1009 | | - |
| 1010 | void | - |
| 1011 | sh_exit (s) | - |
| 1012 | int s; | - |
| 1013 | { | - |
| 1014 | #if defined (MALLOC_DEBUG) && defined (USING_BASH_MALLOC) | - |
| 1015 | if (malloc_trace_at_exit)| TRUE | never evaluated | | FALSE | evaluated 2652 times by 1 test |
| 0-2652 |
| 1016 | trace_malloc_stats (get_name_for_error (), (char *)NULL); never executed: trace_malloc_stats (get_name_for_error (), (char *) ((void *)0) ); | 0 |
| 1017 | | - |
| 1018 | #endif | - |
| 1019 | | - |
| 1020 | exit (s);executed 2652 times by 1 test: exit (s); | 2652 |
| 1021 | } | - |
| 1022 | | - |
| 1023 | | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | void | - |
| 1027 | subshell_exit (s) | - |
| 1028 | int s; | - |
| 1029 | { | - |
| 1030 | fflush (stdout); | - |
| 1031 | fflush (stderr); | - |
| 1032 | | - |
| 1033 | | - |
| 1034 | | - |
| 1035 | if (signal_is_trapped (0))| TRUE | evaluated 7 times by 1 test | | FALSE | evaluated 39 times by 1 test |
| 7-39 |
| 1036 | s = run_exit_trap ();executed 7 times by 1 test: s = run_exit_trap (); | 7 |
| 1037 | | - |
| 1038 | sh_exit (s); | - |
| 1039 | } never executed: end of block | 0 |
| 1040 | | - |
| 1041 | | - |
| 1042 | | - |
| 1043 | | - |
| 1044 | | - |
| 1045 | | - |
| 1046 | | - |
| 1047 | | - |
| 1048 | | - |
| 1049 | | - |
| 1050 | | - |
| 1051 | | - |
| 1052 | | - |
| 1053 | | - |
| 1054 | | - |
| 1055 | | - |
| 1056 | | - |
| 1057 | | - |
| 1058 | | - |
| 1059 | | - |
| 1060 | | - |
| 1061 | | - |
| 1062 | | - |
| 1063 | | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | static void | - |
| 1069 | execute_env_file (env_file) | - |
| 1070 | char *env_file; | - |
| 1071 | { | - |
| 1072 | char *fn; | - |
| 1073 | | - |
| 1074 | if (env_file && *env_file)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5389 times by 1 test |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-5389 |
| 1075 | { | - |
| 1076 | fn = expand_string_unsplit_to_string (env_file, Q_DOUBLE_QUOTES); | - |
| 1077 | if (fn && *fn)| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 1078 | maybe_execute_file (fn, 1);executed 1 time by 1 test: maybe_execute_file (fn, 1); | 1 |
| 1079 | FREE (fn);executed 1 time by 1 test: sh_xfree((fn), "shell.c", 1079); | TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 1080 | }executed 1 time by 1 test: end of block | 1 |
| 1081 | }executed 5390 times by 1 test: end of block | 5390 |
| 1082 | | - |
| 1083 | static void | - |
| 1084 | run_startup_files () | - |
| 1085 | { | - |
| 1086 | #if defined (JOB_CONTROL) | - |
| 1087 | int old_job_control; | - |
| 1088 | #endif | - |
| 1089 | int sourced_login, run_by_ssh; | - |
| 1090 | | - |
| 1091 | | - |
| 1092 | if (interactive_shell == 0 && no_rc == 0 && login_shell == 0 &&| TRUE | evaluated 5445 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| TRUE | evaluated 5430 times by 1 test | | FALSE | evaluated 15 times by 1 test |
| TRUE | evaluated 5429 times by 1 test | | FALSE | evaluated 1 time by 1 test |
| 1-5445 |
| 1093 | act_like_sh == 0 && command_execution_string)| TRUE | evaluated 5391 times by 1 test | | FALSE | evaluated 38 times by 1 test |
| TRUE | evaluated 138 times by 1 test | | FALSE | evaluated 5253 times by 1 test |
| 38-5391 |
| 1094 | { | - |
| 1095 | #ifdef SSH_SOURCE_BASHRC | - |
| 1096 | run_by_ssh = (find_variable ("SSH_CLIENT") != (SHELL_VAR *)0) || | - |
| 1097 | (find_variable ("SSH2_CLIENT") != (SHELL_VAR *)0); | - |
| 1098 | #else | - |
| 1099 | run_by_ssh = 0; | - |
| 1100 | #endif | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | | - |
| 1104 | if ((run_by_ssh || isnetconn (fileno (stdin))) && shell_level < 2)| TRUE | never evaluated | | FALSE | evaluated 138 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 138 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-138 |
| 1105 | { | - |
| 1106 | #ifdef SYS_BASHRC | - |
| 1107 | # if defined (__OPENNT) | - |
| 1108 | maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1); | - |
| 1109 | # else | - |
| 1110 | maybe_execute_file (SYS_BASHRC, 1); | - |
| 1111 | # endif | - |
| 1112 | #endif | - |
| 1113 | maybe_execute_file (bashrc_file, 1); | - |
| 1114 | return; never executed: return; | 0 |
| 1115 | } | - |
| 1116 | }executed 138 times by 1 test: end of block | 138 |
| 1117 | | - |
| 1118 | #if defined (JOB_CONTROL) | - |
| 1119 | | - |
| 1120 | old_job_control = interactive_shell ? set_job_control (0) : 0;| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
| 1121 | #endif | - |
| 1122 | | - |
| 1123 | sourced_login = 0; | - |
| 1124 | | - |
| 1125 | | - |
| 1126 | | - |
| 1127 | | - |
| 1128 | | - |
| 1129 | #if defined (NON_INTERACTIVE_LOGIN_SHELLS) | - |
| 1130 | if (login_shell && posixly_correct == 0) | - |
| 1131 | #else | - |
| 1132 | if (login_shell < 0 && posixly_correct == 0)| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5447 |
| 1133 | #endif | - |
| 1134 | { | - |
| 1135 | | - |
| 1136 | no_rc++; | - |
| 1137 | | - |
| 1138 | | - |
| 1139 | | - |
| 1140 | if (no_profile == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1141 | { | - |
| 1142 | maybe_execute_file (SYS_PROFILE, 1); | - |
| 1143 | | - |
| 1144 | if (act_like_sh) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1145 | maybe_execute_file ("~/.profile", 1); never executed: maybe_execute_file ("~/.profile", 1); | 0 |
| 1146 | else if ((maybe_execute_file ("~/.bash_profile", 1) == 0) &&| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1147 | (maybe_execute_file ("~/.bash_login", 1) == 0)) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1148 | maybe_execute_file ("~/.profile", 1); never executed: maybe_execute_file ("~/.profile", 1); | 0 |
| 1149 | } never executed: end of block | 0 |
| 1150 | | - |
| 1151 | sourced_login = 1; | - |
| 1152 | } never executed: end of block | 0 |
| 1153 | | - |
| 1154 | | - |
| 1155 | | - |
| 1156 | | - |
| 1157 | | - |
| 1158 | if (interactive_shell == 0 && !(su_shell && login_shell))| TRUE | evaluated 5445 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5445 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5445 |
| 1159 | { | - |
| 1160 | if (posixly_correct == 0 && act_like_sh == 0 && privileged_mode == 0 &&| TRUE | evaluated 5428 times by 1 test | | FALSE | evaluated 17 times by 1 test |
| TRUE | evaluated 5390 times by 1 test | | FALSE | evaluated 38 times by 1 test |
| TRUE | evaluated 5390 times by 1 test | | FALSE | never evaluated |
| 0-5428 |
| 1161 | sourced_env++ == 0)| TRUE | evaluated 5390 times by 1 test | | FALSE | never evaluated |
| 0-5390 |
| 1162 | execute_env_file (get_string_value ("BASH_ENV"));executed 5390 times by 1 test: execute_env_file (get_string_value ("BASH_ENV")); | 5390 |
| 1163 | return;executed 5445 times by 1 test: return; | 5445 |
| 1164 | } | - |
| 1165 | | - |
| 1166 | | - |
| 1167 | if (posixly_correct == 0) | TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 1168 | { | - |
| 1169 | if (login_shell && sourced_login++ == 0)| TRUE | never evaluated | | FALSE | evaluated 2 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-2 |
| 1170 | { | - |
| 1171 | | - |
| 1172 | no_rc++; | - |
| 1173 | | - |
| 1174 | | - |
| 1175 | | - |
| 1176 | if (no_profile == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1177 | { | - |
| 1178 | maybe_execute_file (SYS_PROFILE, 1); | - |
| 1179 | | - |
| 1180 | if (act_like_sh) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1181 | maybe_execute_file ("~/.profile", 1); never executed: maybe_execute_file ("~/.profile", 1); | 0 |
| 1182 | else if ((maybe_execute_file ("~/.bash_profile", 1) == 0) &&| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1183 | (maybe_execute_file ("~/.bash_login", 1) == 0)) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1184 | maybe_execute_file ("~/.profile", 1); never executed: maybe_execute_file ("~/.profile", 1); | 0 |
| 1185 | } never executed: end of block | 0 |
| 1186 | } never executed: end of block | 0 |
| 1187 | | - |
| 1188 | | - |
| 1189 | if (act_like_sh == 0 && no_rc == 0)| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 2 times by 1 test | | FALSE | never evaluated |
| 0-2 |
| 1190 | { | - |
| 1191 | #ifdef SYS_BASHRC | - |
| 1192 | # if defined (__OPENNT) | - |
| 1193 | maybe_execute_file (_prefixInstallPath(SYS_BASHRC, NULL, 0), 1); | - |
| 1194 | # else | - |
| 1195 | maybe_execute_file (SYS_BASHRC, 1); | - |
| 1196 | # endif | - |
| 1197 | #endif | - |
| 1198 | maybe_execute_file (bashrc_file, 1); | - |
| 1199 | }executed 1 time by 1 test: end of block | 1 |
| 1200 | | - |
| 1201 | else if (act_like_sh && privileged_mode == 0 && sourced_env++ == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1202 | execute_env_file (get_string_value ("ENV")); never executed: execute_env_file (get_string_value ("ENV")); | 0 |
| 1203 | }executed 1 time by 1 test: end of block | 1 |
| 1204 | else | - |
| 1205 | { | - |
| 1206 | | - |
| 1207 | if (interactive_shell && privileged_mode == 0 && sourced_env++ == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1208 | execute_env_file (get_string_value ("ENV")); never executed: execute_env_file (get_string_value ("ENV")); | 0 |
| 1209 | } never executed: end of block | 0 |
| 1210 | | - |
| 1211 | #if defined (JOB_CONTROL) | - |
| 1212 | set_job_control (old_job_control); | - |
| 1213 | #endif | - |
| 1214 | }executed 1 time by 1 test: end of block | 1 |
| 1215 | | - |
| 1216 | #if defined (RESTRICTED_SHELL) | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | | - |
| 1220 | int | - |
| 1221 | shell_is_restricted (name) | - |
| 1222 | char *name; | - |
| 1223 | { | - |
| 1224 | char *temp; | - |
| 1225 | | - |
| 1226 | if (restricted)| TRUE | never evaluated | | FALSE | evaluated 10894 times by 1 test |
| 0-10894 |
| 1227 | return 1; never executed: return 1; | 0 |
| 1228 | temp = base_pathname (name); | - |
| 1229 | if (*temp == '-')| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 10892 times by 1 test |
| 2-10892 |
| 1230 | temp++;executed 2 times by 1 test: temp++; | 2 |
| 1231 | return (STREQ (temp, RESTRICTED_SHELL_NAME));executed 10894 times by 1 test: return (((temp)[0] == ("rbash")[0] && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( temp ) && __builtin_constant_p ( "rbash" ) && (__s1_len = __builtin_strlen ( temp ), __s2_len = __builtin_strlen ( "rbash" ), (!((size_t)(const void ...(((const unsigned char *) (const char *) ( "rbash" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( "rbash" ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( temp , "rbash" )))); }) == 0)); never executed: __result = (((const unsigned char *) (const char *) ( temp ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "rbash" ))[3] - __s2[3]); never executed: end of block never executed: end of block | 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-10894 |
| 1232 | } | - |
| 1233 | | - |
| 1234 | | - |
| 1235 | | - |
| 1236 | | - |
| 1237 | | - |
| 1238 | | - |
| 1239 | | - |
| 1240 | | - |
| 1241 | int | - |
| 1242 | maybe_make_restricted (name) | - |
| 1243 | char *name; | - |
| 1244 | { | - |
| 1245 | char *temp; | - |
| 1246 | | - |
| 1247 | temp = base_pathname (name); | - |
| 1248 | if (*temp == '-')| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5431 times by 1 test |
| 1-5431 |
| 1249 | temp++;executed 1 time by 1 test: temp++; | 1 |
| 1250 | if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME))) never executed: __result = (((const unsigned char *) (const char *) ( temp ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "rbash" ))[3] - __s2[3]); never executed: end of block never executed: end of block | TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5431 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5431 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-5431 |
| 1251 | { | - |
| 1252 | #if defined (RBASH_STATIC_PATH_VALUE) | - |
| 1253 | bind_variable ("PATH", RBASH_STATIC_PATH_VALUE, 0); | - |
| 1254 | stupidly_hack_special_variables ("PATH"); | - |
| 1255 | #endif | - |
| 1256 | set_var_read_only ("PATH"); | - |
| 1257 | set_var_read_only ("SHELL"); | - |
| 1258 | set_var_read_only ("ENV"); | - |
| 1259 | set_var_read_only ("BASH_ENV"); | - |
| 1260 | restricted = 1; | - |
| 1261 | }executed 1 time by 1 test: end of block | 1 |
| 1262 | return (restricted);executed 5432 times by 1 test: return (restricted); | 5432 |
| 1263 | } | - |
| 1264 | #endif /* RESTRICTED_SHELL */ | - |
| 1265 | | - |
| 1266 | | - |
| 1267 | | - |
| 1268 | static int | - |
| 1269 | uidget () | - |
| 1270 | { | - |
| 1271 | uid_t u; | - |
| 1272 | | - |
| 1273 | u = getuid (); | - |
| 1274 | if (current_user.uid != u)| TRUE | evaluated 5432 times by 1 test | | FALSE | never evaluated |
| 0-5432 |
| 1275 | { | - |
| 1276 | FREE (current_user.user_name); never executed: sh_xfree((current_user.user_name), "shell.c", 1276); | TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 1277 | FREE (current_user.shell); never executed: sh_xfree((current_user.shell), "shell.c", 1277); | TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 1278 | FREE (current_user.home_dir); never executed: sh_xfree((current_user.home_dir), "shell.c", 1278); | TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 1279 | current_user.user_name = current_user.shell = current_user.home_dir = (char *)NULL; | - |
| 1280 | }executed 5432 times by 1 test: end of block | 5432 |
| 1281 | current_user.uid = u; | - |
| 1282 | current_user.gid = getgid (); | - |
| 1283 | current_user.euid = geteuid (); | - |
| 1284 | current_user.egid = getegid (); | - |
| 1285 | | - |
| 1286 | | - |
| 1287 | return (current_user.uid != current_user.euid) ||executed 5432 times by 1 test: return (current_user.uid != current_user.euid) || (current_user.gid != current_user.egid); | 5432 |
| 1288 | (current_user.gid != current_user.egid);executed 5432 times by 1 test: return (current_user.uid != current_user.euid) || (current_user.gid != current_user.egid); | 5432 |
| 1289 | } | - |
| 1290 | | - |
| 1291 | void | - |
| 1292 | disable_priv_mode () | - |
| 1293 | { | - |
| 1294 | int e; | - |
| 1295 | | - |
| 1296 | if (setuid (current_user.uid) < 0)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 1297 | { | - |
| 1298 | e = errno; | - |
| 1299 | sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid); | - |
| 1300 | #if defined (EXIT_ON_SETUID_FAILURE) | - |
| 1301 | if (e == EAGAIN) | - |
| 1302 | exit (e); | - |
| 1303 | #endif | - |
| 1304 | } never executed: end of block | 0 |
| 1305 | if (setgid (current_user.gid) < 0)| TRUE | never evaluated | | FALSE | evaluated 10 times by 1 test |
| 0-10 |
| 1306 | sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid); never executed: sys_error ( dcgettext (((void *)0), "cannot set gid to %d: effective gid %d" , 5) , current_user.gid, current_user.egid); | 0 |
| 1307 | | - |
| 1308 | current_user.euid = current_user.uid; | - |
| 1309 | current_user.egid = current_user.gid; | - |
| 1310 | }executed 10 times by 1 test: end of block | 10 |
| 1311 | | - |
| 1312 | #if defined (WORDEXP_OPTION) | - |
| 1313 | static int | - |
| 1314 | run_wordexp (words) | - |
| 1315 | char *words; | - |
| 1316 | { | - |
| 1317 | int code, nw, nb; | - |
| 1318 | WORD_LIST *wl, *tl, *result; | - |
| 1319 | | - |
| 1320 | code = setjmp_nosigs (top_level); | - |
| 1321 | | - |
| 1322 | if (code != NOT_JUMPED) | - |
| 1323 | { | - |
| 1324 | switch (code) | - |
| 1325 | { | - |
| 1326 | | - |
| 1327 | case FORCE_EOF: | - |
| 1328 | return last_command_exit_value = 127; | - |
| 1329 | case ERREXIT: | - |
| 1330 | case EXITPROG: | - |
| 1331 | return last_command_exit_value; | - |
| 1332 | case DISCARD: | - |
| 1333 | return last_command_exit_value = 1; | - |
| 1334 | default: | - |
| 1335 | command_error ("run_wordexp", CMDERR_BADJUMP, code, 0); | - |
| 1336 | } | - |
| 1337 | } | - |
| 1338 | | - |
| 1339 | | - |
| 1340 | if (words && *words) | - |
| 1341 | { | - |
| 1342 | with_input_from_string (words, "--wordexp"); | - |
| 1343 | if (parse_command () != 0) | - |
| 1344 | return (126); | - |
| 1345 | if (global_command == 0) | - |
| 1346 | { | - |
| 1347 | printf ("0\n0\n"); | - |
| 1348 | return (0); | - |
| 1349 | } | - |
| 1350 | if (global_command->type != cm_simple) | - |
| 1351 | return (126); | - |
| 1352 | wl = global_command->value.Simple->words; | - |
| 1353 | if (protected_mode) | - |
| 1354 | for (tl = wl; tl; tl = tl->next) | - |
| 1355 | tl->word->flags |= W_NOCOMSUB|W_NOPROCSUB; | - |
| 1356 | result = wl ? expand_words_no_vars (wl) : (WORD_LIST *)0; | - |
| 1357 | } | - |
| 1358 | else | - |
| 1359 | result = (WORD_LIST *)0; | - |
| 1360 | | - |
| 1361 | last_command_exit_value = 0; | - |
| 1362 | | - |
| 1363 | if (result == 0) | - |
| 1364 | { | - |
| 1365 | printf ("0\n0\n"); | - |
| 1366 | return (0); | - |
| 1367 | } | - |
| 1368 | | - |
| 1369 | | - |
| 1370 | | - |
| 1371 | for (nw = nb = 0, wl = result; wl; wl = wl->next) | - |
| 1372 | { | - |
| 1373 | nw++; | - |
| 1374 | nb += strlen (wl->word->word); | - |
| 1375 | } | - |
| 1376 | printf ("%u\n%u\n", nw, nb); | - |
| 1377 | | - |
| 1378 | | - |
| 1379 | for (wl = result; wl; wl = wl->next) | - |
| 1380 | printf ("%s\n", wl->word->word); | - |
| 1381 | | - |
| 1382 | return (0); | - |
| 1383 | } | - |
| 1384 | #endif | - |
| 1385 | | - |
| 1386 | #if defined (ONESHOT) | - |
| 1387 | | - |
| 1388 | | - |
| 1389 | static int | - |
| 1390 | run_one_command (command) | - |
| 1391 | char *command; | - |
| 1392 | { | - |
| 1393 | int code; | - |
| 1394 | | - |
| 1395 | code = setjmp_nosigs (top_level); | - |
| 1396 | | - |
| 1397 | if (code != NOT_JUMPED)| TRUE | evaluated 51 times by 1 test | | FALSE | evaluated 177 times by 1 test |
| 51-177 |
| 1398 | { | - |
| 1399 | #if defined (PROCESS_SUBSTITUTION) | - |
| 1400 | unlink_fifo_list (); | - |
| 1401 | #endif /* PROCESS_SUBSTITUTION */ | - |
| 1402 | switch (code) | - |
| 1403 | { | - |
| 1404 | | - |
| 1405 | case FORCE_EOF:executed 38 times by 1 test: case 1: | 38 |
| 1406 | return last_command_exit_value = 127;executed 38 times by 1 test: return last_command_exit_value = 127; | 38 |
| 1407 | case ERREXIT:executed 12 times by 1 test: case 4: | 12 |
| 1408 | case EXITPROG:executed 1 time by 1 test: case 3: | 1 |
| 1409 | return last_command_exit_value;executed 13 times by 1 test: return last_command_exit_value; | 13 |
| 1410 | case DISCARD: never executed: case 2: | 0 |
| 1411 | return last_command_exit_value = 1; never executed: return last_command_exit_value = 1; | 0 |
| 1412 | default: never executed: default: | 0 |
| 1413 | command_error ("run_one_command", CMDERR_BADJUMP, code, 0); | - |
| 1414 | } never executed: end of block | 0 |
| 1415 | } | - |
| 1416 | return (parse_and_execute (savestring (command), "-c", SEVAL_NOHIST));executed 177 times by 1 test: return (parse_and_execute ((char *)strcpy (sh_xmalloc((1 + strlen (command)), "shell.c", 1416), (command)), "-c", 0x004)); | 177 |
| 1417 | } | - |
| 1418 | #endif /* ONESHOT */ | - |
| 1419 | | - |
| 1420 | static int | - |
| 1421 | bind_args (argv, arg_start, arg_end, start_index) | - |
| 1422 | char **argv; | - |
| 1423 | int arg_start, arg_end, start_index; | - |
| 1424 | { | - |
| 1425 | register int i; | - |
| 1426 | WORD_LIST *args, *tl; | - |
| 1427 | | - |
| 1428 | for (i = arg_start, args = tl = (WORD_LIST *)NULL; i < arg_end; i++)| TRUE | evaluated 152 times by 1 test | | FALSE | evaluated 5447 times by 1 test |
| 152-5447 |
| 1429 | { | - |
| 1430 | if (args == 0)| TRUE | evaluated 76 times by 1 test | | FALSE | evaluated 76 times by 1 test |
| 76 |
| 1431 | args = tl = make_word_list (make_word (argv[i]), args);executed 76 times by 1 test: args = tl = make_word_list (make_word (argv[i]), args); | 76 |
| 1432 | else | - |
| 1433 | { | - |
| 1434 | tl->next = make_word_list (make_word (argv[i]), (WORD_LIST *)NULL); | - |
| 1435 | tl = tl->next; | - |
| 1436 | }executed 76 times by 1 test: end of block | 76 |
| 1437 | } | - |
| 1438 | | - |
| 1439 | if (args)| TRUE | evaluated 76 times by 1 test | | FALSE | evaluated 5371 times by 1 test |
| 76-5371 |
| 1440 | { | - |
| 1441 | if (start_index == 0) | TRUE | evaluated 30 times by 1 test | | FALSE | evaluated 46 times by 1 test |
| 30-46 |
| 1442 | { | - |
| 1443 | | - |
| 1444 | | - |
| 1445 | shell_name = savestring (args->word->word); | - |
| 1446 | FREE (dollar_vars[0]);executed 30 times by 1 test: sh_xfree((dollar_vars[0]), "shell.c", 1446); | TRUE | evaluated 30 times by 1 test | | FALSE | never evaluated |
| 0-30 |
| 1447 | dollar_vars[0] = savestring (args->word->word); | - |
| 1448 | remember_args (args->next, 1); | - |
| 1449 | if (debugging_mode)| TRUE | never evaluated | | FALSE | evaluated 30 times by 1 test |
| 0-30 |
| 1450 | { | - |
| 1451 | push_args (args->next); | - |
| 1452 | bash_argv_initialized = 1; | - |
| 1453 | } never executed: end of block | 0 |
| 1454 | }executed 30 times by 1 test: end of block | 30 |
| 1455 | else | - |
| 1456 | { | - |
| 1457 | remember_args (args, 1); | - |
| 1458 | | - |
| 1459 | | - |
| 1460 | | - |
| 1461 | if (debugging_mode)| TRUE | never evaluated | | FALSE | evaluated 46 times by 1 test |
| 0-46 |
| 1462 | { | - |
| 1463 | push_args (args); | - |
| 1464 | bash_argv_initialized = 1; | - |
| 1465 | } never executed: end of block | 0 |
| 1466 | }executed 46 times by 1 test: end of block | 46 |
| 1467 | | - |
| 1468 | dispose_words (args); | - |
| 1469 | }executed 76 times by 1 test: end of block | 76 |
| 1470 | | - |
| 1471 | return (i);executed 5447 times by 1 test: return (i); | 5447 |
| 1472 | } | - |
| 1473 | | - |
| 1474 | void | - |
| 1475 | unbind_args () | - |
| 1476 | { | - |
| 1477 | remember_args ((WORD_LIST *)NULL, 1); | - |
| 1478 | pop_args (); | - |
| 1479 | }executed 15 times by 1 test: end of block | 15 |
| 1480 | | - |
| 1481 | static void | - |
| 1482 | start_debugger () | - |
| 1483 | { | - |
| 1484 | #if defined (DEBUGGER) && defined (DEBUGGER_START_FILE) | - |
| 1485 | int old_errexit; | - |
| 1486 | int r; | - |
| 1487 | | - |
| 1488 | old_errexit = exit_immediately_on_error; | - |
| 1489 | exit_immediately_on_error = 0; | - |
| 1490 | | - |
| 1491 | r = force_execute_file (DEBUGGER_START_FILE, 1); | - |
| 1492 | if (r < 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1493 | { | - |
| 1494 | internal_warning (_("cannot start debugger; debugging mode disabled")); | - |
| 1495 | debugging_mode = 0; | - |
| 1496 | } never executed: end of block | 0 |
| 1497 | error_trace_mode = function_trace_mode = debugging_mode; | - |
| 1498 | | - |
| 1499 | set_shellopts (); | - |
| 1500 | set_bashopts (); | - |
| 1501 | | - |
| 1502 | exit_immediately_on_error += old_errexit; | - |
| 1503 | #endif | - |
| 1504 | } never executed: end of block | 0 |
| 1505 | | - |
| 1506 | static int | - |
| 1507 | open_shell_script (script_name) | - |
| 1508 | char *script_name; | - |
| 1509 | { | - |
| 1510 | int fd, e, fd_is_tty; | - |
| 1511 | char *filename, *path_filename, *t; | - |
| 1512 | char sample[80]; | - |
| 1513 | int sample_len; | - |
| 1514 | struct stat sb; | - |
| 1515 | #if defined (ARRAY_VARS) | - |
| 1516 | SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; | - |
| 1517 | ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; | - |
| 1518 | #endif | - |
| 1519 | | - |
| 1520 | filename = savestring (script_name); | - |
| 1521 | | - |
| 1522 | fd = open (filename, O_RDONLY); | - |
| 1523 | if ((fd < 0) && (errno == ENOENT) && (absolute_program (filename) == 0))| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5263 times by 1 test |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-5263 |
| 1524 | { | - |
| 1525 | e = errno; | - |
| 1526 | | - |
| 1527 | | - |
| 1528 | path_filename = find_path_file (script_name); | - |
| 1529 | if (path_filename)| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
| 0-1 |
| 1530 | { | - |
| 1531 | free (filename); | - |
| 1532 | filename = path_filename; | - |
| 1533 | fd = open (filename, O_RDONLY); | - |
| 1534 | } never executed: end of block | 0 |
| 1535 | else | - |
| 1536 | errno = e;executed 1 time by 1 test: (*__errno_location ()) = e; | 1 |
| 1537 | } | - |
| 1538 | | - |
| 1539 | if (fd < 0)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5263 times by 1 test |
| 1-5263 |
| 1540 | { | - |
| 1541 | e = errno; | - |
| 1542 | file_error (filename); | - |
| 1543 | #if defined (JOB_CONTROL) | - |
| 1544 | end_job_control (); | - |
| 1545 | #endif | - |
| 1546 | sh_exit ((e == ENOENT) ? EX_NOTFOUND : EX_NOINPUT); | - |
| 1547 | } never executed: end of block | 0 |
| 1548 | | - |
| 1549 | free (dollar_vars[0]); | - |
| 1550 | dollar_vars[0] = exec_argv0 ? savestring (exec_argv0) : savestring (script_name);| TRUE | never evaluated | | FALSE | evaluated 5263 times by 1 test |
| 0-5263 |
| 1551 | if (exec_argv0)| TRUE | never evaluated | | FALSE | evaluated 5263 times by 1 test |
| 0-5263 |
| 1552 | { | - |
| 1553 | free (exec_argv0); | - |
| 1554 | exec_argv0 = (char *)NULL; | - |
| 1555 | } never executed: end of block | 0 |
| 1556 | | - |
| 1557 | if (file_isdir (filename))| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5262 times by 1 test |
| 1-5262 |
| 1558 | { | - |
| 1559 | #if defined (EISDIR) | - |
| 1560 | errno = EISDIR; | - |
| 1561 | #else | - |
| 1562 | errno = EINVAL; | - |
| 1563 | #endif | - |
| 1564 | file_error (filename); | - |
| 1565 | #if defined (JOB_CONTROL) | - |
| 1566 | end_job_control (); | - |
| 1567 | #endif | - |
| 1568 | sh_exit (EX_NOINPUT); | - |
| 1569 | } never executed: end of block | 0 |
| 1570 | | - |
| 1571 | #if defined (ARRAY_VARS) | - |
| 1572 | GET_ARRAY_FROM_VAR ("FUNCNAME", funcname_v, funcname_a); | - |
| 1573 | GET_ARRAY_FROM_VAR ("BASH_SOURCE", bash_source_v, bash_source_a); | - |
| 1574 | GET_ARRAY_FROM_VAR ("BASH_LINENO", bash_lineno_v, bash_lineno_a); | - |
| 1575 | | - |
| 1576 | array_push (bash_source_a, filename); | - |
| 1577 | if (bash_lineno_a)| TRUE | evaluated 5262 times by 1 test | | FALSE | never evaluated |
| 0-5262 |
| 1578 | { | - |
| 1579 | t = itos (executing_line_number ()); | - |
| 1580 | array_push (bash_lineno_a, t); | - |
| 1581 | free (t); | - |
| 1582 | }executed 5262 times by 1 test: end of block | 5262 |
| 1583 | array_push (funcname_a, "main"); | - |
| 1584 | #endif | - |
| 1585 | | - |
| 1586 | #ifdef HAVE_DEV_FD | - |
| 1587 | fd_is_tty = isatty (fd); | - |
| 1588 | #else | - |
| 1589 | fd_is_tty = 0; | - |
| 1590 | #endif | - |
| 1591 | | - |
| 1592 | | - |
| 1593 | if (fd_is_tty == 0 && (lseek (fd, 0L, 1) != -1))| TRUE | evaluated 5262 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 5262 times by 1 test | | FALSE | never evaluated |
| 0-5262 |
| 1594 | { | - |
| 1595 | | - |
| 1596 | | - |
| 1597 | | - |
| 1598 | sample_len = read (fd, sample, sizeof (sample)); | - |
| 1599 | if (sample_len < 0)| TRUE | never evaluated | | FALSE | evaluated 5262 times by 1 test |
| 0-5262 |
| 1600 | { | - |
| 1601 | e = errno; | - |
| 1602 | if ((fstat (fd, &sb) == 0) && S_ISDIR (sb.st_mode))| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1603 | { | - |
| 1604 | #if defined (EISDIR) | - |
| 1605 | errno = EISDIR; | - |
| 1606 | file_error (filename); | - |
| 1607 | #else | - |
| 1608 | internal_error (_("%s: Is a directory"), filename); | - |
| 1609 | #endif | - |
| 1610 | } never executed: end of block | 0 |
| 1611 | else | - |
| 1612 | { | - |
| 1613 | errno = e; | - |
| 1614 | file_error (filename); | - |
| 1615 | } never executed: end of block | 0 |
| 1616 | #if defined (JOB_CONTROL) | - |
| 1617 | end_job_control (); | - |
| 1618 | #endif | - |
| 1619 | exit (EX_NOEXEC); never executed: exit (126); | 0 |
| 1620 | } | - |
| 1621 | else if (sample_len > 0 && (check_binary_file (sample, sample_len)))| TRUE | evaluated 5262 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5261 times by 1 test |
| 0-5262 |
| 1622 | { | - |
| 1623 | internal_error (_("%s: cannot execute binary file"), filename); | - |
| 1624 | #if defined (JOB_CONTROL) | - |
| 1625 | end_job_control (); | - |
| 1626 | #endif | - |
| 1627 | exit (EX_BINARY_FILE);executed 1 time by 1 test: exit (126); | 1 |
| 1628 | } | - |
| 1629 | | - |
| 1630 | lseek (fd, 0L, 0); | - |
| 1631 | }executed 5261 times by 1 test: end of block | 5261 |
| 1632 | | - |
| 1633 | | - |
| 1634 | | - |
| 1635 | | - |
| 1636 | fd = move_to_high_fd (fd, 1, -1); | - |
| 1637 | | - |
| 1638 | #if defined (BUFFERED_INPUT) | - |
| 1639 | default_buffered_input = fd; | - |
| 1640 | SET_CLOSE_ON_EXEC (default_buffered_input); | - |
| 1641 | #else /* !BUFFERED_INPUT */ | - |
| 1642 | default_input = fdopen (fd, "r"); | - |
| 1643 | | - |
| 1644 | if (default_input == 0) | - |
| 1645 | { | - |
| 1646 | file_error (filename); | - |
| 1647 | exit (EX_NOTFOUND); | - |
| 1648 | } | - |
| 1649 | | - |
| 1650 | SET_CLOSE_ON_EXEC (fd); | - |
| 1651 | if (fileno (default_input) != fd) | - |
| 1652 | SET_CLOSE_ON_EXEC (fileno (default_input)); | - |
| 1653 | #endif /* !BUFFERED_INPUT */ | - |
| 1654 | | - |
| 1655 | | - |
| 1656 | | - |
| 1657 | if (interactive_shell && fd_is_tty)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5260 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
| 0-5260 |
| 1658 | { | - |
| 1659 | dup2 (fd, 0); | - |
| 1660 | close (fd); | - |
| 1661 | fd = 0; | - |
| 1662 | #if defined (BUFFERED_INPUT) | - |
| 1663 | default_buffered_input = 0; | - |
| 1664 | #else | - |
| 1665 | fclose (default_input); | - |
| 1666 | default_input = stdin; | - |
| 1667 | #endif | - |
| 1668 | } never executed: end of block | 0 |
| 1669 | else if (forced_interactive && fd_is_tty == 0)| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5260 times by 1 test |
| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-5260 |
| 1670 | | - |
| 1671 | | - |
| 1672 | | - |
| 1673 | init_interactive_script ();executed 1 time by 1 test: init_interactive_script (); | 1 |
| 1674 | | - |
| 1675 | free (filename); | - |
| 1676 | | - |
| 1677 | reading_shell_script = 1; | - |
| 1678 | return (fd);executed 5261 times by 1 test: return (fd); | 5261 |
| 1679 | } | - |
| 1680 | | - |
| 1681 | | - |
| 1682 | static void | - |
| 1683 | set_bash_input () | - |
| 1684 | { | - |
| 1685 | | - |
| 1686 | | - |
| 1687 | #if defined (BUFFERED_INPUT) | - |
| 1688 | if (interactive == 0)| TRUE | evaluated 5266 times by 1 test | | FALSE | never evaluated |
| 0-5266 |
| 1689 | sh_unset_nodelay_mode (default_buffered_input);executed 5266 times by 1 test: sh_unset_nodelay_mode (default_buffered_input); | 5266 |
| 1690 | else | - |
| 1691 | #endif /* !BUFFERED_INPUT */ | - |
| 1692 | sh_unset_nodelay_mode (fileno (stdin)); never executed: sh_unset_nodelay_mode (fileno ( stdin )); | 0 |
| 1693 | | - |
| 1694 | | - |
| 1695 | if (interactive && no_line_editing == 0)| TRUE | never evaluated | | FALSE | evaluated 5266 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5266 |
| 1696 | with_input_from_stdin (); never executed: with_input_from_stdin (); | 0 |
| 1697 | #if defined (BUFFERED_INPUT) | - |
| 1698 | else if (interactive == 0)| TRUE | evaluated 5266 times by 1 test | | FALSE | never evaluated |
| 0-5266 |
| 1699 | with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]);executed 5266 times by 1 test: with_input_from_buffered_stream (default_buffered_input, dollar_vars[0]); | 5266 |
| 1700 | #endif /* BUFFERED_INPUT */ | - |
| 1701 | else | - |
| 1702 | with_input_from_stream (default_input, dollar_vars[0]); never executed: with_input_from_stream (default_input, dollar_vars[0]); | 0 |
| 1703 | } | - |
| 1704 | | - |
| 1705 | | - |
| 1706 | | - |
| 1707 | | - |
| 1708 | | - |
| 1709 | void | - |
| 1710 | unset_bash_input (check_zero) | - |
| 1711 | int check_zero; | - |
| 1712 | { | - |
| 1713 | #if defined (BUFFERED_INPUT) | - |
| 1714 | if ((check_zero && default_buffered_input >= 0) ||| TRUE | never evaluated | | FALSE | evaluated 6639 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-6639 |
| 1715 | (check_zero == 0 && default_buffered_input > 0))| TRUE | evaluated 6639 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 4868 times by 1 test | | FALSE | evaluated 1771 times by 1 test |
| 0-6639 |
| 1716 | { | - |
| 1717 | close_buffered_fd (default_buffered_input); | - |
| 1718 | default_buffered_input = bash_input.location.buffered_fd = -1; | - |
| 1719 | bash_input.type = st_none; | - |
| 1720 | }executed 4868 times by 1 test: end of block | 4868 |
| 1721 | #else /* !BUFFERED_INPUT */ | - |
| 1722 | if (default_input) | - |
| 1723 | { | - |
| 1724 | fclose (default_input); | - |
| 1725 | default_input = (FILE *)NULL; | - |
| 1726 | } | - |
| 1727 | #endif /* !BUFFERED_INPUT */ | - |
| 1728 | }executed 6639 times by 1 test: end of block | 6639 |
| 1729 | | - |
| 1730 | | - |
| 1731 | #if !defined (PROGRAM) | - |
| 1732 | # define PROGRAM "bash" | - |
| 1733 | #endif | - |
| 1734 | | - |
| 1735 | static void | - |
| 1736 | set_shell_name (argv0) | - |
| 1737 | char *argv0; | - |
| 1738 | { | - |
| 1739 | | - |
| 1740 | | - |
| 1741 | shell_name = argv0 ? base_pathname (argv0) : PROGRAM;| TRUE | evaluated 5447 times by 1 test | | FALSE | never evaluated |
| 0-5447 |
| 1742 | | - |
| 1743 | if (argv0 && *argv0 == '-')| TRUE | evaluated 5447 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5446 times by 1 test |
| 0-5447 |
| 1744 | { | - |
| 1745 | if (*shell_name == '-')| TRUE | evaluated 1 time by 1 test | | FALSE | never evaluated |
| 0-1 |
| 1746 | shell_name++;executed 1 time by 1 test: shell_name++; | 1 |
| 1747 | login_shell = 1; | - |
| 1748 | }executed 1 time by 1 test: end of block | 1 |
| 1749 | | - |
| 1750 | if (shell_name[0] == 's' && shell_name[1] == 'h' && shell_name[2] == '\0')| TRUE | evaluated 40 times by 1 test | | FALSE | evaluated 5407 times by 1 test |
| TRUE | evaluated 38 times by 1 test | | FALSE | evaluated 2 times by 1 test |
| TRUE | evaluated 38 times by 1 test | | FALSE | never evaluated |
| 0-5407 |
| 1751 | act_like_sh++;executed 38 times by 1 test: act_like_sh++; | 38 |
| 1752 | if (shell_name[0] == 's' && shell_name[1] == 'u' && shell_name[2] == '\0')| TRUE | evaluated 40 times by 1 test | | FALSE | evaluated 5407 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 40 times by 1 test |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0-5407 |
| 1753 | su_shell++; never executed: su_shell++; | 0 |
| 1754 | | - |
| 1755 | shell_name = argv0 ? argv0 : PROGRAM;| TRUE | evaluated 5447 times by 1 test | | FALSE | never evaluated |
| 0-5447 |
| 1756 | FREE (dollar_vars[0]);executed 15 times by 1 test: sh_xfree((dollar_vars[0]), "shell.c", 1756); | TRUE | evaluated 15 times by 1 test | | FALSE | evaluated 5432 times by 1 test |
| 15-5432 |
| 1757 | dollar_vars[0] = savestring (shell_name); | - |
| 1758 | | - |
| 1759 | | - |
| 1760 | | - |
| 1761 | | - |
| 1762 | if (!shell_name || !*shell_name || (shell_name[0] == '-' && !shell_name[1]))| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 5447 times by 1 test |
| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 5446 times by 1 test |
| TRUE | never evaluated | | FALSE | evaluated 1 time by 1 test |
| 0-5447 |
| 1763 | shell_name = PROGRAM; never executed: shell_name = "bash"; | 0 |
| 1764 | }executed 5447 times by 1 test: end of block | 5447 |
| 1765 | | - |
| 1766 | static void | - |
| 1767 | init_interactive () | - |
| 1768 | { | - |
| 1769 | expand_aliases = interactive_shell = startup_state = 1; | - |
| 1770 | interactive = 1; | - |
| 1771 | #if defined (HISTORY) | - |
| 1772 | remember_on_history = enable_history_list = 1; | - |
| 1773 | histexp_flag = history_expansion; | - |
| 1774 | #endif | - |
| 1775 | }executed 2 times by 1 test: end of block | 2 |
| 1776 | | - |
| 1777 | static void | - |
| 1778 | init_noninteractive () | - |
| 1779 | { | - |
| 1780 | #if defined (HISTORY) | - |
| 1781 | bash_history_reinit (0); | - |
| 1782 | #endif /* HISTORY */ | - |
| 1783 | interactive_shell = startup_state = interactive = 0; | - |
| 1784 | expand_aliases = posixly_correct; | - |
| 1785 | no_line_editing = 1; | - |
| 1786 | #if defined (JOB_CONTROL) | - |
| 1787 | | - |
| 1788 | | - |
| 1789 | set_job_control (forced_interactive||jobs_m_flag); | - |
| 1790 | #endif /* JOB_CONTROL */ | - |
| 1791 | }executed 5446 times by 1 test: end of block | 5446 |
| 1792 | | - |
| 1793 | static void | - |
| 1794 | init_interactive_script () | - |
| 1795 | { | - |
| 1796 | init_noninteractive (); | - |
| 1797 | expand_aliases = interactive_shell = startup_state = 1; | - |
| 1798 | #if defined (HISTORY) | - |
| 1799 | remember_on_history = enable_history_list = 1; | - |
| 1800 | #endif | - |
| 1801 | }executed 1 time by 1 test: end of block | 1 |
| 1802 | | - |
| 1803 | void | - |
| 1804 | get_current_user_info () | - |
| 1805 | { | - |
| 1806 | struct passwd *entry; | - |
| 1807 | | - |
| 1808 | | - |
| 1809 | if (current_user.user_name == 0)| TRUE | evaluated 8 times by 1 test | | FALSE | never evaluated |
| 0-8 |
| 1810 | { | - |
| 1811 | #if defined (__TANDEM) | - |
| 1812 | entry = getpwnam (getlogin ()); | - |
| 1813 | #else | - |
| 1814 | entry = getpwuid (current_user.uid); | - |
| 1815 | #endif | - |
| 1816 | if (entry)| TRUE | evaluated 8 times by 1 test | | FALSE | never evaluated |
| 0-8 |
| 1817 | { | - |
| 1818 | current_user.user_name = savestring (entry->pw_name); | - |
| 1819 | current_user.shell = (entry->pw_shell && entry->pw_shell[0])| TRUE | evaluated 8 times by 1 test | | FALSE | never evaluated |
| TRUE | evaluated 8 times by 1 test | | FALSE | never evaluated |
| 0-8 |
| 1820 | ? savestring (entry->pw_shell) | - |
| 1821 | : savestring ("/bin/sh"); | - |
| 1822 | current_user.home_dir = savestring (entry->pw_dir); | - |
| 1823 | }executed 8 times by 1 test: end of block | 8 |
| 1824 | else | - |
| 1825 | { | - |
| 1826 | current_user.user_name = _("I have no name!"); | - |
| 1827 | current_user.user_name = savestring (current_user.user_name); | - |
| 1828 | current_user.shell = savestring ("/bin/sh"); | - |
| 1829 | current_user.home_dir = savestring ("/"); | - |
| 1830 | } never executed: end of block | 0 |
| 1831 | #if defined (HAVE_GETPWENT) | - |
| 1832 | endpwent (); | - |
| 1833 | #endif | - |
| 1834 | }executed 8 times by 1 test: end of block | 8 |
| 1835 | }executed 8 times by 1 test: end of block | 8 |
| 1836 | | - |
| 1837 | | - |
| 1838 | | - |
| 1839 | static void | - |
| 1840 | shell_initialize () | - |
| 1841 | { | - |
| 1842 | char hostname[256]; | - |
| 1843 | int should_be_restricted; | - |
| 1844 | | - |
| 1845 | | - |
| 1846 | if (shell_initialized == 0)| TRUE | evaluated 5432 times by 1 test | | FALSE | evaluated 15 times by 1 test |
| 15-5432 |
| 1847 | { | - |
| 1848 | sh_setlinebuf (stderr); | - |
| 1849 | sh_setlinebuf (stdout); | - |
| 1850 | }executed 5432 times by 1 test: end of block | 5432 |
| 1851 | | - |
| 1852 | | - |
| 1853 | | - |
| 1854 | initialize_shell_builtins (); | - |
| 1855 | | - |
| 1856 | | - |
| 1857 | | - |
| 1858 | | - |
| 1859 | | - |
| 1860 | initialize_traps (); | - |
| 1861 | initialize_signals (0); | - |
| 1862 | | - |
| 1863 | | - |
| 1864 | if (current_host_name == 0)| TRUE | evaluated 5432 times by 1 test | | FALSE | evaluated 15 times by 1 test |
| 15-5432 |
| 1865 | { | - |
| 1866 | | - |
| 1867 | if (gethostname (hostname, 255) < 0)| TRUE | never evaluated | | FALSE | evaluated 5432 times by 1 test |
| 0-5432 |
| 1868 | current_host_name = "??host??"; never executed: current_host_name = "??host??"; | 0 |
| 1869 | else | - |
| 1870 | current_host_name = savestring (hostname);executed 5432 times by 1 test: current_host_name = (char *)strcpy (sh_xmalloc((1 + strlen (hostname)), "shell.c", 1870), (hostname)); | 5432 |
| 1871 | } | - |
| 1872 | | - |
| 1873 | | - |
| 1874 | | - |
| 1875 | | - |
| 1876 | if (interactive_shell)| TRUE | evaluated 2 times by 1 test | | FALSE | evaluated 5445 times by 1 test |
| 2-5445 |
| 1877 | get_current_user_info ();executed 2 times by 1 test: get_current_user_info (); | 2 |
| 1878 | | - |
| 1879 | | - |
| 1880 | tilde_initialize (); | - |
| 1881 | | - |
| 1882 | #if defined (RESTRICTED_SHELL) | - |
| 1883 | should_be_restricted = shell_is_restricted (shell_name); | - |
| 1884 | #endif | - |
| 1885 | | - |
| 1886 | | - |
| 1887 | | - |
| 1888 | | - |
| 1889 | #if defined (RESTRICTED_SHELL) | - |
| 1890 | initialize_shell_variables (shell_environment, privileged_mode||restricted||should_be_restricted||running_setuid); | - |
| 1891 | #else | - |
| 1892 | initialize_shell_variables (shell_environment, privileged_mode||running_setuid); | - |
| 1893 | #endif | - |
| 1894 | | - |
| 1895 | | - |
| 1896 | initialize_job_control (jobs_m_flag); | - |
| 1897 | | - |
| 1898 | | - |
| 1899 | initialize_bash_input (); | - |
| 1900 | | - |
| 1901 | initialize_flags (); | - |
| 1902 | | - |
| 1903 | | - |
| 1904 | | - |
| 1905 | | - |
| 1906 | | - |
| 1907 | #if defined (RESTRICTED_SHELL) | - |
| 1908 | initialize_shell_options (privileged_mode||restricted||should_be_restricted||running_setuid); | - |
| 1909 | initialize_bashopts (privileged_mode||restricted||should_be_restricted||running_setuid); | - |
| 1910 | #else | - |
| 1911 | initialize_shell_options (privileged_mode||running_setuid); | - |
| 1912 | initialize_bashopts (privileged_mode||running_setuid); | - |
| 1913 | #endif | - |
| 1914 | }executed 5447 times by 1 test: end of block | 5447 |
| 1915 | | - |
| 1916 | | - |
| 1917 | | - |
| 1918 | | - |
| 1919 | static void | - |
| 1920 | shell_reinitialize () | - |
| 1921 | { | - |
| 1922 | | - |
| 1923 | primary_prompt = PPROMPT; | - |
| 1924 | secondary_prompt = SPROMPT; | - |
| 1925 | | - |
| 1926 | | - |
| 1927 | current_command_number = 1; | - |
| 1928 | | - |
| 1929 | | - |
| 1930 | | - |
| 1931 | | - |
| 1932 | | - |
| 1933 | no_rc = no_profile = 1; | - |
| 1934 | | - |
| 1935 | | - |
| 1936 | login_shell = make_login_shell = interactive = executing = 0; | - |
| 1937 | debugging = do_version = line_number = last_command_exit_value = 0; | - |
| 1938 | forced_interactive = interactive_shell = 0; | - |
| 1939 | subshell_environment = running_in_background = 0; | - |
| 1940 | expand_aliases = 0; | - |
| 1941 | bash_argv_initialized = 0; | - |
| 1942 | | - |
| 1943 | | - |
| 1944 | | - |
| 1945 | #if defined (HISTORY) | - |
| 1946 | bash_history_reinit (enable_history_list = 0); | - |
| 1947 | #endif /* HISTORY */ | - |
| 1948 | | - |
| 1949 | #if defined (RESTRICTED_SHELL) | - |
| 1950 | restricted = 0; | - |
| 1951 | #endif /* RESTRICTED_SHELL */ | - |
| 1952 | | - |
| 1953 | | - |
| 1954 | | - |
| 1955 | bashrc_file = DEFAULT_BASHRC; | - |
| 1956 | | - |
| 1957 | | - |
| 1958 | | - |
| 1959 | delete_all_contexts (shell_variables); | - |
| 1960 | delete_all_variables (shell_functions); | - |
| 1961 | | - |
| 1962 | reinit_special_variables (); | - |
| 1963 | | - |
| 1964 | #if defined (READLINE) | - |
| 1965 | bashline_reinitialize (); | - |
| 1966 | #endif | - |
| 1967 | | - |
| 1968 | shell_reinitialized = 1; | - |
| 1969 | }executed 15 times by 1 test: end of block | 15 |
| 1970 | | - |
| 1971 | static void | - |
| 1972 | show_shell_usage (fp, extra) | - |
| 1973 | FILE *fp; | - |
| 1974 | int extra; | - |
| 1975 | { | - |
| 1976 | int i; | - |
| 1977 | char *set_opts, *s, *t; | - |
| 1978 | | - |
| 1979 | if (extra)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1980 | fprintf (fp, _("GNU bash, version %s-(%s)\n"), shell_version_string (), MACHTYPE); never executed: fprintf (fp, dcgettext (((void *)0), "GNU bash, version %s-(%s)\n" , 5) , shell_version_string (), "x86_64-pc-linux-gnu"); | 0 |
| 1981 | fprintf (fp, _("Usage:\t%s [GNU long option] [option] ...\n\t%s [GNU long option] [option] script-file ...\n"), | - |
| 1982 | shell_name, shell_name); | - |
| 1983 | fputs (_("GNU long options:\n"), fp); | - |
| 1984 | for (i = 0; long_args[i].name; i++)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1985 | fprintf (fp, "\t--%s\n", long_args[i].name); never executed: fprintf (fp, "\t--%s\n", long_args[i].name); | 0 |
| 1986 | | - |
| 1987 | fputs (_("Shell options:\n"), fp); | - |
| 1988 | fputs (_("\t-ilrsD or -c command or -O shopt_option\t\t(invocation only)\n"), fp); | - |
| 1989 | | - |
| 1990 | for (i = 0, set_opts = 0; shell_builtins[i].name; i++)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1991 | if (STREQ (shell_builtins[i].name, "set")) never executed: __result = (((const unsigned char *) (const char *) ( shell_builtins[i].name ))[3] - __s2[3]); never executed: end of block never executed: end of block never executed: __result = (((const unsigned char *) (const char *) ( "set" ))[3] - __s2[3]); never executed: end of block never executed: end of block | 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 |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1992 | set_opts = savestring (shell_builtins[i].short_doc); never executed: set_opts = (char *)strcpy (sh_xmalloc((1 + strlen (shell_builtins[i].short_doc)), "shell.c", 1992), (shell_builtins[i].short_doc)); | 0 |
| 1993 | if (set_opts)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1994 | { | - |
| 1995 | s = strchr (set_opts, '[');| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1996 | if (s == 0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1997 | s = set_opts; never executed: s = set_opts; | 0 |
| 1998 | while (*++s == '-')| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1999 | ; never executed: ; | 0 |
| 2000 | t = strchr (s, ']');| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2001 | if (t)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2002 | *t = '\0'; never executed: *t = '\0'; | 0 |
| 2003 | fprintf (fp, _("\t-%s or -o option\n"), s); | - |
| 2004 | free (set_opts); | - |
| 2005 | } never executed: end of block | 0 |
| 2006 | | - |
| 2007 | if (extra)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2008 | { | - |
| 2009 | fprintf (fp, _("Type `%s -c \"help set\"' for more information about shell options.\n"), shell_name); | - |
| 2010 | fprintf (fp, _("Type `%s -c help' for more information about shell builtin commands.\n"), shell_name); | - |
| 2011 | fprintf (fp, _("Use the `bashbug' command to report bugs.\n")); | - |
| 2012 | fprintf (fp, "\n"); | - |
| 2013 | fprintf (fp, _("bash home page: <http://www.gnu.org/software/bash>\n")); | - |
| 2014 | fprintf (fp, _("General help using GNU software: <http://www.gnu.org/gethelp/>\n")); | - |
| 2015 | } never executed: end of block | 0 |
| 2016 | } never executed: end of block | 0 |
| 2017 | | - |
| 2018 | static void | - |
| 2019 | add_shopt_to_alist (opt, on_or_off) | - |
| 2020 | char *opt; | - |
| 2021 | int on_or_off; | - |
| 2022 | { | - |
| 2023 | if (shopt_ind >= shopt_len)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2024 | { | - |
| 2025 | shopt_len += 8; | - |
| 2026 | shopt_alist = (STRING_INT_ALIST *)xrealloc (shopt_alist, shopt_len * sizeof (shopt_alist[0])); | - |
| 2027 | } never executed: end of block | 0 |
| 2028 | shopt_alist[shopt_ind].word = opt; | - |
| 2029 | shopt_alist[shopt_ind].token = on_or_off; | - |
| 2030 | shopt_ind++; | - |
| 2031 | } never executed: end of block | 0 |
| 2032 | | - |
| 2033 | static void | - |
| 2034 | run_shopt_alist () | - |
| 2035 | { | - |
| 2036 | register int i; | - |
| 2037 | | - |
| 2038 | for (i = 0; i < shopt_ind; i++)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2039 | if (shopt_setopt (shopt_alist[i].word, (shopt_alist[i].token == '-')) != EXECUTION_SUCCESS)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2040 | exit (EX_BADUSAGE); never executed: exit (2); | 0 |
| 2041 | free (shopt_alist); | - |
| 2042 | shopt_alist = 0; | - |
| 2043 | shopt_ind = shopt_len = 0; | - |
| 2044 | } never executed: end of block | 0 |
| | |