Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 1 | /* flags.c -- Everything about flags except the `set' command. That |
| 2 | is in builtins.c */ |
| 3 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 4 | /* Copyright (C) 1987-2009 Free Software Foundation, Inc. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 5 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 6 | This file is part of GNU Bash, the Bourne Again SHell. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 7 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 8 | Bash is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 12 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 13 | Bash is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 17 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 18 | You should have received a copy of the GNU General Public License |
| 19 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 21 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 22 | #include "config.h" |
| 23 | #if defined (HAVE_UNISTD_H) |
| 24 | # include <unistd.h> |
| 25 | #endif |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 26 | |
| 27 | #include "shell.h" |
| 28 | #include "flags.h" |
| 29 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 30 | #if defined (BANG_HISTORY) |
| 31 | # include "bashhist.h" |
| 32 | #endif |
| 33 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 34 | #if defined (JOB_CONTROL) |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 35 | extern int set_job_control __P((int)); |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 36 | #endif |
| 37 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 38 | #if defined (RESTRICTED_SHELL) |
| 39 | extern char *shell_name; |
| 40 | #endif |
| 41 | |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 42 | extern int shell_initialized; |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 43 | extern int builtin_ignoring_errexit; |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 44 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 45 | /* -c, -s invocation options -- not really flags, but they show up in $- */ |
| 46 | extern int want_pending_command, read_from_stdin; |
| 47 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 48 | /* **************************************************************** */ |
| 49 | /* */ |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 50 | /* The Standard sh Flags. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 51 | /* */ |
| 52 | /* **************************************************************** */ |
| 53 | |
| 54 | /* Non-zero means automatically mark variables which are modified or created |
| 55 | as auto export variables. */ |
| 56 | int mark_modified_vars = 0; |
| 57 | |
| 58 | /* Non-zero causes asynchronous job notification. Otherwise, job state |
| 59 | notification only takes place just before a primary prompt is printed. */ |
| 60 | int asynchronous_notification = 0; |
| 61 | |
| 62 | /* Non-zero means exit immediately if a command exits with a non-zero |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 63 | exit status. The first is what controls set -e; the second is what |
| 64 | bash uses internally. */ |
| 65 | int errexit_flag = 0; |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 66 | int exit_immediately_on_error = 0; |
| 67 | |
| 68 | /* Non-zero means disable filename globbing. */ |
| 69 | int disallow_filename_globbing = 0; |
| 70 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 71 | /* Non-zero means that all keyword arguments are placed into the environment |
| 72 | for a command, not just those that appear on the line before the command |
| 73 | name. */ |
| 74 | int place_keywords_in_env = 0; |
| 75 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 76 | /* Non-zero means read commands, but don't execute them. This is useful |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 77 | for debugging shell scripts that should do something hairy and possibly |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 78 | destructive. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 79 | int read_but_dont_execute = 0; |
| 80 | |
| 81 | /* Non-zero means end of file is after one command. */ |
| 82 | int just_one_command = 0; |
| 83 | |
| 84 | /* Non-zero means don't overwrite existing files while doing redirections. */ |
| 85 | int noclobber = 0; |
| 86 | |
| 87 | /* Non-zero means trying to get the value of $i where $i is undefined |
| 88 | causes an error, instead of a null substitution. */ |
| 89 | int unbound_vars_is_error = 0; |
| 90 | |
| 91 | /* Non-zero means type out input lines after you read them. */ |
| 92 | int echo_input_at_read = 0; |
| 93 | |
| 94 | /* Non-zero means type out the command definition after reading, but |
| 95 | before executing. */ |
| 96 | int echo_command_at_execute = 0; |
| 97 | |
| 98 | /* Non-zero means turn on the job control features. */ |
| 99 | int jobs_m_flag = 0; |
| 100 | |
| 101 | /* Non-zero means this shell is interactive, even if running under a |
| 102 | pipe. */ |
| 103 | int forced_interactive = 0; |
| 104 | |
| 105 | /* By default, follow the symbolic links as if they were real directories |
| 106 | while hacking the `cd' command. This means that `cd ..' moves up in |
| 107 | the string of symbolic links that make up the current directory, instead |
| 108 | of the absolute directory. The shell variable `nolinks' also controls |
| 109 | this flag. */ |
| 110 | int no_symbolic_links = 0; |
| 111 | |
| 112 | /* **************************************************************** */ |
| 113 | /* */ |
| 114 | /* Non-Standard Flags Follow Here. */ |
| 115 | /* */ |
| 116 | /* **************************************************************** */ |
| 117 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 118 | #if 0 |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 119 | /* Non-zero means do lexical scoping in the body of a FOR command. */ |
| 120 | int lexical_scoping = 0; |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 121 | #endif |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 122 | |
| 123 | /* Non-zero means no such thing as invisible variables. */ |
| 124 | int no_invisible_vars = 0; |
| 125 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 126 | /* Non-zero means look up and remember command names in a hash table, */ |
| 127 | int hashing_enabled = 1; |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 128 | |
| 129 | #if defined (BANG_HISTORY) |
| 130 | /* Non-zero means that we are doing history expansion. The default. |
| 131 | This means !22 gets the 22nd line of history. */ |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 132 | # if defined (STRICT_POSIX) |
| 133 | int history_expansion = 0; |
| 134 | # else |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 135 | int history_expansion = 1; |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 136 | # endif |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 137 | #endif /* BANG_HISTORY */ |
| 138 | |
| 139 | /* Non-zero means that we allow comments to appear in interactive commands. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 140 | int interactive_comments = 1; |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 141 | |
| 142 | #if defined (RESTRICTED_SHELL) |
| 143 | /* Non-zero means that this shell is `restricted'. A restricted shell |
| 144 | disallows: changing directories, command or path names containing `/', |
| 145 | unsetting or resetting the values of $PATH and $SHELL, and any type of |
| 146 | output redirection. */ |
Jari Aalto | b72432f | 1999-02-19 17:11:39 +0000 | [diff] [blame] | 147 | int restricted = 0; /* currently restricted */ |
| 148 | int restricted_shell = 0; /* shell was started in restricted mode. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 149 | #endif /* RESTRICTED_SHELL */ |
| 150 | |
| 151 | /* Non-zero means that this shell is running in `privileged' mode. This |
Jari Aalto | e8ce775 | 1997-09-22 20:22:27 +0000 | [diff] [blame] | 152 | is required if the shell is to run setuid. If the `-p' option is |
| 153 | not supplied at startup, and the real and effective uids or gids |
| 154 | differ, disable_priv_mode is called to relinquish setuid status. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 155 | int privileged_mode = 0; |
| 156 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 157 | #if defined (BRACE_EXPANSION) |
| 158 | /* Zero means to disable brace expansion: foo{a,b} -> fooa foob */ |
| 159 | int brace_expansion = 1; |
| 160 | #endif |
| 161 | |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 162 | /* Non-zero means that shell functions inherit the DEBUG trap. */ |
| 163 | int function_trace_mode = 0; |
| 164 | |
| 165 | /* Non-zero means that shell functions inherit the ERR trap. */ |
| 166 | int error_trace_mode = 0; |
| 167 | |
| 168 | /* Non-zero means that the rightmost non-zero exit status in a pipeline |
| 169 | is the exit status of the entire pipeline. If each processes exits |
| 170 | with a 0 status, the status of the pipeline is 0. */ |
| 171 | int pipefail_opt = 0; |
| 172 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 173 | /* **************************************************************** */ |
| 174 | /* */ |
| 175 | /* The Flags ALIST. */ |
| 176 | /* */ |
| 177 | /* **************************************************************** */ |
| 178 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 179 | const struct flags_alist shell_flags[] = { |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 180 | /* Standard sh flags. */ |
| 181 | { 'a', &mark_modified_vars }, |
| 182 | #if defined (JOB_CONTROL) |
| 183 | { 'b', &asynchronous_notification }, |
| 184 | #endif /* JOB_CONTROL */ |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 185 | { 'e', &errexit_flag }, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 186 | { 'f', &disallow_filename_globbing }, |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 187 | { 'h', &hashing_enabled }, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 188 | { 'i', &forced_interactive }, |
| 189 | { 'k', &place_keywords_in_env }, |
| 190 | #if defined (JOB_CONTROL) |
| 191 | { 'm', &jobs_m_flag }, |
| 192 | #endif /* JOB_CONTROL */ |
| 193 | { 'n', &read_but_dont_execute }, |
| 194 | { 'p', &privileged_mode }, |
| 195 | #if defined (RESTRICTED_SHELL) |
| 196 | { 'r', &restricted }, |
| 197 | #endif /* RESTRICTED_SHELL */ |
| 198 | { 't', &just_one_command }, |
| 199 | { 'u', &unbound_vars_is_error }, |
| 200 | { 'v', &echo_input_at_read }, |
| 201 | { 'x', &echo_command_at_execute }, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 202 | |
| 203 | /* New flags that control non-standard things. */ |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 204 | #if 0 |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 205 | { 'l', &lexical_scoping }, |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 206 | #endif |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 207 | #if defined (BRACE_EXPANSION) |
| 208 | { 'B', &brace_expansion }, |
| 209 | #endif |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 210 | { 'C', &noclobber }, |
| 211 | { 'E', &error_trace_mode }, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 212 | #if defined (BANG_HISTORY) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 213 | { 'H', &history_expansion }, |
| 214 | #endif /* BANG_HISTORY */ |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 215 | { 'I', &no_invisible_vars }, |
| 216 | { 'P', &no_symbolic_links }, |
| 217 | { 'T', &function_trace_mode }, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 218 | {0, (int *)NULL} |
| 219 | }; |
| 220 | |
| 221 | #define NUM_SHELL_FLAGS (sizeof (shell_flags) / sizeof (struct flags_alist)) |
| 222 | |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 223 | char optflags[NUM_SHELL_FLAGS+4] = { '+' }; |
| 224 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 225 | int * |
| 226 | find_flag (name) |
| 227 | int name; |
| 228 | { |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 229 | int i; |
| 230 | for (i = 0; shell_flags[i].name; i++) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 231 | { |
| 232 | if (shell_flags[i].name == name) |
| 233 | return (shell_flags[i].value); |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 234 | } |
| 235 | return (FLAG_UNKNOWN); |
| 236 | } |
| 237 | |
| 238 | /* Change the state of a flag, and return it's original value, or return |
Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 239 | FLAG_ERROR if there is no flag FLAG. ON_OR_OFF must be either |
| 240 | FLAG_ON or FLAG_OFF. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 241 | int |
| 242 | change_flag (flag, on_or_off) |
| 243 | int flag; |
| 244 | int on_or_off; |
| 245 | { |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 246 | int *value, old_value; |
| 247 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 248 | #if defined (RESTRICTED_SHELL) |
| 249 | /* Don't allow "set +r" in a shell which is `restricted'. */ |
| 250 | if (restricted && flag == 'r' && on_or_off == FLAG_OFF) |
| 251 | return (FLAG_ERROR); |
| 252 | #endif /* RESTRICTED_SHELL */ |
| 253 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 254 | value = find_flag (flag); |
| 255 | |
Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 256 | if ((value == (int *)FLAG_UNKNOWN) || (on_or_off != FLAG_ON && on_or_off != FLAG_OFF)) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 257 | return (FLAG_ERROR); |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 258 | |
| 259 | old_value = *value; |
Jari Aalto | cce855b | 1998-04-17 19:52:44 +0000 | [diff] [blame] | 260 | *value = (on_or_off == FLAG_ON) ? 1 : 0; |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 261 | |
| 262 | /* Special cases for a few flags. */ |
| 263 | switch (flag) |
| 264 | { |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 265 | #if defined (BANG_HISTORY) |
| 266 | case 'H': |
| 267 | if (on_or_off == FLAG_ON) |
| 268 | bash_initialize_history (); |
| 269 | break; |
| 270 | #endif |
| 271 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 272 | #if defined (JOB_CONTROL) |
| 273 | case 'm': |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 274 | set_job_control (on_or_off == FLAG_ON); |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 275 | break; |
| 276 | #endif /* JOB_CONTROL */ |
| 277 | |
Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 278 | case 'e': |
| 279 | if (builtin_ignoring_errexit == 0) |
| 280 | exit_immediately_on_error = errexit_flag; |
| 281 | break; |
| 282 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 283 | case 'n': |
| 284 | if (interactive_shell) |
| 285 | read_but_dont_execute = 0; |
| 286 | break; |
| 287 | |
| 288 | case 'p': |
| 289 | if (on_or_off == FLAG_OFF) |
| 290 | disable_priv_mode (); |
| 291 | break; |
| 292 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 293 | #if defined (RESTRICTED_SHELL) |
| 294 | case 'r': |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 295 | if (on_or_off == FLAG_ON && shell_initialized) |
Jari Aalto | 28ef6c3 | 2001-04-06 19:14:31 +0000 | [diff] [blame] | 296 | maybe_make_restricted (shell_name); |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 297 | break; |
| 298 | #endif |
| 299 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 300 | } |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 301 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 302 | return (old_value); |
| 303 | } |
| 304 | |
| 305 | /* Return a string which is the names of all the currently |
| 306 | set shell flags. */ |
| 307 | char * |
| 308 | which_set_flags () |
| 309 | { |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 310 | char *temp; |
| 311 | int i, string_index; |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 312 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 313 | temp = (char *)xmalloc (1 + NUM_SHELL_FLAGS + read_from_stdin + want_pending_command); |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 314 | for (i = string_index = 0; shell_flags[i].name; i++) |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 315 | if (*(shell_flags[i].value)) |
| 316 | temp[string_index++] = shell_flags[i].name; |
| 317 | |
Jari Aalto | bb70624 | 2000-03-17 21:46:59 +0000 | [diff] [blame] | 318 | if (want_pending_command) |
| 319 | temp[string_index++] = 'c'; |
| 320 | if (read_from_stdin) |
| 321 | temp[string_index++] = 's'; |
| 322 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 323 | temp[string_index] = '\0'; |
| 324 | return (temp); |
| 325 | } |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 326 | |
| 327 | void |
| 328 | reset_shell_flags () |
| 329 | { |
| 330 | mark_modified_vars = exit_immediately_on_error = disallow_filename_globbing = 0; |
| 331 | place_keywords_in_env = read_but_dont_execute = just_one_command = 0; |
| 332 | noclobber = unbound_vars_is_error = echo_input_at_read = 0; |
| 333 | echo_command_at_execute = jobs_m_flag = forced_interactive = 0; |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 334 | no_symbolic_links = no_invisible_vars = privileged_mode = pipefail_opt = 0; |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 335 | |
| 336 | hashing_enabled = interactive_comments = 1; |
| 337 | |
| 338 | #if defined (JOB_CONTROL) |
| 339 | asynchronous_notification = 0; |
| 340 | #endif |
| 341 | |
| 342 | #if defined (BANG_HISTORY) |
| 343 | history_expansion = 1; |
| 344 | #endif |
| 345 | |
| 346 | #if defined (BRACE_EXPANSION) |
| 347 | brace_expansion = 1; |
| 348 | #endif |
| 349 | |
| 350 | #if defined (RESTRICTED_SHELL) |
| 351 | restricted = 0; |
| 352 | #endif |
| 353 | } |
Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 354 | |
| 355 | void |
| 356 | initialize_flags () |
| 357 | { |
| 358 | register int i; |
| 359 | |
| 360 | for (i = 0; shell_flags[i].name; i++) |
| 361 | optflags[i+1] = shell_flags[i].name; |
| 362 | optflags[++i] = 'o'; |
| 363 | optflags[++i] = ';'; |
| 364 | optflags[i+1] = '\0'; |
| 365 | } |