Patch from current ksh93 maintainer <https://github.com/ksh93/ksh>. cde/programs/dtksh/ksh93/**: - Upgraded. A load of bugs fixed, some minor features added. See NEWS from 2021-02-01 upwards. cde/programs/dtksh/Makefile.am: - Don't cd into ksh93 any more to invoke the package or shtests scripts; they now automatically find their directories. - Pass $(CFLAGS) to build ksh with optimisation. - Remove -D_std_malloc flag as vmalloc is now deprecated and disabled by default. - Add a 'make check' target to Makefile.am that runs the ksh93 regression tests on dtksh to make sure the additions don't interfere with anything. It skips running the tests with shcomp because CDE doesn't use that. The tests all pass here on Slackware 14.2. :-) cde/programs/dtksh/init.patch: - Removed; I've upstreamed it. It was the only one that wasn't upstreamed yet, and more code cleanups are coming, breaking downstream patches. If something needs updating, just email me a diff. cde/programs/dtksh/dtkcmds.h: - Update the ADDBUILTIN macro to remove the __PROTO__ macro use. The proto(1) tool, responsible for all such pre-C89 K&R C compatibility voodoo, has been removed, so that macro is no longer defined. cde/programs/dtksh/setup.sh: - Workaround script removed. I rewrote 'bin/package flat make' in a way that works correctly and changed Makefile.am to use that instead. Hope this helps. Happy new year.
31 lines
989 B
Bash
Executable File
31 lines
989 B
Bash
Executable File
#!/usr/bin/env sh
|
|
IFS=''; set -fCu # safe mode: no split/glob = no quoting headaches
|
|
CCn='
|
|
' # newline
|
|
let() { return $((!($1))); }
|
|
|
|
# Remove unused variable definitions from a Mamfile.
|
|
# Usage: Mamfile_rm_unused_vars <Mamfile >Mamfile.new
|
|
#
|
|
# Should work on all current POSIX compliant shells.
|
|
# By Martijn Dekker <martijn@inlv.org>, 2021. Public domain.
|
|
#
|
|
# All variables are declared with 'setv' and they are used if an expansion
|
|
# of the form ${varname} exists (the braces are mandatory in Mamfiles).
|
|
|
|
mamfile=$(let $# && cat "$1" || cat)
|
|
vars=$(printf '%s\n' $mamfile | awk '$1 == "setv" { print $2; }')
|
|
rm_unused_ere=
|
|
IFS=$CCn; for varname in $vars; do IFS=
|
|
case $mamfile in
|
|
*"\${$varname}"* )
|
|
;;
|
|
* ) # add with '|' separator for Extended Regular Expression
|
|
rm_unused_ere="${rm_unused_ere:+$rm_unused_ere|}setv[[:blank:]]+$varname([[:blank:]]|$)" ;;
|
|
esac
|
|
done
|
|
case $rm_unused_ere in
|
|
'') printf '%s\n' $mamfile ;;
|
|
*) printf '%s\n' $mamfile | grep -vE $rm_unused_ere ;;
|
|
esac
|