1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Add NOECHOE and TEST_L to the list of SHOPT options (#242)

src/cmd/ksh93/bltins/print.c:
- Rename the unlisted and misleadingly named SHOPT_ECHOE option
  (which disables, not enables, 'echo -e') to SHOPT_NOECHOE.

src/cmd/ksh93/SHOPT.sh:
- Add the SHOPT_NOECHOE and SHOPT_TEST_L compile time options to
  the list of SHOPT options. Since there is a probe for TEST_L,
  set it to probe (empty) by default. NOECHE is off by default.

src/cmd/ksh93/features/options:
- Small bugfix: Allow SHOPT_TEST_L to be manually enabled on
  systems that don't support '$(whence -p test) -l /foo'.
- Add a comment describing the SHOPT_MULTIBYTE feature test and
  separate it from the SHOPT_DEVFD test.
This commit is contained in:
Johnothan King 2021-03-24 13:14:17 -07:00 committed by GitHub
parent f361d6ed3f
commit 4c7c5803bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View file

@ -25,6 +25,7 @@ SHOPT HISTEXPAND=1 # csh-style history file expansions
SHOPT KIA= # ksh -R <outfile> <script> generates cross-ref database from script
SHOPT MULTIBYTE=1 # multibyte character handling
SHOPT NAMESPACE=1 # allow namespaces
SHOPT NOECHOE=0 # turn off 'echo -e' when SHOPT_ECHOPRINT is disabled
SHOPT OLDTERMIO= # support both TCGETA and TCGETS
SHOPT OPTIMIZE=1 # optimize loop invariants
SHOPT PFSH=0 # solaris exec_attr(4) profile execution (obsolete)
@ -37,6 +38,7 @@ SHOPT SPAWN= # use spawnveg for fork/exec
SHOPT STATS=1 # add .sh.stats variable
SHOPT SUID_EXEC=1 # allow (safe) suid/sgid shell scripts
SHOPT SYSRC= # attempt . /etc/ksh.kshrc if interactive
SHOPT TEST_L= # add 'test -l' as an alias for 'test -L'
SHOPT TIMEOUT= # number of seconds for shell timeout
SHOPT TYPEDEF=1 # enable typeset type definitions
SHOPT VSH=1 # vi edit mode

View file

@ -125,7 +125,7 @@ static char* nullarg[] = { 0, 0 };
{
if(strcmp(argv[1],"-n")==0)
prdata.echon = 1;
#if !SHOPT_ECHOE
#if !SHOPT_NOECHOE
else if(strcmp(argv[1],"-e")==0)
prdata.raw = 0;
else if(strcmp(argv[1],"-ne")==0 || strcmp(argv[1],"-en")==0)
@ -133,7 +133,7 @@ static char* nullarg[] = { 0, 0 };
prdata.raw = 0;
prdata.echon = 1;
}
#endif /* SHOPT_ECHOE */
#endif /* SHOPT_NOECHOE */
else
break;
argv++;

View file

@ -28,6 +28,8 @@ tst note{ SHOPT_* option probe }end cross{
# process substitutions instead of FIFOs, which are not as secure
ls /dev/fd/9 9<&0 >/dev/null 2>&1
option DEVFD $?
# test for multibyte support
case `echo a | tr a '\012' | wc -l` in
*1*) option MULTIBYTE 0 ;;
esac
@ -40,7 +42,7 @@ tst note{ SHOPT_* option probe }end cross{
# SHOPT_TEST_L so ksh supports it for compatibility with local scripts
ln -s /dev/null "$EXECROOT/link$$"
env test -l "$EXECROOT/link$$" 2>/dev/null && env test ! -l . 2>/dev/null
option TEST_L $?
[ $? = 0 ] && option TEST_L 0
rm -f "$EXECROOT/link$$"
# if one of these exists, make SHOPT_SYSRC load /etc/ksh.kshrc by default