mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
-o posix: inverse-sync braceexpand; properly sync letoctal
{Brace,expansion} is potentially incompatible with POSIX scripts,
because in POSIX those are simple literal strings with no special
meaning. So the POSIX option should really turn that off.
As of b301d417
, the 'posix' option was also forcing 'letoctal'
behaviour on, without actually setting that option. I've since
found that to be a botch; 'let' may recognise octals without that
option being set, and that looks like a bug.
So as of this commit, the '-o posix' option actually toggles both
of these options off/on and on/of, respectively. 'set +o posix'
toggles them inversely. However, it is now possible to control both
options (and their associated behaviour) independently in between
'set -o posix' and 'set +o posix'. Much better.
src/cmd/ksh93/sh/main.c: sh_main():
- If SH_POSIX was set on init, turn on SH_LETOCTAL by default
instead of SH_BRACEEXPAND.
src/cmd/ksh93/sh/args.c: sh_applyopts():
- Turn off SH_BRACEEXPAND and turn on SH_LETOCTAL when SH_POSIX is
turned on (but not if it was already on).
- Turn on SH_BRACEEXPAND and turn off SH_LETOCTAL when SH_POSIX is
turned off (but not if it was already off).
src/cmd/ksh93/sh/arith.c: arith():
- Revert to pre-b301d417 and only check SH_LETOCTAL option when
deciding whether 'let' should skip initial zeros.
src/cmd/ksh93/tests/options.sh:
- Update $- test to allow '-o posix' to switch B = braceexpand.
src/cmd/ksh93/sh.1:
- Update.
- Edit for clarity.
This commit is contained in:
parent
dc80f40d40
commit
f45a0f1650
7 changed files with 69 additions and 25 deletions
|
@ -157,8 +157,11 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
|
|||
nv_putval(PS4NOD,e_traceprompt,NV_RDONLY);
|
||||
path_pwd(shp,1);
|
||||
iop = (Sfio_t*)0;
|
||||
if(sh_isoption(SH_POSIX))
|
||||
sh_onoption(SH_LETOCTAL);
|
||||
#if SHOPT_BRACEPAT
|
||||
sh_onoption(SH_BRACEEXPAND);
|
||||
else
|
||||
sh_onoption(SH_BRACEEXPAND);
|
||||
#endif
|
||||
if((beenhere++)==0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue