head	1.3;
access;
symbols
	before_cvs_1_6:1.1.1.2
	RELENG_2_1_0_RELEASE:1.1.1.2
	RELENG_2_1_0_BP:1.1.1.2
	RELENG_2_0_5_RELEASE:1.1.1.2
	RELENG_2_0_5:1.1.1.2.0.4
	RELENG_2_0_5_BP:1.1.1.2
	RELENG_2_0_5_ALPHA:1.1.1.2
	jt_spdup:1.1.1.2.0.2
	b4_spdup:1.1.1.2
	cvs_1_4A2:1.1.1.2
	RELEASE_2_0:1.1.1.1
	BETA_2_0:1.1.1.1
	ALPHA_2_0:1.1.1.1.0.4
	MOVED_NEWCVS:1.1.1.1
	FINAL_1_1_5:1.1.1.1
	ALPHA_1_1_5:1.1.1.1
	FINAL_1_1:1.1.1.1
	GAMMA_1_1:1.1.1.1
	BETA_1_1:1.1.1.1.0.2
	BP_BETA_1_1:1.1.1.1
	FINAL_1_0:1.1.1.1
	EPSILON_1_0:1.1.1.1
	GAMMA_1_0:1.1.1.1
	BETA_1_0:1.1.1.1
	ALPHA_1_0:1.1.1.1
	cvs_1_3:1.1.1.1
	cvs:1.1.1;
locks; strict;
comment	@# @;


1.3
date	95.12.30.18.37.30;	author peter;	state dead;
branches;
next	1.2;

1.2
date	95.12.11.00.27.48;	author peter;	state dead;
branches;
next	1.1;

1.1
date	93.06.18.05.46.06;	author jkh;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	93.06.18.05.46.07;	author jkh;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	95.03.31.07.43.43;	author nate;	state Exp;
branches;
next	;


desc
@@


1.3
log
@recording cvs-1.6 file death
@
text
@#! /bin/sh
# descend,v 1.1 1992/04/03 05:22:52 berliner Exp
#
# descend - walk down a directory tree and execute a command at each node

fullname=$0
name=descend
usage="Usage: $name [-afqrv] command [directory ...]\n
\040\040-a\040\040All: descend into directories starting with '.'\n
\040\040-f\040\040Force: ignore errors during descent\n
\040\040-q\040\040Quiet: don't print directory names\n
\040\040-r\040\040Restricted: don't descend into RCS, CVS.adm, SCCS directories\n
\040\040-v\040\040Verbose: print command before executing it"

# Scan for options
while getopts afqrv option; do
    case $option in
	a)
	    alldirs=$option
	    options=$options" "-$option
	    ;;
	f)
	    force=$option
	    options=$options" "-$option
	    ;;
	q)
	    verbose=
	    quiet=$option
	    options=$options" "-$option
	    ;;
	r)
	    restricted=$option
	    options=$options" "-$option
	    ;;
	v)
	    verbose=$option
	    quiet=
	    options=$options" "-$option
	    ;;
	\?)
	    /usr/5bin/echo $usage 1>&2
	    exit 1
	    ;;
    esac
done
shift `expr $OPTIND - 1`

# Get command to execute
if [ $# -lt 1 ] ; then
    /usr/5bin/echo $usage 1>&2
    exit 1
else
    command=$1
    shift
fi

# If no directory specified, use '.'
if [ $# -lt 1 ] ; then
    default_dir=.
fi

# For each directory specified
for dir in $default_dir "$@@" ; do

    # Spawn sub-shell so we return to starting directory afterward
    (cd $dir

	# Execute specified command
	if [ -z "$quiet" ] ; then
	    echo In directory `hostname`:`pwd`
	fi
	if [ -n "$verbose" ] ; then
	    echo $command
	fi
	eval "$command" || if [ -z "$force" ] ; then exit 1; fi

	# Collect dot file names if necessary
	if [ -n "$alldirs" ] ; then
	    dotfiles=.*
	else
	    dotfiles=
	fi

	# For each file in current directory
	for file in $dotfiles * ; do

	    # Skip '.' and '..'
	    if [ "$file" = "." -o "$file" = ".." ] ; then
		continue
	    fi

	    # If a directory but not a symbolic link
	    if [ -d "$file" -a ! -h "$file" ] ; then

		# If not skipping this type of directory
		if [ \( "$file" != "RCS" -a \
			"$file" != "SCCS" -a \
			"$file" != "CVS" -a \
			"$file" != "CVS.adm" \) \
			-o -z "$restricted" ] ; then

		    # Recursively descend into it
		    $fullname $options "$command" "$file" \
		    || if [ -z "$force" ] ; then exit 1; fi
		fi

	    # Else if a directory AND a symbolic link
	    elif [ -d "$file" -a -h "$file" ] ; then

		if [ -z "$quiet" ] ; then
		    echo In directory `hostname`:`pwd`/$file: symbolic link: skipping
		fi
	    fi
	done
    ) || if [ -z "$force" ] ; then exit 1; fi
done
@


1.2
log
@Clean out some files which are no longer part of CVS...
@
text
@@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Updated CVS
@
text
@@


1.1.1.2
log
@Original sources from CVS-1.4A2 munged to fit our directory structure.
@
text
@d2 1
a2 1
# $Id: descend,v 1.1 1992/04/03 05:22:52 berliner Exp $
@
