diff options
author | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
---|---|---|
committer | April Chin <April.Chin@Sun.COM> | 2008-12-27 14:59:38 -0800 |
commit | 7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch) | |
tree | 4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/lib/libshell/common/sh/bash.c | |
parent | 6071ac1de68fed78e1e10052045bbb5f1732a263 (diff) | |
download | illumos-gate-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz |
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1
PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094
6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04
6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25
6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code
6599668 RFE: Move consumers of alias.sh over to ksh93
6595183 *ksh93* RFE: Update ksh93-integration demo code
6775901 *ksh93* no C message catalogs are generated for ksh93
6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values
6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop
6703761 *ksh93* crashes in script containing uncommon output redirections
6715496 *ksh93* SEGVs on array reinitialization
6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell
6672350 *ksh93* causes parent shell to die when child shell is suspended
6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris
6710205 *ksh93* problem with command substitution (within back quotes) containing \$'
6737600 *ksh93* exits debugger when user presses ctrl-c
6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument"
6754020 *ksh93* does weird '[' expansion
6753538 *ksh93* umask modification leaks out of a ksh93 subshell
6766246 *ksh93* bug in pattern matching
6763594 *ksh93* executes command after "command" builtin twice on failure
6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/lib/libshell/common/sh/bash.c')
-rw-r--r-- | usr/src/lib/libshell/common/sh/bash.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/usr/src/lib/libshell/common/sh/bash.c b/usr/src/lib/libshell/common/sh/bash.c index ecb10472b8..4b2def3b22 100644 --- a/usr/src/lib/libshell/common/sh/bash.c +++ b/usr/src/lib/libshell/common/sh/bash.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1982-2007 AT&T Knowledge Ventures * +* Copyright (c) 1982-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -38,8 +38,6 @@ #define BASH_VERSION BASH_MAJOR "." BASH_MINOR "." BASH_PATCH "(" BASH_BUILD ")-" BASH_RELEASE -void sh_applyopts(Shopt_t); - extern const char bash_pre_rc[]; static char *login_files[4]; @@ -50,8 +48,6 @@ const char sh_bash1[] = "[P?Do not follow symbolic links, use physical directory structure " "instead. Only available in bash compatibility mode.]"; const char sh_bash2[] = -"[l:login?Make the shell act as if it had been invoked as a login shell. " -"Only available if invoked as \bbash\b.]" "[O]:?[shopt_option?\ashopt_option\a is one of the shell options accepted by " "the \bshopt\b builtin. If \ashopt_option\a is present, \b-O\b sets " "the value of that option; \b+O\b unsets it. If \ashopt_option\a is " @@ -66,12 +62,9 @@ const char sh_bash2[] = "[03:profile?Read either the system-wide startup file or any of the " "personal initialization files. On by default for interactive " "shells. Only available if invoked as \bbash\b.]" -"[04:rc?Read and execute the personal initialization file " - "\b$HOME/.bashrc\b. On by default for interactive shells. Only " - "available if invoked as \bbash\b.]" -"[05:posix?If invoked as \bbash\b, turn on POSIX compatibility. \bBash\b in " +"[04:posix?If invoked as \bbash\b, turn on POSIX compatibility. \bBash\b in " "POSIX mode is not the same as \bksh\b.]" -"[06:version?Print version number and exit.]"; +"[05:version?Print version number and exit.]"; const char sh_optshopt[] = "+[-1c?\n@(#)$Id: shopt (AT&T Research) 2003-02-13 $\n]" @@ -293,7 +286,7 @@ int b_shopt(int argc,register char *argv[],void *extra) else if(setflag&SET_UNSET) for(n=0;n<4;n++) newflags.v[n] &= ~opt.v[n]; - sh_applyopts(newflags); + sh_applyopts(shp,newflags); shp->options = newflags; if(is_option(&newflags,SH_XTRACE)) sh_trace(argv,1); @@ -317,6 +310,7 @@ int b_shopt(int argc,register char *argv[],void *extra) void bash_init(int mode) { + Shell_t *shp = &sh; Sfio_t *iop; Namval_t *np; int n=0,xtrace,verbose; @@ -326,7 +320,7 @@ void bash_init(int mode) { /* termination code */ if(sh_isoption(SH_LOGIN_SHELL) && !sh_isoption(SH_POSIX)) - sh_source(&sh, NiL, sh_mactry((char*)e_bash_logout)); + sh_source(shp, NiL, sh_mactry(shp,(char*)e_bash_logout)); return; } @@ -341,7 +335,7 @@ void bash_init(int mode) sh_onoption(SH_CMDHIST); sh_onoption(SH_LITHIST); sh_onoption(SH_NOEMPTYCMDCOMPL); - if(sh.login_sh==2) + if(shp->login_sh==2) sh_onoption(SH_LOGIN_SHELL); if(strcmp(astconf("CONFORMANCE",0,0),"standard")==0) sh_onoption(SH_POSIX); @@ -360,13 +354,13 @@ void bash_init(int mode) /* set up some variables needed for --version * needs to go here because --version option is parsed before the init script. */ - if(np=nv_open("HOSTTYPE",sh.var_tree,0)) + if(np=nv_open("HOSTTYPE",shp->var_tree,0)) nv_putval(np, BASH_HOSTTYPE, NV_NOFREE); - if(np=nv_open("MACHTYPE",sh.var_tree,0)) + if(np=nv_open("MACHTYPE",shp->var_tree,0)) nv_putval(np, BASH_MACHTYPE, NV_NOFREE); - if(np=nv_open("BASH_VERSION",sh.var_tree,0)) + if(np=nv_open("BASH_VERSION",shp->var_tree,0)) nv_putval(np, BASH_VERSION, NV_NOFREE); - if(np=nv_open("BASH_VERSINFO",sh.var_tree,0)) + if(np=nv_open("BASH_VERSINFO",shp->var_tree,0)) { char *argv[7]; argv[0] = BASH_MAJOR; @@ -385,7 +379,7 @@ void bash_init(int mode) /* rest of init stage */ /* restrict BASH_ENV */ - if(np=nv_open("BASH_ENV",sh.var_tree,0)) + if(np=nv_open("BASH_ENV",shp->var_tree,0)) { const Namdisc_t *dp = nv_discfun(NV_DCRESTRICT); Namfun_t *fp = calloc(dp->dsize,1); @@ -394,7 +388,7 @@ void bash_init(int mode) } /* open GLOBIGNORE node */ - if(np=nv_open("GLOBIGNORE",sh.var_tree,0)) + if(np=nv_open("GLOBIGNORE",shp->var_tree,0)) { const Namdisc_t *dp = &SH_GLOBIGNORE_disc; Namfun_t *fp = calloc(dp->dsize,1); @@ -404,7 +398,7 @@ void bash_init(int mode) /* set startup files */ n=0; - if(!sh_isoption(SH_NOPROFILE)) + if(sh_isoption(SH_LOGIN_SHELL)) { if(!sh_isoption(SH_POSIX)) { @@ -413,13 +407,13 @@ void bash_init(int mode) } login_files[n++] = (char*)e_profile; } - sh.login_files = login_files; + shp->login_files = login_files; reinit: xtrace = sh_isoption(SH_XTRACE); sh_offoption(SH_XTRACE); verbose = sh_isoption(SH_VERBOSE); sh_offoption(SH_VERBOSE); - if(np = nv_open("SHELLOPTS", sh.var_tree, NV_NOADD)) + if(np = nv_open("SHELLOPTS", shp->var_tree, NV_NOADD)) nv_offattr(np,NV_RDONLY); iop = sfopen(NULL, bash_pre_rc, "s"); sh_eval(iop,0); |