home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / RCS_SRC.ZIP / RCSCLEAN.SH < prev    next >
Linux/UNIX/POSIX Shell Script  |  1991-01-15  |  1KB  |  41 lines

  1. #! /bin/sh
  2. #
  3. # RCS cleanup operation.
  4. # $Header: /arthur/src/local/bin/rcs/src/RCS/rcsclean.sh,v 1.5 86/07/03 13:09:55 jdl Exp $
  5. #
  6. # This program removes working files which are copies of the latest
  7. # revision on the default branch of the corresponding RCS files.
  8. # For each file given, rcsclean performs a co operation for the latest
  9. # revision on the default branch, and compares
  10. # the result with the working file. If the two are identical,
  11. # the working file is deleted.
  12. #
  13. # A typical application in a Makefile would be:
  14. # clean:;       rm *.o; rcsclean *.c *.o
  15. #
  16. # Limitation: This program doesn't work if given the name of
  17. # an RCS file rather than the name of the working file.
  18.  
  19. PATH=/usr/new/bin:/usr/local/bin:/bin:/usr/bin:/usr/ucb
  20. export PATH
  21. progname=$0
  22. if [ $# = 0 ] ; then
  23.     echo        "usage: $progname file ..."
  24.     echo        "removes all working files that are checked in and are unchanged"
  25.     exit  0
  26. fi
  27. TMPFILE=/tmp/rcscl$$.tmp
  28. while test $# -gt 0 ; do
  29.     if test -f $1 ; then
  30.     co -p -q $1 > $TMPFILE
  31.     if [ $? = 0 ] ; then
  32.         cmp -s $1 $TMPFILE
  33.         if [ $? = 0 ] ; then
  34.         chmod +w $1; rm -f $1; rcs -u -q $1
  35.         fi
  36.     fi
  37.     fi
  38.     shift
  39. done
  40. rm -f $TMPFILE
  41.