rcsclean(1) DG/UX 5.4.2 rcsclean(1)
NAME
rcsclean - clean up working files
SYNOPSIS
rcsclean [rcsdiff options] [file ... ]
DESCRIPTION
rcsclean removes working files that were checked out and never
modified. For each file given, rcsclean compares the working file
and a revision in the corresponding RCS file. If it finds no
difference, it removes the working file, and, if the revision was
locked, unlocks the revision.
If no file is given, all working files in the current directory are
cleaned. Any other options are passed along to rcsdiff for the
comparison.
rcsclean is useful for clean targets in Makefiles. See also
rcsdiff(1), which prints out the differences, and ci(1), which
normally asks whether to check in a file if it was not changed.
EXAMPLES
rcsclean *.c *.h
removes all working files ending in .c or .h that were not changed
since their checkout.
rcsclean
removes all working files in the current directory that were not
changed since their checkout.
DIAGNOSTICS
The exit status is 0 if there were no differences in any file under
RCS control, 1 if there were differences, and 2 if there were errors.
IDENTIFICATION
Author: Walter F. Tichy.
Revision Number: 5.1.1.2; Release Date: 1992/04/03.
Copyright © 1982, 1988, 1989 by Walter F. Tichy.
Copyright © 1990 by Paul Eggert.
SEE ALSO
ci(1), co(1), ident(1), rcs(1), rcsdiff(1), rcsfreeze(1),
rcsintro(1), rcsmerge(1), rlog(1), rcsfile(4)
Walter F. Tichy, RCS--A System for Version Control, Software
--Practice & Experience 15, 7 (July 1985), 637-654.
BUGS
RCS filenames may not be given as arguments.
Any diagnostics generated by rcsdiff when comparing files are
discarded.
If the latest revision is already unlocked, and you have a lock on an
Licensed material--property of copyright holder(s) 1
rcsclean(1) DG/UX 5.4.2 rcsclean(1)
earlier revision, the earlier revision is unlocked.
rcsclean is just an optional example shell script, and should not be
taken too seriously. In fact, here it is in case you want to use it
for ideas on how you can use RCS tools in shell scripts:
#! /bin/sh
#
# rcsclean - remove working files that are copies of latest RCS revision
# $Id: rcsclean.1,v 5.1.1.2 1992/04/03 20:08:49 brown Sta $
# This program removes working files which are copies of the latest
# revision on the default branch of the corresponding RCS files.
# For each file given, rcsclean performs a co operation for the latest
# revision on the default branch, and compares
# the result with the working file. If the two are identical,
# the working file is deleted.
#
# A typical application in a Makefile would be:
# clean:; rm *.o; rcsclean *.c *.o
#
# Limitation: This program doesn't work if given the name of
# an RCS file rather than the name of the working file.
PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb:$PATH
export PATH
usage='rcsclean: usage: rcsclean file ...'
case $1 in
0) echo >&2 "$usage"; exit 2
esac
='
'
IFS=$
rcs=rcs
rcsdiff=rcsdiff
for i
do
case $i in
-*)
case $i in
-[qr]*) rcs=$rcs$$i
esac
rcsdiff=$rcsdiff$$i
shift;;
*) break
esac
done
Licensed material--property of copyright holder(s) 2
rcsclean(1) DG/UX 5.4.2 rcsclean(1)
case $# in
0)
files=
for file in .* *
do
case $file in
*,v | . | ..) ;;
[-+]* | *$*) echo >&2 "rcsclean: $file: strange file name";
exit 2;;
*)
case $file in
'*' | '.*') [ -f "$file" ] || continue
esac
files=$files$$file
esac
done
case $files in
?*) set $files
esac;;
*)
case $* in
*$*) echo >&2 'rcsclean: newline in arguments'; exit 2
esac
esac
remove=
status=0
for i
do
case $i in
-*)
case $i in
-[qr]*) rcs=$rcs$$i
esac
rcsdiff=$rcsdiff$$i;;
*,v)
echo >&2 "rcsclean: $i: cannot handle RCS file name"; exit 2;;
*)
$rcsdiff -q $i >/dev/null 2>&1
case $? in
# Ignore rcsdiff trouble (usually files that are not under RCS).
0) remove=$remove$$i;;
1)
echo >&2 "rcsclean: $i: " || exit
status=1
esac
esac
done
case $remove in
?*)
unlock=`rlog -L -R -l${LOGNAME-$USER} $remove` &&
case $unlock in
Licensed material--property of copyright holder(s) 3
rcsclean(1) DG/UX 5.4.2 rcsclean(1)
?*) $rcs -u $unlock
esac &&
rm -f $remove || status=2
esac
exit $status
Licensed material--property of copyright holder(s) 4