1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/cmd/ksh93/features/options
Johnothan King 4c7c5803bd
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.
2021-03-24 20:14:17 +00:00

73 lines
1.8 KiB
Text

# SHOPT_* option probe
tst note{ SHOPT_* option probe }end cross{
: check for shell magic #!
cat > "$EXECROOT/file$$" <<!
#! /usr/bin/env true
exit 1
!
chmod 755 "$EXECROOT/file$$"
if "$EXECROOT/file$$" 2>/dev/null
then echo "#define SHELLMAGIC 1"
fi
rm -f "$EXECROOT/file$$"
option() # name value
{
case $2 in
0) echo "#ifndef SHOPT_$1"
echo "# define SHOPT_$1 1"
echo "#endif"
;;
*) echo "#undef SHOPT_$1"
;;
esac
}
# if /dev/fd/n exposes file descriptor n, make SHOPT_DEVFD use this for
# 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
# deprecated: Solaris disabled SHOPT_PFSH in its build
#test -x /bin/pfexec -o -x /usr/bin/pfexec
#option PFSH $?
# if external 'test' supports lowercase -l as equivalent to -L, enable
# 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
[ $? = 0 ] && option TEST_L 0
rm -f "$EXECROOT/link$$"
# if one of these exists, make SHOPT_SYSRC load /etc/ksh.kshrc by default
if test -f /etc/ksh.kshrc || test -f /etc/bash.bashrc
then option SYSRC 0
fi
}end
cat{
#if !_PACKAGE_ast && ( (MB_LEN_MAX-1)<=0 || !defined(_lib_mbtowc) )
# undef SHOPT_MULTIBYTE
#endif
}end
tst note{ can we probe file system case insensitivity }end output{
#include <ast.h>
#include <error.h>
#include <stdio.h>
static char *o = "SHOPT_GLOBCASEDET";
int main(int argc,char *argv[])
{
int r;
r = pathicase("/");
r = (r > -1 || errno != ENOSYS);
printf("#ifndef %s\n# define %s\t%d\n#endif\n", o, o, r);
return !r;
}
}end