do-subst.sh

来自「早期freebsd实现」· Shell 代码 · 共 85 行

SH
85 行
字号
#! /bin/sh##  $Revision: 1.3 $##  Run subst over a list of files.  Get files in and out of source control##  if present.##  Assume no source control.MODE=nonePLAIN="$*"CONTROLLED=BASEDIRNAME=`basename \`pwd\``if [ -d RCS -a ! -d SCCS ] ; then    # Find out which files are under RCS control.    MODE=rcs    PLAIN=    for I    do	if [ -f RCS/${I},v ] ; then	    CONTROLLED="${CONTROLLED} ${I}"	else	    PLAIN="${PLAIN} ${I}"	fi    done    test -n "${CONTROLLED}" && co -l -q ${CONTROLLED}fiif [ -d SCCS -a ! -d RCS ] ; then    # Find out which files are under SCCS control.    MODE=sccs    PLAIN=    for I    do	if [ -f SCCS/s.${I} ] ; then	    CONTROLLED="${CONTROLLED} ${I}"	else	    PLAIN="${PLAIN} ${I}"	fi    done    test -n "${CONTROLLED}" && sccs get -e ${CONTROLLED}fi##  Make an unmodified copy of all files.for I in ${CONTROLLED} ${PLAIN}; do    rm -f bak.${I}    cp ${I} bak.${I}done##  Make sure we can write all non-controlled files.test ! -z "${PLAIN}" && chmod u+w,g+w ${PLAIN}##  Make the list of files, run config over it.LISTOFFILES=../${BASEDIRNAME}/files.$$for I in ${PLAIN} ${CONTROLLED} ; do    echo ../${BASEDIRNAME}/${I}done >${LISTOFFILES}( cd ../config; make quiet FILE=${LISTOFFILES} )rm -f ${LISTOFFILES}# check which files we really changedfor I in ${CONTROLLED} ${PLAIN} ; do    if cmp -s ${I} bak.${I}; then	##  No change was made, restore things.	case ${MODE} in	sccs)	    test -f SCCS/s.${I} && sccs unedit ${I}	    ;;	rcs)	    test -f $RCS/${I},v && rcs -q -u ${I} && ci -u -q -f ${I}	    ;;	esac    else	##  Check files back into source control, if we have to.	case ${MODE} in	rcs)	    echo 'Ran subst from Makefile' | ci -u -q -f ${I}	    ;;	sccs)	    echo 'Ran subst from Makefile' | sccs delget -s ${I}	    ;;	esac    fi    rm -f bak.${I}doneexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?