diff options
-rw-r--r-- | shell/ash.c | 4 | ||||
-rw-r--r-- | shell/shell_common.c | 1 | ||||
-rw-r--r-- | shell/shell_common.h | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 9fd1b55e2..a7c03bbc2 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -1919,7 +1919,7 @@ static const struct { | |||
1919 | { VSTRFIXED|VTEXTFIXED , "PS2=> " , NULL }, | 1919 | { VSTRFIXED|VTEXTFIXED , "PS2=> " , NULL }, |
1920 | { VSTRFIXED|VTEXTFIXED , "PS4=+ " , NULL }, | 1920 | { VSTRFIXED|VTEXTFIXED , "PS4=+ " , NULL }, |
1921 | #if ENABLE_ASH_GETOPTS | 1921 | #if ENABLE_ASH_GETOPTS |
1922 | { VSTRFIXED|VTEXTFIXED , "OPTIND=1" , getoptsreset }, | 1922 | { VSTRFIXED|VTEXTFIXED , defoptindvar, getoptsreset }, |
1923 | #endif | 1923 | #endif |
1924 | #if ENABLE_ASH_RANDOM_SUPPORT | 1924 | #if ENABLE_ASH_RANDOM_SUPPORT |
1925 | { VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM", change_random }, | 1925 | { VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM", change_random }, |
@@ -13124,6 +13124,8 @@ init(void) | |||
13124 | } | 13124 | } |
13125 | } | 13125 | } |
13126 | 13126 | ||
13127 | setvareq((char*)defoptindvar, VTEXTFIXED); | ||
13128 | |||
13127 | setvar0("PPID", utoa(getppid())); | 13129 | setvar0("PPID", utoa(getppid())); |
13128 | #if ENABLE_ASH_BASH_COMPAT | 13130 | #if ENABLE_ASH_BASH_COMPAT |
13129 | p = lookupvar("SHLVL"); | 13131 | p = lookupvar("SHLVL"); |
diff --git a/shell/shell_common.c b/shell/shell_common.c index 14eeaafcc..98d862744 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <sys/resource.h> /* getrlimit */ | 21 | #include <sys/resource.h> /* getrlimit */ |
22 | 22 | ||
23 | const char defifsvar[] ALIGN1 = "IFS= \t\n"; | 23 | const char defifsvar[] ALIGN1 = "IFS= \t\n"; |
24 | const char defoptindvar[] ALIGN1 = "OPTIND=1"; | ||
24 | 25 | ||
25 | 26 | ||
26 | int FAST_FUNC is_well_formed_var_name(const char *s, char terminator) | 27 | int FAST_FUNC is_well_formed_var_name(const char *s, char terminator) |
diff --git a/shell/shell_common.h b/shell/shell_common.h index 993ed5951..a82535c86 100644 --- a/shell/shell_common.h +++ b/shell/shell_common.h | |||
@@ -24,6 +24,8 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | |||
24 | extern const char defifsvar[] ALIGN1; /* "IFS= \t\n" */ | 24 | extern const char defifsvar[] ALIGN1; /* "IFS= \t\n" */ |
25 | #define defifs (defifsvar + 4) | 25 | #define defifs (defifsvar + 4) |
26 | 26 | ||
27 | extern const char defoptindvar[] ALIGN1; /* "OPTIND=1" */ | ||
28 | |||
27 | int FAST_FUNC is_well_formed_var_name(const char *s, char terminator); | 29 | int FAST_FUNC is_well_formed_var_name(const char *s, char terminator); |
28 | 30 | ||
29 | /* Builtins */ | 31 | /* Builtins */ |