| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/builtins/shopt.def |
| Switch to Source code | Preprocessed file |
| 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 | extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames; | - | ||||||||||||||||||||||||
| 25 | extern int cdable_vars, mail_warning, source_uses_path; | - | ||||||||||||||||||||||||
| 26 | extern int no_exit_on_failed_exec, print_shift_error; | - | ||||||||||||||||||||||||
| 27 | extern int check_hashed_filenames, promptvars; | - | ||||||||||||||||||||||||
| 28 | extern int cdspelling, expand_aliases; | - | ||||||||||||||||||||||||
| 29 | extern int extended_quote; | - | ||||||||||||||||||||||||
| 30 | extern int check_window_size; | - | ||||||||||||||||||||||||
| 31 | extern int glob_ignore_case, match_ignore_case; | - | ||||||||||||||||||||||||
| 32 | extern int hup_on_exit; | - | ||||||||||||||||||||||||
| 33 | extern int xpg_echo; | - | ||||||||||||||||||||||||
| 34 | extern int gnu_error_format; | - | ||||||||||||||||||||||||
| 35 | extern int check_jobs_at_exit; | - | ||||||||||||||||||||||||
| 36 | extern int autocd; | - | ||||||||||||||||||||||||
| 37 | extern int glob_star; | - | ||||||||||||||||||||||||
| 38 | extern int glob_asciirange; | - | ||||||||||||||||||||||||
| 39 | extern int lastpipe_opt; | - | ||||||||||||||||||||||||
| 40 | extern int inherit_errexit; | - | ||||||||||||||||||||||||
| 41 | extern int localvar_inherit; | - | ||||||||||||||||||||||||
| 42 | extern int localvar_unset; | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | - | |||||||||||||||||||||||||
| 45 | extern int extended_glob; | - | ||||||||||||||||||||||||
| 46 | - | |||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | extern int hist_verify, history_reediting, perform_hostname_completion; | - | ||||||||||||||||||||||||
| 50 | extern int no_empty_command_completion; | - | ||||||||||||||||||||||||
| 51 | extern int force_fignore; | - | ||||||||||||||||||||||||
| 52 | extern int dircomplete_spelling, dircomplete_expand; | - | ||||||||||||||||||||||||
| 53 | extern int complete_fullquote; | - | ||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | extern int enable_hostname_completion (int); | - | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | extern int prog_completion_enabled; | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||
| 63 | extern int debugging_mode; | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | extern int assoc_expand_once; | - | ||||||||||||||||||||||||
| 68 | extern int array_expand_once; | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | static void shopt_error (char *); | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | static int set_shellopts_after_change (char *, int); | - | ||||||||||||||||||||||||
| 74 | static int set_compatibility_level (char *, int); | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | static int set_restricted_shell (char *, int); | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | static int shopt_enable_hostname_completion (char *, int); | - | ||||||||||||||||||||||||
| 82 | static int shopt_set_complete_direxpand (char *, int); | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | static int shopt_set_debug_mode (char *, int); | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | static int shopt_login_shell; | - | ||||||||||||||||||||||||
| 88 | static int shopt_compat31; | - | ||||||||||||||||||||||||
| 89 | static int shopt_compat32; | - | ||||||||||||||||||||||||
| 90 | static int shopt_compat40; | - | ||||||||||||||||||||||||
| 91 | static int shopt_compat41; | - | ||||||||||||||||||||||||
| 92 | static int shopt_compat42; | - | ||||||||||||||||||||||||
| 93 | static int shopt_compat43; | - | ||||||||||||||||||||||||
| 94 | static int shopt_compat44; | - | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | typedef int shopt_set_func_t (char *, int); | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | - | |||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | static struct { | - | ||||||||||||||||||||||||
| 102 | char *name; | - | ||||||||||||||||||||||||
| 103 | int *value; | - | ||||||||||||||||||||||||
| 104 | shopt_set_func_t *set_func; | - | ||||||||||||||||||||||||
| 105 | } shopt_vars[] = { | - | ||||||||||||||||||||||||
| 106 | { "autocd", &autocd, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 107 | ((void *)0) | - | ||||||||||||||||||||||||
| 108 | }, | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | { "assoc_expand_once", &assoc_expand_once, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 111 | ((void *)0) | - | ||||||||||||||||||||||||
| 112 | }, | - | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | { "cdable_vars", &cdable_vars, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 115 | ((void *)0) | - | ||||||||||||||||||||||||
| 116 | }, | - | ||||||||||||||||||||||||
| 117 | { "cdspell", &cdspelling, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 118 | ((void *)0) | - | ||||||||||||||||||||||||
| 119 | }, | - | ||||||||||||||||||||||||
| 120 | { "checkhash", &check_hashed_filenames, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 121 | ((void *)0) | - | ||||||||||||||||||||||||
| 122 | }, | - | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | { "checkjobs", &check_jobs_at_exit, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 125 | ((void *)0) | - | ||||||||||||||||||||||||
| 126 | }, | - | ||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | { "checkwinsize", &check_window_size, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 129 | ((void *)0) | - | ||||||||||||||||||||||||
| 130 | }, | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | { "cmdhist", &command_oriented_history, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 133 | ((void *)0) | - | ||||||||||||||||||||||||
| 134 | }, | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | { "compat31", &shopt_compat31, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 137 | { "compat32", &shopt_compat32, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 138 | { "compat40", &shopt_compat40, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 139 | { "compat41", &shopt_compat41, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 140 | { "compat42", &shopt_compat42, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 141 | { "compat43", &shopt_compat43, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 142 | { "compat44", &shopt_compat44, set_compatibility_level }, | - | ||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 145 | ((void *)0) | - | ||||||||||||||||||||||||
| 146 | }, | - | ||||||||||||||||||||||||
| 147 | { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand }, | - | ||||||||||||||||||||||||
| 148 | { "dirspell", &dircomplete_spelling, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 149 | ((void *)0) | - | ||||||||||||||||||||||||
| 150 | }, | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | { "dotglob", &glob_dot_filenames, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 153 | ((void *)0) | - | ||||||||||||||||||||||||
| 154 | }, | - | ||||||||||||||||||||||||
| 155 | { "execfail", &no_exit_on_failed_exec, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 156 | ((void *)0) | - | ||||||||||||||||||||||||
| 157 | }, | - | ||||||||||||||||||||||||
| 158 | { "expand_aliases", &expand_aliases, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 159 | ((void *)0) | - | ||||||||||||||||||||||||
| 160 | }, | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | { "extdebug", &debugging_mode, shopt_set_debug_mode }, | - | ||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | { "extglob", &extended_glob, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 166 | ((void *)0) | - | ||||||||||||||||||||||||
| 167 | }, | - | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | { "extquote", &extended_quote, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 170 | ((void *)0) | - | ||||||||||||||||||||||||
| 171 | }, | - | ||||||||||||||||||||||||
| 172 | { "failglob", &fail_glob_expansion, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 173 | ((void *)0) | - | ||||||||||||||||||||||||
| 174 | }, | - | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | { "force_fignore", &force_fignore, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 177 | ((void *)0) | - | ||||||||||||||||||||||||
| 178 | }, | - | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | { "globasciiranges", &glob_asciirange, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 181 | ((void *)0) | - | ||||||||||||||||||||||||
| 182 | }, | - | ||||||||||||||||||||||||
| 183 | { "globstar", &glob_star, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 184 | ((void *)0) | - | ||||||||||||||||||||||||
| 185 | }, | - | ||||||||||||||||||||||||
| 186 | { "gnu_errfmt", &gnu_error_format, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 187 | ((void *)0) | - | ||||||||||||||||||||||||
| 188 | }, | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | { "histappend", &force_append_history, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 191 | ((void *)0) | - | ||||||||||||||||||||||||
| 192 | }, | - | ||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | { "histreedit", &history_reediting, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 196 | ((void *)0) | - | ||||||||||||||||||||||||
| 197 | }, | - | ||||||||||||||||||||||||
| 198 | { "histverify", &hist_verify, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 199 | ((void *)0) | - | ||||||||||||||||||||||||
| 200 | }, | - | ||||||||||||||||||||||||
| 201 | { "hostcomplete", &perform_hostname_completion, shopt_enable_hostname_completion }, | - | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | { "huponexit", &hup_on_exit, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 204 | ((void *)0) | - | ||||||||||||||||||||||||
| 205 | }, | - | ||||||||||||||||||||||||
| 206 | { "inherit_errexit", &inherit_errexit, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 207 | ((void *)0) | - | ||||||||||||||||||||||||
| 208 | }, | - | ||||||||||||||||||||||||
| 209 | { "interactive_comments", &interactive_comments, set_shellopts_after_change }, | - | ||||||||||||||||||||||||
| 210 | { "lastpipe", &lastpipe_opt, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 211 | ((void *)0) | - | ||||||||||||||||||||||||
| 212 | }, | - | ||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | { "lithist", &literal_history, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 215 | ((void *)0) | - | ||||||||||||||||||||||||
| 216 | }, | - | ||||||||||||||||||||||||
| 217 | - | |||||||||||||||||||||||||
| 218 | { "localvar_inherit", &localvar_inherit, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 219 | ((void *)0) | - | ||||||||||||||||||||||||
| 220 | }, | - | ||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | { "login_shell", &shopt_login_shell, set_login_shell }, | - | ||||||||||||||||||||||||
| 225 | { "mailwarn", &mail_warning, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 226 | ((void *)0) | - | ||||||||||||||||||||||||
| 227 | }, | - | ||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | { "no_empty_cmd_completion", &no_empty_command_completion, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 230 | ((void *)0) | - | ||||||||||||||||||||||||
| 231 | }, | - | ||||||||||||||||||||||||
| 232 | - | |||||||||||||||||||||||||
| 233 | { "nocaseglob", &glob_ignore_case, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 234 | ((void *)0) | - | ||||||||||||||||||||||||
| 235 | }, | - | ||||||||||||||||||||||||
| 236 | { "nocasematch", &match_ignore_case, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 237 | ((void *)0) | - | ||||||||||||||||||||||||
| 238 | }, | - | ||||||||||||||||||||||||
| 239 | { "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 240 | ((void *)0) | - | ||||||||||||||||||||||||
| 241 | }, | - | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | { "progcomp", &prog_completion_enabled, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 244 | ((void *)0) | - | ||||||||||||||||||||||||
| 245 | }, | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | { "promptvars", &promptvars, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 248 | ((void *)0) | - | ||||||||||||||||||||||||
| 249 | }, | - | ||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | { "restricted_shell", &restricted_shell, set_restricted_shell }, | - | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | { "shift_verbose", &print_shift_error, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 254 | ((void *)0) | - | ||||||||||||||||||||||||
| 255 | }, | - | ||||||||||||||||||||||||
| 256 | { "sourcepath", &source_uses_path, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 257 | ((void *)0) | - | ||||||||||||||||||||||||
| 258 | }, | - | ||||||||||||||||||||||||
| 259 | { "xpg_echo", &xpg_echo, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 260 | ((void *)0) | - | ||||||||||||||||||||||||
| 261 | }, | - | ||||||||||||||||||||||||
| 262 | { (char *)0, (int *)0, (shopt_set_func_t *) | - | ||||||||||||||||||||||||
| 263 | ((void *)0) | - | ||||||||||||||||||||||||
| 264 | } | - | ||||||||||||||||||||||||
| 265 | }; | - | ||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | static const char * const on = "on"; | - | ||||||||||||||||||||||||
| 272 | static const char * const off = "off"; | - | ||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | static int find_shopt (char *); | - | ||||||||||||||||||||||||
| 275 | static int toggle_shopts (int, WORD_LIST *, int); | - | ||||||||||||||||||||||||
| 276 | static void print_shopt (char *, int, int); | - | ||||||||||||||||||||||||
| 277 | static int list_shopts (WORD_LIST *, int); | - | ||||||||||||||||||||||||
| 278 | static int list_some_shopts (int, int); | - | ||||||||||||||||||||||||
| 279 | static int list_shopt_o_options (WORD_LIST *, int); | - | ||||||||||||||||||||||||
| 280 | static int list_some_o_options (int, int); | - | ||||||||||||||||||||||||
| 281 | static int set_shopt_o_options (int, WORD_LIST *, int); | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 | int | - | ||||||||||||||||||||||||
| 290 | shopt_builtin (list) | - | ||||||||||||||||||||||||
| 291 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 292 | { | - | ||||||||||||||||||||||||
| 293 | int opt, flags, rval; | - | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | flags = 0; | - | ||||||||||||||||||||||||
| 296 | reset_internal_getopt (); | - | ||||||||||||||||||||||||
| 297 | while ((
| 256-268 | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | switch (opt) | - | ||||||||||||||||||||||||
| 300 | { | - | ||||||||||||||||||||||||
| 301 | case executed 146 times by 1 test: 's':case 's':Executed by:
executed 146 times by 1 test: case 's':Executed by:
| 146 | ||||||||||||||||||||||||
| 302 | flags |= 0x01; | - | ||||||||||||||||||||||||
| 303 | break; executed 146 times by 1 test: break;Executed by:
| 146 | ||||||||||||||||||||||||
| 304 | case executed 89 times by 1 test: 'u':case 'u':Executed by:
executed 89 times by 1 test: case 'u':Executed by:
| 89 | ||||||||||||||||||||||||
| 305 | flags |= 0x02; | - | ||||||||||||||||||||||||
| 306 | break; executed 89 times by 1 test: break;Executed by:
| 89 | ||||||||||||||||||||||||
| 307 | case executed 6 times by 1 test: 'q':case 'q':Executed by:
executed 6 times by 1 test: case 'q':Executed by:
| 6 | ||||||||||||||||||||||||
| 308 | flags |= 0x04; | - | ||||||||||||||||||||||||
| 309 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||||||||
| 310 | case executed 13 times by 1 test: 'o':case 'o':Executed by:
executed 13 times by 1 test: case 'o':Executed by:
| 13 | ||||||||||||||||||||||||
| 311 | flags |= 0x08; | - | ||||||||||||||||||||||||
| 312 | break; executed 13 times by 1 test: break;Executed by:
| 13 | ||||||||||||||||||||||||
| 313 | case executed 13 times by 1 test: 'p':case 'p':Executed by:
executed 13 times by 1 test: case 'p':Executed by:
| 13 | ||||||||||||||||||||||||
| 314 | flags |= 0x10; | - | ||||||||||||||||||||||||
| 315 | break; executed 13 times by 1 test: break;Executed by:
| 13 | ||||||||||||||||||||||||
| 316 | case never executed: -99:case -99:never executed: builtin_help (); returncase -99:never executed: (258);return (258);never executed: return (258); | 0 | ||||||||||||||||||||||||
| 317 | default executed 1 time by 1 test: :default:Executed by:
executed 1 time by 1 test: default:Executed by:
| 1 | ||||||||||||||||||||||||
| 318 | builtin_usage (); | - | ||||||||||||||||||||||||
| 319 | return executed 1 time by 1 test: (258);return (258);Executed by:
executed 1 time by 1 test: return (258);Executed by:
| 1 | ||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||
| 321 | } | - | ||||||||||||||||||||||||
| 322 | list = loptend; | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | if ((
| 1-255 | ||||||||||||||||||||||||
| 325 | { | - | ||||||||||||||||||||||||
| 326 | builtin_error ( | - | ||||||||||||||||||||||||
| 327 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||
| 328 | "cannot set and unset shell options simultaneously" | - | ||||||||||||||||||||||||
| 329 | , 5) | - | ||||||||||||||||||||||||
| 330 | ); | - | ||||||||||||||||||||||||
| 331 | return executed 1 time by 1 test: (1);return (1);Executed by:
executed 1 time by 1 test: return (1);Executed by:
| 1 | ||||||||||||||||||||||||
| 332 | } | - | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | rval = 0; | - | ||||||||||||||||||||||||
| 335 | if ((
| 6-242 | ||||||||||||||||||||||||
| 336 | rval = list_shopt_o_options (list, flags); executed 7 times by 1 test: rval = list_shopt_o_options (list, flags);Executed by:
| 7 | ||||||||||||||||||||||||
| 337 | else if (list
| 3-241 | ||||||||||||||||||||||||
| 338 | rval = set_shopt_o_options ((flags & 0x01) ? '-' : '+', list, flags & 0x04); executed 3 times by 1 test: rval = set_shopt_o_options ((flags & 0x01) ? '-' : '+', list, flags & 0x04);Executed by:
| 3 | ||||||||||||||||||||||||
| 339 | else if (flags & 0x08
| 3-242 | ||||||||||||||||||||||||
| 340 | rval = list_some_o_options ((flags & 0x01) ? 1 : 0, flags); executed 3 times by 1 test: rval = list_some_o_options ((flags & 0x01) ? 1 : 0, flags);Executed by:
| 3 | ||||||||||||||||||||||||
| 341 | else if (list
| 4-238 | ||||||||||||||||||||||||
| 342 | rval = toggle_shopts ((flags & 0x01) ? 1 : 0, list, flags & 0x04); executed 224 times by 1 test: rval = toggle_shopts ((flags & 0x01) ? 1 : 0, list, flags & 0x04);Executed by:
| 224 | ||||||||||||||||||||||||
| 343 | else if ((
| 3-15 | ||||||||||||||||||||||||
| 344 | rval = list_shopts (list, flags); executed 15 times by 1 test: rval = list_shopts (list, flags);Executed by:
| 15 | ||||||||||||||||||||||||
| 345 | else | - | ||||||||||||||||||||||||
| 346 | rval = list_some_shopts ((flags & 0x01) ? 1 : 0, flags); executed 3 times by 1 test: rval = list_some_shopts ((flags & 0x01) ? 1 : 0, flags);Executed by:
| 3 | ||||||||||||||||||||||||
| 347 | return executed 255 times by 1 test: (rval);return (rval);Executed by:
executed 255 times by 1 test: return (rval);Executed by:
| 255 | ||||||||||||||||||||||||
| 348 | } | - | ||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | void | - | ||||||||||||||||||||||||
| 353 | reset_shopt_options () | - | ||||||||||||||||||||||||
| 354 | { | - | ||||||||||||||||||||||||
| 355 | autocd = cdable_vars = cdspelling = 0; | - | ||||||||||||||||||||||||
| 356 | check_hashed_filenames = 0; | - | ||||||||||||||||||||||||
| 357 | check_window_size = 0; | - | ||||||||||||||||||||||||
| 358 | allow_null_glob_expansion = glob_dot_filenames = 0; | - | ||||||||||||||||||||||||
| 359 | no_exit_on_failed_exec = 0; | - | ||||||||||||||||||||||||
| 360 | expand_aliases = 0; | - | ||||||||||||||||||||||||
| 361 | extended_quote = 1; | - | ||||||||||||||||||||||||
| 362 | fail_glob_expansion = 0; | - | ||||||||||||||||||||||||
| 363 | glob_asciirange = 0; | - | ||||||||||||||||||||||||
| 364 | glob_star = 0; | - | ||||||||||||||||||||||||
| 365 | gnu_error_format = 0; | - | ||||||||||||||||||||||||
| 366 | hup_on_exit = 0; | - | ||||||||||||||||||||||||
| 367 | inherit_errexit = 0; | - | ||||||||||||||||||||||||
| 368 | interactive_comments = 1; | - | ||||||||||||||||||||||||
| 369 | lastpipe_opt = 0; | - | ||||||||||||||||||||||||
| 370 | mail_warning = 0; | - | ||||||||||||||||||||||||
| 371 | glob_ignore_case = match_ignore_case = 0; | - | ||||||||||||||||||||||||
| 372 | print_shift_error = 0; | - | ||||||||||||||||||||||||
| 373 | source_uses_path = promptvars = 1; | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | check_jobs_at_exit = 0; | - | ||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||
| 379 | - | |||||||||||||||||||||||||
| 380 | extended_glob = 0; | - | ||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | literal_history = 0; | - | ||||||||||||||||||||||||
| 385 | force_append_history = 0; | - | ||||||||||||||||||||||||
| 386 | command_oriented_history = 1; | - | ||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | complete_fullquote = 1; | - | ||||||||||||||||||||||||
| 391 | force_fignore = 1; | - | ||||||||||||||||||||||||
| 392 | hist_verify = history_reediting = 0; | - | ||||||||||||||||||||||||
| 393 | perform_hostname_completion = 1; | - | ||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||
| 397 | dircomplete_expand = 0; | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | dircomplete_spelling = 0; | - | ||||||||||||||||||||||||
| 400 | no_empty_command_completion = 0; | - | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | prog_completion_enabled = 1; | - | ||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | xpg_echo = 0; | - | ||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||
| 413 | shopt_login_shell = login_shell; | - | ||||||||||||||||||||||||
| 414 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | static int | - | ||||||||||||||||||||||||
| 417 | find_shopt (name) | - | ||||||||||||||||||||||||
| 418 | char *name; | - | ||||||||||||||||||||||||
| 419 | { | - | ||||||||||||||||||||||||
| 420 | int i; | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | for (i = 0; shopt_vars[i].name
| 15-8414 | ||||||||||||||||||||||||
| 423 | if (((
| 521-7893 | ||||||||||||||||||||||||
| 424 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
| 230-291 | ||||||||||||||||||||||||
| 425 | name
| 230-291 | ||||||||||||||||||||||||
| 426 | ) && __builtin_constant_p (
| 230-291 | ||||||||||||||||||||||||
| 427 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 428 | ) && (__s1_len = __builtin_strlen (
| 230-291 | ||||||||||||||||||||||||
| 429 | name
| 230-291 | ||||||||||||||||||||||||
| 430 | ), __s2_len = __builtin_strlen (
| 230-291 | ||||||||||||||||||||||||
| 431 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 432 | ), (!((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 433 | name
| 230-291 | ||||||||||||||||||||||||
| 434 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 435 | name
| 230-291 | ||||||||||||||||||||||||
| 436 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 437 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 438 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 439 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 440 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
| 230-291 | ||||||||||||||||||||||||
| 441 | name
| 230-291 | ||||||||||||||||||||||||
| 442 | ,
| 230-291 | ||||||||||||||||||||||||
| 443 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 444 | ) : (__builtin_constant_p (
| 230-291 | ||||||||||||||||||||||||
| 445 | name
| 230-291 | ||||||||||||||||||||||||
| 446 | ) && ((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 447 | name
| 230-291 | ||||||||||||||||||||||||
| 448 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 449 | name
| 230-291 | ||||||||||||||||||||||||
| 450 | ) == 1) && (__s1_len = __builtin_strlen (
| 230-291 | ||||||||||||||||||||||||
| 451 | name
| 230-291 | ||||||||||||||||||||||||
| 452 | ), __s1_len < 4) ? (__builtin_constant_p (
| 230-291 | ||||||||||||||||||||||||
| 453 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 454 | ) && ((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 455 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 456 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 457 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 458 | ) == 1) ? __builtin_strcmp (
| 230-291 | ||||||||||||||||||||||||
| 459 | name
| 230-291 | ||||||||||||||||||||||||
| 460 | ,
| 230-291 | ||||||||||||||||||||||||
| 461 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 462 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 230-291 | ||||||||||||||||||||||||
| 463 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 464 | ); int __result = (((const unsigned char *) (const char *) (
| 230-291 | ||||||||||||||||||||||||
| 465 | name
| 230-291 | ||||||||||||||||||||||||
| 466 | ))[0] - __s2[0]); if (__s1_len > 0
| 0-291 | ||||||||||||||||||||||||
| 467 | name
| 230-291 | ||||||||||||||||||||||||
| 468 | ))[1] - __s2[1]); if (__s1_len > 1
| 0-291 | ||||||||||||||||||||||||
| 469 | name
| 230-291 | ||||||||||||||||||||||||
| 470 | ))[2] - __s2[2]); if (__s1_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( name ))[3] - __s2[3]);
| 0-291 | ||||||||||||||||||||||||
| 471 | name
never executed: __result = (((const unsigned char *) (const char *) ( name ))[3] - __s2[3]); | 0-291 | ||||||||||||||||||||||||
| 472 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( name ))[3] - __s2[3]);never executed: }end of blocknever executed: __result; }))) : (__builtin_constant_p (end of block
| 0-291 | ||||||||||||||||||||||||
| 473 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 474 | ) && ((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 475 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 476 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 477 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 478 | ) == 1) && (__s2_len = __builtin_strlen (
| 230-291 | ||||||||||||||||||||||||
| 479 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 480 | ), __s2_len < 4) ? (__builtin_constant_p (
| 230-291 | ||||||||||||||||||||||||
| 481 | name
| 230-291 | ||||||||||||||||||||||||
| 482 | ) && ((size_t)(const void *)((
| 230-291 | ||||||||||||||||||||||||
| 483 | name
| 230-291 | ||||||||||||||||||||||||
| 484 | ) + 1) - (size_t)(const void *)(
| 230-291 | ||||||||||||||||||||||||
| 485 | name
| 230-291 | ||||||||||||||||||||||||
| 486 | ) == 1) ? __builtin_strcmp (
| 230-291 | ||||||||||||||||||||||||
| 487 | name
| 230-291 | ||||||||||||||||||||||||
| 488 | ,
| 230-291 | ||||||||||||||||||||||||
| 489 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 490 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
| 230-291 | ||||||||||||||||||||||||
| 491 | name
| 230-291 | ||||||||||||||||||||||||
| 492 | ); int __result = (((const unsigned char *) (const char *) (
| 230-291 | ||||||||||||||||||||||||
| 493 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 494 | ))[0] - __s2[0]); if (__s2_len > 0
| 0-291 | ||||||||||||||||||||||||
| 495 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 496 | ))[1] - __s2[1]); if (__s2_len > 1
| 0-291 | ||||||||||||||||||||||||
| 497 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 498 | ))[2] - __s2[2]); if (__s2_len > 2
never executed: __result = (((const unsigned char *) (const char *) ( shopt_vars[i].name ))[3] - __s2[3]);
| 0-291 | ||||||||||||||||||||||||
| 499 | shopt_vars[i].name
never executed: __result = (((const unsigned char *) (const char *) ( shopt_vars[i].name ))[3] - __s2[3]); | 0-291 | ||||||||||||||||||||||||
| 500 | ))[3] - __s2[3]);
never executed: }__result = (((const unsigned char *) (const char *) ( shopt_vars[i].name ))[3] - __s2[3]);never executed: }end of blocknever executed: __result; }))) : __builtin_strcmp (end of block
| 0-291 | ||||||||||||||||||||||||
| 501 | name
| 230-291 | ||||||||||||||||||||||||
| 502 | ,
| 230-291 | ||||||||||||||||||||||||
| 503 | shopt_vars[i].name
| 230-291 | ||||||||||||||||||||||||
| 504 | )))); })
| 230-291 | ||||||||||||||||||||||||
| 505 | == 0
| 230-291 | ||||||||||||||||||||||||
| 506 | return executed 230 times by 1 test: i;return i;Executed by:
executed 230 times by 1 test: return i;Executed by:
| 230 | ||||||||||||||||||||||||
| 507 | return executed 15 times by 1 test: -1;return -1;Executed by:
executed 15 times by 1 test: return -1;Executed by:
| 15 | ||||||||||||||||||||||||
| 508 | } | - | ||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | static void | - | ||||||||||||||||||||||||
| 511 | shopt_error (s) | - | ||||||||||||||||||||||||
| 512 | char *s; | - | ||||||||||||||||||||||||
| 513 | { | - | ||||||||||||||||||||||||
| 514 | builtin_error ( | - | ||||||||||||||||||||||||
| 515 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||
| 516 | "%s: invalid shell option name" | - | ||||||||||||||||||||||||
| 517 | , 5) | - | ||||||||||||||||||||||||
| 518 | , s); | - | ||||||||||||||||||||||||
| 519 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | static int | - | ||||||||||||||||||||||||
| 522 | toggle_shopts (mode, list, quiet) | - | ||||||||||||||||||||||||
| 523 | int mode; | - | ||||||||||||||||||||||||
| 524 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 525 | int quiet; | - | ||||||||||||||||||||||||
| 526 | { | - | ||||||||||||||||||||||||
| 527 | WORD_LIST *l; | - | ||||||||||||||||||||||||
| 528 | int ind, rval; | - | ||||||||||||||||||||||||
| 529 | SHELL_VAR *v; | - | ||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | for (l = list, rval = 0; l
| 224-228 | ||||||||||||||||||||||||
| 532 | { | - | ||||||||||||||||||||||||
| 533 | ind = find_shopt (l->word->word); | - | ||||||||||||||||||||||||
| 534 | if (ind < 0
| 5-223 | ||||||||||||||||||||||||
| 535 | { | - | ||||||||||||||||||||||||
| 536 | shopt_error (l->word->word); | - | ||||||||||||||||||||||||
| 537 | rval = 1; | - | ||||||||||||||||||||||||
| 538 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 539 | else | - | ||||||||||||||||||||||||
| 540 | { | - | ||||||||||||||||||||||||
| 541 | *shopt_vars[ind].value = mode; | - | ||||||||||||||||||||||||
| 542 | if (shopt_vars[ind].set_func
| 25-198 | ||||||||||||||||||||||||
| 543 | (* executed 25 times by 1 test: shopt_vars[ind].set_func) (shopt_vars[ind].name, mode);(*shopt_vars[ind].set_func) (shopt_vars[ind].name, mode);Executed by:
executed 25 times by 1 test: (*shopt_vars[ind].set_func) (shopt_vars[ind].name, mode);Executed by:
| 25 | ||||||||||||||||||||||||
| 544 | } executed 223 times by 1 test: end of blockExecuted by:
| 223 | ||||||||||||||||||||||||
| 545 | } | - | ||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | if (v = find_variable ("BASHOPTS")
| 0-224 | ||||||||||||||||||||||||
| 549 | set_bashopts (); executed 224 times by 1 test: set_bashopts ();Executed by:
| 224 | ||||||||||||||||||||||||
| 550 | return executed 224 times by 1 test: (rval);return (rval);Executed by:
executed 224 times by 1 test: return (rval);Executed by:
| 224 | ||||||||||||||||||||||||
| 551 | } | - | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | static void | - | ||||||||||||||||||||||||
| 554 | print_shopt (name, val, flags) | - | ||||||||||||||||||||||||
| 555 | char *name; | - | ||||||||||||||||||||||||
| 556 | int val, flags; | - | ||||||||||||||||||||||||
| 557 | { | - | ||||||||||||||||||||||||
| 558 | if (flags & 0x10
| 41-105 | ||||||||||||||||||||||||
| 559 | printf ("shopt %s %s\n", val ? "-s" : "-u", name); executed 105 times by 1 test: printf ("shopt %s %s\n", val ? "-s" : "-u", name);Executed by:
| 105 | ||||||||||||||||||||||||
| 560 | else | - | ||||||||||||||||||||||||
| 561 | printf ("%-15s\t%s\n", name, val ? on : off); executed 41 times by 1 test: printf ("%-15s\t%s\n", name, val ? on : off);Executed by:
| 41 | ||||||||||||||||||||||||
| 562 | } | - | ||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | static int | - | ||||||||||||||||||||||||
| 567 | list_shopts (list, flags) | - | ||||||||||||||||||||||||
| 568 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 569 | int flags; | - | ||||||||||||||||||||||||
| 570 | { | - | ||||||||||||||||||||||||
| 571 | WORD_LIST *l; | - | ||||||||||||||||||||||||
| 572 | int i, val, rval; | - | ||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | if (list == 0
| 1-14 | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | for (i = 0; shopt_vars[i].name
| 1-51 | ||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||
| 578 | val = *shopt_vars[i].value; | - | ||||||||||||||||||||||||
| 579 | if ((
| 0-51 | ||||||||||||||||||||||||
| 580 | print_shopt (shopt_vars[i].name, val, flags); executed 51 times by 1 test: print_shopt (shopt_vars[i].name, val, flags);Executed by:
| 51 | ||||||||||||||||||||||||
| 581 | } executed 51 times by 1 test: end of blockExecuted by:
| 51 | ||||||||||||||||||||||||
| 582 | return executed 1 time by 1 test: (sh_chkwrite (0));return (sh_chkwrite (0));Executed by:
executed 1 time by 1 test: return (sh_chkwrite (0));Executed by:
| 1 | ||||||||||||||||||||||||
| 583 | } | - | ||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | for (l = list, rval = 0; l
| 14-17 | ||||||||||||||||||||||||
| 586 | { | - | ||||||||||||||||||||||||
| 587 | i = find_shopt (l->word->word); | - | ||||||||||||||||||||||||
| 588 | if (i < 0
| 7-10 | ||||||||||||||||||||||||
| 589 | { | - | ||||||||||||||||||||||||
| 590 | shopt_error (l->word->word); | - | ||||||||||||||||||||||||
| 591 | rval = 1; | - | ||||||||||||||||||||||||
| 592 | continue; executed 10 times by 1 test: continue;Executed by:
| 10 | ||||||||||||||||||||||||
| 593 | } | - | ||||||||||||||||||||||||
| 594 | val = *shopt_vars[i].value; | - | ||||||||||||||||||||||||
| 595 | if (val == 0
| 2-5 | ||||||||||||||||||||||||
| 596 | rval = 1; executed 5 times by 1 test: rval = 1;Executed by:
| 5 | ||||||||||||||||||||||||
| 597 | if ((
| 3-4 | ||||||||||||||||||||||||
| 598 | print_shopt (l->word->word, val, flags); executed 4 times by 1 test: print_shopt (l->word->word, val, flags);Executed by:
| 4 | ||||||||||||||||||||||||
| 599 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||
| 601 | return executed 14 times by 1 test: (sh_chkwrite (rval));return (sh_chkwrite (rval));Executed by:
executed 14 times by 1 test: return (sh_chkwrite (rval));Executed by:
| 14 | ||||||||||||||||||||||||
| 602 | } | - | ||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | static int | - | ||||||||||||||||||||||||
| 605 | list_some_shopts (mode, flags) | - | ||||||||||||||||||||||||
| 606 | int mode, flags; | - | ||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||
| 608 | int val, i; | - | ||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | for (i = 0; shopt_vars[i].name
| 3-153 | ||||||||||||||||||||||||
| 611 | { | - | ||||||||||||||||||||||||
| 612 | val = *shopt_vars[i].value; | - | ||||||||||||||||||||||||
| 613 | if (((
| 0-153 | ||||||||||||||||||||||||
| 614 | print_shopt (shopt_vars[i].name, val, flags); executed 91 times by 1 test: print_shopt (shopt_vars[i].name, val, flags);Executed by:
| 91 | ||||||||||||||||||||||||
| 615 | } executed 153 times by 1 test: end of blockExecuted by:
| 153 | ||||||||||||||||||||||||
| 616 | return executed 3 times by 1 test: (sh_chkwrite (0));return (sh_chkwrite (0));Executed by:
executed 3 times by 1 test: return (sh_chkwrite (0));Executed by:
| 3 | ||||||||||||||||||||||||
| 617 | } | - | ||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||
| 619 | static int | - | ||||||||||||||||||||||||
| 620 | list_shopt_o_options (list, flags) | - | ||||||||||||||||||||||||
| 621 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 622 | int flags; | - | ||||||||||||||||||||||||
| 623 | { | - | ||||||||||||||||||||||||
| 624 | WORD_LIST *l; | - | ||||||||||||||||||||||||
| 625 | int val, rval; | - | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | if (list == 0
| 1-6 | ||||||||||||||||||||||||
| 628 | { | - | ||||||||||||||||||||||||
| 629 | if ((
| 0-1 | ||||||||||||||||||||||||
| 630 | list_minus_o_opts (-1, (flags & 0x10)); executed 1 time by 1 test: list_minus_o_opts (-1, (flags & 0x10));Executed by:
| 1 | ||||||||||||||||||||||||
| 631 | return executed 1 time by 1 test: (sh_chkwrite (0));return (sh_chkwrite (0));Executed by:
executed 1 time by 1 test: return (sh_chkwrite (0));Executed by:
| 1 | ||||||||||||||||||||||||
| 632 | } | - | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | for (l = list, rval = 0; l
| 6 | ||||||||||||||||||||||||
| 635 | { | - | ||||||||||||||||||||||||
| 636 | val = minus_o_option_value (l->word->word); | - | ||||||||||||||||||||||||
| 637 | if (val == -1
| 1-5 | ||||||||||||||||||||||||
| 638 | { | - | ||||||||||||||||||||||||
| 639 | sh_invalidoptname (l->word->word); | - | ||||||||||||||||||||||||
| 640 | rval = 1; | - | ||||||||||||||||||||||||
| 641 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||||||||
| 642 | } | - | ||||||||||||||||||||||||
| 643 | if (val == 0
| 1-4 | ||||||||||||||||||||||||
| 644 | rval = 1; executed 4 times by 1 test: rval = 1;Executed by:
| 4 | ||||||||||||||||||||||||
| 645 | if ((
| 2-3 | ||||||||||||||||||||||||
| 646 | { | - | ||||||||||||||||||||||||
| 647 | if (flags & 0x10
| 0-2 | ||||||||||||||||||||||||
| 648 | printf ("set %co %s\n", val ? '-' : '+', l->word->word); executed 2 times by 1 test: printf ("set %co %s\n", val ? '-' : '+', l->word->word);Executed by:
| 2 | ||||||||||||||||||||||||
| 649 | else | - | ||||||||||||||||||||||||
| 650 | printf ("%-15s\t%s\n", l->word->word, val ? on : off); never executed: printf ("%-15s\t%s\n", l->word->word, val ? on : off); | 0 | ||||||||||||||||||||||||
| 651 | } | - | ||||||||||||||||||||||||
| 652 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||||||||
| 653 | return executed 6 times by 1 test: (sh_chkwrite (rval));return (sh_chkwrite (rval));Executed by:
executed 6 times by 1 test: return (sh_chkwrite (rval));Executed by:
| 6 | ||||||||||||||||||||||||
| 654 | } | - | ||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | static int | - | ||||||||||||||||||||||||
| 657 | list_some_o_options (mode, flags) | - | ||||||||||||||||||||||||
| 658 | int mode, flags; | - | ||||||||||||||||||||||||
| 659 | { | - | ||||||||||||||||||||||||
| 660 | if ((
| 0-3 | ||||||||||||||||||||||||
| 661 | list_minus_o_opts (mode, (flags & 0x10)); executed 3 times by 1 test: list_minus_o_opts (mode, (flags & 0x10));Executed by:
| 3 | ||||||||||||||||||||||||
| 662 | return executed 3 times by 1 test: (sh_chkwrite (0));return (sh_chkwrite (0));Executed by:
executed 3 times by 1 test: return (sh_chkwrite (0));Executed by:
| 3 | ||||||||||||||||||||||||
| 663 | } | - | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | static int | - | ||||||||||||||||||||||||
| 666 | set_shopt_o_options (mode, list, quiet) | - | ||||||||||||||||||||||||
| 667 | int mode; | - | ||||||||||||||||||||||||
| 668 | WORD_LIST *list; | - | ||||||||||||||||||||||||
| 669 | int quiet; | - | ||||||||||||||||||||||||
| 670 | { | - | ||||||||||||||||||||||||
| 671 | WORD_LIST *l; | - | ||||||||||||||||||||||||
| 672 | int rval; | - | ||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | for (l = list, rval = 0; l
| 3 | ||||||||||||||||||||||||
| 675 | { | - | ||||||||||||||||||||||||
| 676 | if (set_minus_o_option (mode, l->word->word) == 1
| 0-3 | ||||||||||||||||||||||||
| 677 | rval = 1; never executed: rval = 1; | 0 | ||||||||||||||||||||||||
| 678 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 679 | set_shellopts (); | - | ||||||||||||||||||||||||
| 680 | return executed 3 times by 1 test: rval;return rval;Executed by:
executed 3 times by 1 test: return rval;Executed by:
| 3 | ||||||||||||||||||||||||
| 681 | } | - | ||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | static int | - | ||||||||||||||||||||||||
| 686 | set_shellopts_after_change (option_name, mode) | - | ||||||||||||||||||||||||
| 687 | char *option_name; | - | ||||||||||||||||||||||||
| 688 | int mode; | - | ||||||||||||||||||||||||
| 689 | { | - | ||||||||||||||||||||||||
| 690 | set_shellopts (); | - | ||||||||||||||||||||||||
| 691 | return executed 1 time by 1 test: (0);return (0);Executed by:
executed 1 time by 1 test: return (0);Executed by:
| 1 | ||||||||||||||||||||||||
| 692 | } | - | ||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | static int | - | ||||||||||||||||||||||||
| 695 | shopt_set_debug_mode (option_name, mode) | - | ||||||||||||||||||||||||
| 696 | char *option_name; | - | ||||||||||||||||||||||||
| 697 | int mode; | - | ||||||||||||||||||||||||
| 698 | { | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | error_trace_mode = function_trace_mode = debugging_mode; | - | ||||||||||||||||||||||||
| 701 | set_shellopts (); | - | ||||||||||||||||||||||||
| 702 | if (debugging_mode
| 0-21 | ||||||||||||||||||||||||
| 703 | init_bash_argv (); executed 21 times by 1 test: init_bash_argv ();Executed by:
| 21 | ||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||
| 705 | return executed 21 times by 1 test: (0);return (0);Executed by:
executed 21 times by 1 test: return (0);Executed by:
| 21 | ||||||||||||||||||||||||
| 706 | } | - | ||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | static int | - | ||||||||||||||||||||||||
| 710 | shopt_enable_hostname_completion (option_name, mode) | - | ||||||||||||||||||||||||
| 711 | char *option_name; | - | ||||||||||||||||||||||||
| 712 | int mode; | - | ||||||||||||||||||||||||
| 713 | { | - | ||||||||||||||||||||||||
| 714 | return executed 3 times by 1 test: (enable_hostname_completion (mode));return (enable_hostname_completion (mode));Executed by:
executed 3 times by 1 test: return (enable_hostname_completion (mode));Executed by:
| 3 | ||||||||||||||||||||||||
| 715 | } | - | ||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | static int | - | ||||||||||||||||||||||||
| 719 | set_compatibility_level (option_name, mode) | - | ||||||||||||||||||||||||
| 720 | char *option_name; | - | ||||||||||||||||||||||||
| 721 | int mode; | - | ||||||||||||||||||||||||
| 722 | { | - | ||||||||||||||||||||||||
| 723 | int ind; | - | ||||||||||||||||||||||||
| 724 | char *rhs; | - | ||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | if (mode
| 0 | ||||||||||||||||||||||||
| 730 | { | - | ||||||||||||||||||||||||
| 731 | shopt_compat31 = shopt_compat32 = 0; | - | ||||||||||||||||||||||||
| 732 | shopt_compat40 = shopt_compat41 = shopt_compat42 = shopt_compat43 = 0; | - | ||||||||||||||||||||||||
| 733 | shopt_compat44 = 0; | - | ||||||||||||||||||||||||
| 734 | ind = find_shopt (option_name); | - | ||||||||||||||||||||||||
| 735 | *shopt_vars[ind].value = mode; | - | ||||||||||||||||||||||||
| 736 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 737 | - | |||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | if (shopt_compat31
| 0 | ||||||||||||||||||||||||
| 740 | shell_compatibility_level = 31; never executed: shell_compatibility_level = 31; | 0 | ||||||||||||||||||||||||
| 741 | else if (shopt_compat32
| 0 | ||||||||||||||||||||||||
| 742 | shell_compatibility_level = 32; never executed: shell_compatibility_level = 32; | 0 | ||||||||||||||||||||||||
| 743 | else if (shopt_compat40
| 0 | ||||||||||||||||||||||||
| 744 | shell_compatibility_level = 40; never executed: shell_compatibility_level = 40; | 0 | ||||||||||||||||||||||||
| 745 | else if (shopt_compat41
| 0 | ||||||||||||||||||||||||
| 746 | shell_compatibility_level = 41; never executed: shell_compatibility_level = 41; | 0 | ||||||||||||||||||||||||
| 747 | else if (shopt_compat42
| 0 | ||||||||||||||||||||||||
| 748 | shell_compatibility_level = 42; never executed: shell_compatibility_level = 42; | 0 | ||||||||||||||||||||||||
| 749 | else if (shopt_compat43
| 0 | ||||||||||||||||||||||||
| 750 | shell_compatibility_level = 43; never executed: shell_compatibility_level = 43; | 0 | ||||||||||||||||||||||||
| 751 | else if (shopt_compat44
| 0 | ||||||||||||||||||||||||
| 752 | shell_compatibility_level = 44; never executed: shell_compatibility_level = 44; | 0 | ||||||||||||||||||||||||
| 753 | else | - | ||||||||||||||||||||||||
| 754 | shell_compatibility_level = 50; never executed: shell_compatibility_level = 50; | 0 | ||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||
| 757 | rhs = itos (shell_compatibility_level); | - | ||||||||||||||||||||||||
| 758 | bind_variable ("BASH_COMPAT", rhs, 0); | - | ||||||||||||||||||||||||
| 759 | sh_xfree((rhs), "./shopt.def", 644); | - | ||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 762 | } | - | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | void | - | ||||||||||||||||||||||||
| 767 | set_compatibility_opts () | - | ||||||||||||||||||||||||
| 768 | { | - | ||||||||||||||||||||||||
| 769 | shopt_compat31 = shopt_compat32 = 0; | - | ||||||||||||||||||||||||
| 770 | shopt_compat40 = shopt_compat41 = shopt_compat42 = shopt_compat43 = 0; | - | ||||||||||||||||||||||||
| 771 | shopt_compat44 = 0; | - | ||||||||||||||||||||||||
| 772 | switch (shell_compatibility_level) | - | ||||||||||||||||||||||||
| 773 | { | - | ||||||||||||||||||||||||
| 774 | case executed 5447 times by 1 test: 50:case 50:Executed by:
executed 5447 times by 1 test: case 50:Executed by:
| 5447 | ||||||||||||||||||||||||
| 775 | break; executed 5447 times by 1 test: break;Executed by:
| 5447 | ||||||||||||||||||||||||
| 776 | case never executed: 44:case 44:never executed: case 44: | 0 | ||||||||||||||||||||||||
| 777 | shopt_compat44 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 778 | case never executed: 43:case 43:never executed: case 43: | 0 | ||||||||||||||||||||||||
| 779 | shopt_compat43 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 780 | case never executed: 42:case 42:never executed: case 42: | 0 | ||||||||||||||||||||||||
| 781 | shopt_compat42 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 782 | case never executed: 41:case 41:never executed: case 41: | 0 | ||||||||||||||||||||||||
| 783 | shopt_compat41 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 784 | case never executed: 40:case 40:never executed: case 40: | 0 | ||||||||||||||||||||||||
| 785 | shopt_compat40 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 786 | case never executed: 32:case 32:never executed: case 32: | 0 | ||||||||||||||||||||||||
| 787 | shopt_compat32 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 788 | case never executed: 31:case 31:never executed: case 31: | 0 | ||||||||||||||||||||||||
| 789 | shopt_compat31 = 1; break; never executed: break; | 0 | ||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||
| 791 | } executed 5447 times by 1 test: end of blockExecuted by:
| 5447 | ||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | static int | - | ||||||||||||||||||||||||
| 795 | shopt_set_complete_direxpand (option_name, mode) | - | ||||||||||||||||||||||||
| 796 | char *option_name; | - | ||||||||||||||||||||||||
| 797 | int mode; | - | ||||||||||||||||||||||||
| 798 | { | - | ||||||||||||||||||||||||
| 799 | set_directory_hook (); | - | ||||||||||||||||||||||||
| 800 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 801 | } | - | ||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | - | |||||||||||||||||||||||||
| 807 | static int | - | ||||||||||||||||||||||||
| 808 | set_restricted_shell (option_name, mode) | - | ||||||||||||||||||||||||
| 809 | char *option_name; | - | ||||||||||||||||||||||||
| 810 | int mode; | - | ||||||||||||||||||||||||
| 811 | { | - | ||||||||||||||||||||||||
| 812 | static int save_restricted = -1; | - | ||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||
| 814 | if (save_restricted == -1
| 0 | ||||||||||||||||||||||||
| 815 | save_restricted = shell_is_restricted (shell_name); never executed: save_restricted = shell_is_restricted (shell_name); | 0 | ||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||
| 817 | restricted_shell = save_restricted; | - | ||||||||||||||||||||||||
| 818 | return never executed: (0);return (0);never executed: return (0); | 0 | ||||||||||||||||||||||||
| 819 | } | - | ||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | int | - | ||||||||||||||||||||||||
| 824 | set_login_shell (option_name, mode) | - | ||||||||||||||||||||||||
| 825 | char *option_name; | - | ||||||||||||||||||||||||
| 826 | int mode; | - | ||||||||||||||||||||||||
| 827 | { | - | ||||||||||||||||||||||||
| 828 | shopt_login_shell = login_shell != 0; | - | ||||||||||||||||||||||||
| 829 | return executed 5447 times by 1 test: (0);return (0);Executed by:
executed 5447 times by 1 test: return (0);Executed by:
| 5447 | ||||||||||||||||||||||||
| 830 | } | - | ||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | char ** | - | ||||||||||||||||||||||||
| 833 | get_shopt_options () | - | ||||||||||||||||||||||||
| 834 | { | - | ||||||||||||||||||||||||
| 835 | char **ret; | - | ||||||||||||||||||||||||
| 836 | int n, i; | - | ||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | n = sizeof (shopt_vars) / sizeof (shopt_vars[0]); | - | ||||||||||||||||||||||||
| 839 | ret = strvec_create (n + 1); | - | ||||||||||||||||||||||||
| 840 | for (i = 0; shopt_vars[i].name
| 0 | ||||||||||||||||||||||||
| 841 | ret[i] = (char *)strcpy (sh_xmalloc((1 + strlen (shopt_vars[i].name)), "./shopt.def", 726), (shopt_vars[i].name)); never executed: ret[i] = (char *)strcpy (sh_xmalloc((1 + strlen (shopt_vars[i].name)), "./shopt.def", 726), (shopt_vars[i].name)); | 0 | ||||||||||||||||||||||||
| 842 | ret[i] = (char *) | - | ||||||||||||||||||||||||
| 843 | ((void *)0) | - | ||||||||||||||||||||||||
| 844 | ; | - | ||||||||||||||||||||||||
| 845 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 846 | } | - | ||||||||||||||||||||||||
| 847 | - | |||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||
| 853 | int | - | ||||||||||||||||||||||||
| 854 | shopt_setopt (name, mode) | - | ||||||||||||||||||||||||
| 855 | char *name; | - | ||||||||||||||||||||||||
| 856 | int mode; | - | ||||||||||||||||||||||||
| 857 | { | - | ||||||||||||||||||||||||
| 858 | WORD_LIST *wl; | - | ||||||||||||||||||||||||
| 859 | int r; | - | ||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | wl = make_word_list (make_word(name), ((WORD_LIST *) | - | ||||||||||||||||||||||||
| 862 | ((void *)0) | - | ||||||||||||||||||||||||
| 863 | )); | - | ||||||||||||||||||||||||
| 864 | r = toggle_shopts (mode, wl, 0); | - | ||||||||||||||||||||||||
| 865 | dispose_words (wl); | - | ||||||||||||||||||||||||
| 866 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||||||||
| 867 | } | - | ||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||
| 869 | int | - | ||||||||||||||||||||||||
| 870 | shopt_listopt (name, reusable) | - | ||||||||||||||||||||||||
| 871 | char *name; | - | ||||||||||||||||||||||||
| 872 | int reusable; | - | ||||||||||||||||||||||||
| 873 | { | - | ||||||||||||||||||||||||
| 874 | int i; | - | ||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||
| 876 | if (name == 0
| 0 | ||||||||||||||||||||||||
| 877 | return never executed: (list_shopts ((WORD_LIST *)return (list_shopts ((WORD_LIST *) ((void *)0) , reusable ? 0x10 : 0));never executed: return (list_shopts ((WORD_LIST *) ((void *)0) , reusable ? 0x10 : 0)); | 0 | ||||||||||||||||||||||||
| 878 | ((void *)0) never executed: return (list_shopts ((WORD_LIST *) ((void *)0) , reusable ? 0x10 : 0)); | 0 | ||||||||||||||||||||||||
| 879 | , reusable ? 0x10 : 0)); never executed: return (list_shopts ((WORD_LIST *) ((void *)0) , reusable ? 0x10 : 0)); | 0 | ||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | i = find_shopt (name); | - | ||||||||||||||||||||||||
| 882 | if (i < 0
| 0 | ||||||||||||||||||||||||
| 883 | { | - | ||||||||||||||||||||||||
| 884 | shopt_error (name); | - | ||||||||||||||||||||||||
| 885 | return never executed: (1);return (1);never executed: return (1); | 0 | ||||||||||||||||||||||||
| 886 | } | - | ||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | print_shopt (name, *shopt_vars[i].value, reusable ? 0x10 : 0); | - | ||||||||||||||||||||||||
| 889 | return never executed: (sh_chkwrite (0));return (sh_chkwrite (0));never executed: return (sh_chkwrite (0)); | 0 | ||||||||||||||||||||||||
| 890 | } | - | ||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | void | - | ||||||||||||||||||||||||
| 893 | set_bashopts () | - | ||||||||||||||||||||||||
| 894 | { | - | ||||||||||||||||||||||||
| 895 | char *value; | - | ||||||||||||||||||||||||
| 896 | char tflag[(sizeof (shopt_vars) / sizeof (shopt_vars[0]))]; | - | ||||||||||||||||||||||||
| 897 | int vsize, i, vptr, *ip, exported; | - | ||||||||||||||||||||||||
| 898 | SHELL_VAR *v; | - | ||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||
| 900 | for (vsize = i = 0; shopt_vars[i].name
| 5671-289221 | ||||||||||||||||||||||||
| 901 | { | - | ||||||||||||||||||||||||
| 902 | tflag[i] = 0; | - | ||||||||||||||||||||||||
| 903 | if ((*
| 51361-237860 | ||||||||||||||||||||||||
| 904 | { | - | ||||||||||||||||||||||||
| 905 | vsize += strlen (shopt_vars[i].name) + 1; | - | ||||||||||||||||||||||||
| 906 | tflag[i] = 1; | - | ||||||||||||||||||||||||
| 907 | } executed 51361 times by 1 test: end of blockExecuted by:
| 51361 | ||||||||||||||||||||||||
| 908 | } executed 289221 times by 1 test: end of blockExecuted by:
| 289221 | ||||||||||||||||||||||||
| 909 | - | |||||||||||||||||||||||||
| 910 | value = (char *)sh_xmalloc((vsize + 1), "./shopt.def", 789); | - | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | for (i = vptr = 0; shopt_vars[i].name
| 5671-289221 | ||||||||||||||||||||||||
| 913 | { | - | ||||||||||||||||||||||||
| 914 | if (tflag[i]
| 51361-237860 | ||||||||||||||||||||||||
| 915 | { | - | ||||||||||||||||||||||||
| 916 | strcpy (value + vptr, shopt_vars[i].name); | - | ||||||||||||||||||||||||
| 917 | vptr += strlen (shopt_vars[i].name); | - | ||||||||||||||||||||||||
| 918 | value[vptr++] = ':'; | - | ||||||||||||||||||||||||
| 919 | } executed 51361 times by 1 test: end of blockExecuted by:
| 51361 | ||||||||||||||||||||||||
| 920 | } executed 289221 times by 1 test: end of blockExecuted by:
| 289221 | ||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||
| 922 | if (vptr
| 0-5671 | ||||||||||||||||||||||||
| 923 | vptr--; executed 5671 times by 1 test: vptr--;Executed by:
| 5671 | ||||||||||||||||||||||||
| 924 | value[vptr] = '\0'; | - | ||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | v = find_variable ("BASHOPTS"); | - | ||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||
| 930 | if (v
| 224-5447 | ||||||||||||||||||||||||
| 931 | { | - | ||||||||||||||||||||||||
| 932 | ((v)->attributes &= ~(0x0000002)); | - | ||||||||||||||||||||||||
| 933 | exported = ((((v)->attributes) & (0x0000001))); | - | ||||||||||||||||||||||||
| 934 | } executed 224 times by 1 test: end of blockExecuted by:
| 224 | ||||||||||||||||||||||||
| 935 | else | - | ||||||||||||||||||||||||
| 936 | exported = 0; executed 5447 times by 1 test: exported = 0;Executed by:
| 5447 | ||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | v = bind_variable ("BASHOPTS", value, 0); | - | ||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||
| 943 | ((v)->attributes |= (0x0000002)); | - | ||||||||||||||||||||||||
| 944 | if (mark_modified_vars
| 0-5671 | ||||||||||||||||||||||||
| 945 | (( never executed: v)->attributes &= ~(0x0000001));((v)->attributes &= ~(0x0000001));never executed: ((v)->attributes &= ~(0x0000001)); | 0 | ||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||
| 947 | sh_xfree((value), "./shopt.def", 826); | - | ||||||||||||||||||||||||
| 948 | } executed 5671 times by 1 test: end of blockExecuted by:
| 5671 | ||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||
| 950 | void | - | ||||||||||||||||||||||||
| 951 | parse_bashopts (value) | - | ||||||||||||||||||||||||
| 952 | char *value; | - | ||||||||||||||||||||||||
| 953 | { | - | ||||||||||||||||||||||||
| 954 | char *vname; | - | ||||||||||||||||||||||||
| 955 | int vptr, ind; | - | ||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | vptr = 0; | - | ||||||||||||||||||||||||
| 958 | while (vname = extract_colon_unit (value, &vptr)
| 0 | ||||||||||||||||||||||||
| 959 | { | - | ||||||||||||||||||||||||
| 960 | ind = find_shopt (vname); | - | ||||||||||||||||||||||||
| 961 | if (ind >= 0
| 0 | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | *shopt_vars[ind].value = 1; | - | ||||||||||||||||||||||||
| 964 | if (shopt_vars[ind].set_func
| 0 | ||||||||||||||||||||||||
| 965 | (* never executed: shopt_vars[ind].set_func) (shopt_vars[ind].name, 1);(*shopt_vars[ind].set_func) (shopt_vars[ind].name, 1);never executed: (*shopt_vars[ind].set_func) (shopt_vars[ind].name, 1); | 0 | ||||||||||||||||||||||||
| 966 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 967 | sh_xfree((vname), "./shopt.def", 846); | - | ||||||||||||||||||||||||
| 968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 969 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||
| 971 | void | - | ||||||||||||||||||||||||
| 972 | initialize_bashopts (no_bashopts) | - | ||||||||||||||||||||||||
| 973 | int no_bashopts; | - | ||||||||||||||||||||||||
| 974 | { | - | ||||||||||||||||||||||||
| 975 | char *temp; | - | ||||||||||||||||||||||||
| 976 | SHELL_VAR *var; | - | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | if (no_bashopts == 0
| 0-5447 | ||||||||||||||||||||||||
| 979 | { | - | ||||||||||||||||||||||||
| 980 | var = find_variable ("BASHOPTS"); | - | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | if (var
| 0-5447 | ||||||||||||||||||||||||
| 983 | { | - | ||||||||||||||||||||||||
| 984 | temp = (((((
| 0 | ||||||||||||||||||||||||
| 985 | ((void *)0) | - | ||||||||||||||||||||||||
| 986 | : (char *)strcpy (sh_xmalloc((1 + strlen (((var)->value))), "./shopt.def", 863), (((var)->value))); | - | ||||||||||||||||||||||||
| 987 | if (temp
| 0 | ||||||||||||||||||||||||
| 988 | { | - | ||||||||||||||||||||||||
| 989 | parse_bashopts (temp); | - | ||||||||||||||||||||||||
| 990 | sh_xfree((temp), "./shopt.def", 867); | - | ||||||||||||||||||||||||
| 991 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 992 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 993 | } executed 5447 times by 1 test: end of blockExecuted by:
| 5447 | ||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||
| 996 | set_bashopts (); | - | ||||||||||||||||||||||||
| 997 | } executed 5447 times by 1 test: end of blockExecuted by:
| 5447 | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |