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
Martijn Dekker 14a43a0a88 Yet more misc. cleanups; rm SHOPT_PFSH, SHOPT_TYPEDEF
Notable changes:
- Remove SHOPT_PFSH compile-time option and associated code.
  This was meant to work with Solaris rights profiles, see:
  https://docs.oracle.com/cd/E23824_01/html/821-1461/profiles-1.html#REFMAN1profiles-1
  But it has been obsolete for years as Solaris stopped using
  it in its shipped ksh several OS versions ago, preferring a
  library-based wrapper around ksh and other shells.
  Nonetheless I experimented with the option on Solaris 11.4.
  Result: no external command will run; output of unitialised
  memory in error message. So it's already fallen victim to bit
  rot. There's nothing interesting here, so just get rid.
- Remove SHOPT_TYPEDEF compile-time option (but keep the code!).
  Turning it off caused the build to fail. It may be possible to
  fix it, but the type definition code is integral to ksh now (e.g.
  'enum' depends on much of it) so it makes no sense to disable it.
  This was removed in the ksh 93v- beta version as well.
- Remove nv_close() calls and remove nv_close() documentation from
  the nval.3 man page. This function is a dummy, present without
  any changes since the beginning of the ast-open-archive repo in
  1995. The comment was: "Currently this is a dummy, but someday
  will be needed for reference counting". 27 or more years later,
  it's time to admit it's never going to happen. (And of course,
  nv_close() calls were not being used with anything resembling
  consistency.)
- Add a null nv_close() macro to nval.h for compatibility with
  third party code that follows the old documentation.
- Add a few missing regression tests.
2022-02-10 21:04:56 +00:00

69 lines
1.7 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
# 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