From 1ae6988bb6f0c1f374da877df55ea33f4d16b6b5 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 26 Oct 2022 17:31:33 +0200 Subject: [PATCH] INIT: remove unused 'filter' utility I could not even find any use of it in the ast-open-archive repo which has the complete AST code. --- src/cmd/INIT/Mamfile | 40 ---------------- src/cmd/INIT/filter.sh | 101 ----------------------------------------- 2 files changed, 141 deletions(-) delete mode 100644 src/cmd/INIT/filter.sh diff --git a/src/cmd/INIT/Mamfile b/src/cmd/INIT/Mamfile index bbc0f6ff2f95..553fc81b57f4 100644 --- a/src/cmd/INIT/Mamfile +++ b/src/cmd/INIT/Mamfile @@ -231,42 +231,6 @@ make install exec - esac exec - test -w execrate -a -x execrate || chmod u+w,+x execrate done execrate generated - make filter - make filter.sh - done filter.sh - prev filter.sh - exec - case static,port:$OPTIND:$RANDOM in - exec - ?*:*:*|*::*|*:*:$RANDOM) - exec - ;; - exec - *) if ENV= LC_ALL=C x= $SHELL -nc '[[ a || b ]] && : ${list[level]} !(pattern)' 2>/dev/null - exec - then if grep '### .*archaic.* ###' >/dev/null - exec - then : filter contains archaic constructs : - exec - else ENV= LC_ALL=C $SHELL -n filter.sh - exec - fi - exec - fi - exec - ;; - exec - esac - exec - case '${mam_cc_SHELLMAGIC}' in - exec - "") case 184 in - exec - 0) cp filter.sh filter - exec - ;; - exec - *) { - exec - i=`(read x; echo $x) < filter.sh` - exec - case $i in - exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo "$i" ;; - exec - esac - exec - cat filter.sh - exec - } > filter - exec - ;; - exec - esac - exec - ;; - exec - *) cat - filter.sh > filter <<'!' - exec - ${mam_cc_SHELLMAGIC} - exec - ! - exec - ;; - exec - esac - exec - test -w filter -a -x filter || chmod u+w,+x filter - done filter generated make ignore make ignore.sh done ignore.sh @@ -529,10 +493,6 @@ make install prev crossexec exec - ${STDCMP} 2>/dev/null -s crossexec ${INSTALLROOT}/bin/crossexec || { ${STDMV} ${INSTALLROOT}/bin/crossexec ${INSTALLROOT}/bin/crossexec.old 2>/dev/null || true; ${STDCP} crossexec ${INSTALLROOT}/bin/crossexec ;} done ${INSTALLROOT}/bin/crossexec generated - make ${INSTALLROOT}/bin/filter - prev filter - exec - ${STDCMP} 2>/dev/null -s filter ${INSTALLROOT}/bin/filter || { ${STDMV} ${INSTALLROOT}/bin/filter ${INSTALLROOT}/bin/filter.old 2>/dev/null || true; ${STDCP} filter ${INSTALLROOT}/bin/filter ;} - done ${INSTALLROOT}/bin/filter generated make ${INSTALLROOT}/bin/mamake prev mamake exec - ${STDCMP} 2>/dev/null -s mamake ${INSTALLROOT}/bin/mamake || { ${STDMV} ${INSTALLROOT}/bin/mamake ${INSTALLROOT}/bin/mamake.old 2>/dev/null || true; ${STDCP} mamake ${INSTALLROOT}/bin/mamake ;} diff --git a/src/cmd/INIT/filter.sh b/src/cmd/INIT/filter.sh deleted file mode 100644 index 9668c1e81881..000000000000 --- a/src/cmd/INIT/filter.sh +++ /dev/null @@ -1,101 +0,0 @@ -######################################################################## -# # -# This software is part of the ast package # -# Copyright (c) 1994-2011 AT&T Intellectual Property # -# Copyright (c) 2020-2022 Contributors to ksh 93u+m # -# and is licensed under the # -# Eclipse Public License, Version 2.0 # -# # -# A copy of the License is available at # -# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html # -# (with md5 checksum 84283fa8859daf213bdda5a9f8d1be1d) # -# # -# Glenn Fowler # -# Martijn Dekker # -# # -######################################################################## -: convert command that operates on file args to pipeline filter - -(command set -o posix) 2>/dev/null && set -o posix - -command=filter - -TMPDIR=${TMPDIR:-/tmp} -export TMPDIR -tmp=$TMPDIR/$command$$ -suf= - -case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in -0123) ARGV0="-a $command" - USAGE=$' -[-? -@(#)$Id: filter (AT&T Labs Research) 2001-05-31 $ -] -[-author?Glenn Fowler ] -[-copyright?Copyright (c) 1994-2012 AT&T Intellectual Property] -[-license?https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html] -[+NAME?filter - run a command in stdin/stdout mode] -[+DESCRIPTION?\bfilter\b runs \acommand\a in a mode that takes input from - the \afile\a operands, or from the standard input if no \afile\a - operands are specified, and writes the results to the standard output. - It can be used to run commands like \bsplit\b(1), that normally modify - \afile\a operands in-place, in pipelines. The \afile\a operands are - not modified; \acommand\a is run on copies in \b/tmp\b.] - -command [ option ... ] [ file ... ] - -[+SEE ALSO?\bstrip\b(1)] -' - ;; -*) ARGV0="" - USAGE="command [ option ... ] [ file ... ]" - ;; -esac - -usage() -{ - OPTIND=0 - getopts $ARGV0 "$USAGE" OPT '-?' - exit 2 -} - -while getopts $ARGV0 "$USAGE" OPT -do case $OPT in - *) usage ;; - esac -done -shift `expr $OPTIND - 1` -case $# in -0) usage ;; -esac - -cmd=$1 -while : -do shift - case $# in - 0) break ;; - esac - case $1 in - -*) cmd="$cmd $1" ;; - *) break ;; - esac -done -trap 'rm -f $tmp$suf' 0 1 2 3 15 -case $# in -0) cat > $tmp - $cmd $tmp - ;; -*) for file - do suf=${file##*/} - case $suf in - *.*) suf=.${suf#*.} ;; - *) suf= ;; - esac - cp $file $tmp$suf || exit 1 - chmod u+rwx $tmp$suf || exit 1 - $cmd $tmp$suf || exit 1 - cat $tmp$suf - rm -f $tmp$suf - done - ;; -esac