Sync usage with man page.
[netbsd-mini2440.git] / gnu / usr.bin / rcs / rcsfreeze / rcsfreeze.sh
blob928ce04bbb65acbd372a9a63ea97f8a88d246ded
1 #! /bin/sh
3 # rcsfreeze - assign a symbolic revision number to a configuration of RCS files
5 # $NetBSD: rcsfreeze.sh,v 1.3 1996/10/15 07:00:43 veego Exp $
7 # Id: rcsfreeze.sh,v 4.6 1993/11/03 17:42:27 eggert Exp
9 # The idea is to run rcsfreeze each time a new version is checked
10 # in. A unique symbolic revision number (C_[number], where number
11 # is increased each time rcsfreeze is run) is then assigned to the most
12 # recent revision of each RCS file of the main trunk.
14 # If the command is invoked with an argument, then this
15 # argument is used as the symbolic name to freeze a configuration.
16 # The unique identifier is still generated
17 # and is listed in the log file but it will not appear as
18 # part of the symbolic revision name in the actual RCS file.
20 # A log message is requested from the user which is saved for future
21 # references.
23 # The shell script works only on all RCS files at one time.
24 # It is important that all changed files are checked in (there are
25 # no precautions against any error in this respect).
26 # file names:
27 # {RCS/}.rcsfreeze.ver version number
28 # {RCS/}.rscfreeze.log log messages, most recent first
30 PATH=/bin:/usr/bin:$PATH
31 export PATH
33 DATE=`date` || exit
34 # Check whether we have an RCS subdirectory, so we can have the right
35 # prefix for our paths.
36 if test -d RCS
37 then RCSDIR=RCS/ EXT=
38 else RCSDIR= EXT=,v
41 # Version number stuff, log message file
42 VERSIONFILE=${RCSDIR}.rcsfreeze.ver
43 LOGFILE=${RCSDIR}.rcsfreeze.log
44 # Initialize, rcsfreeze never run before in the current directory
45 test -r $VERSIONFILE || { echo 0 >$VERSIONFILE && >>$LOGFILE; } || exit
47 # Get Version number, increase it, write back to file.
48 VERSIONNUMBER=`cat $VERSIONFILE` &&
49 VERSIONNUMBER=`expr $VERSIONNUMBER + 1` &&
50 echo $VERSIONNUMBER >$VERSIONFILE || exit
52 # Symbolic Revision Number
53 SYMREV=C_$VERSIONNUMBER
54 # Allow the user to give a meaningful symbolic name to the revision.
55 SYMREVNAME=${1-$SYMREV}
56 echo >&2 "rcsfreeze: symbolic revision number computed: \"${SYMREV}\"
57 rcsfreeze: symbolic revision number used: \"${SYMREVNAME}\"
58 rcsfreeze: the two differ only when rcsfreeze invoked with argument
59 rcsfreeze: give log message, summarizing changes (end with EOF or single '.')" \
60 || exit
62 # Stamp the logfile. Because we order the logfile the most recent
63 # first we will have to save everything right now in a temporary file.
64 TMPLOG=/tmp/rcsfrz$$
65 trap 'rm -f $TMPLOG; exit 1' 1 2 13 15
66 # Now ask for a log message, continously add to the log file
68 echo "Version: $SYMREVNAME($SYMREV), Date: $DATE
69 -----------" || exit
70 while read MESS
72 case $MESS in
73 .) break
74 esac
75 echo " $MESS" || exit
76 done
77 echo "-----------
78 " &&
79 cat $LOGFILE
80 ) >$TMPLOG &&
82 # combine old and new logfiles
83 cp $TMPLOG $LOGFILE &&
84 rm -f $TMPLOG &&
86 # Now the real work begins by assigning a symbolic revision number
87 # to each rcs file. Take the most recent version on the default branch.
89 # If there are any .*,v files, throw them in too.
90 # But ignore RCS/.* files that do not end in ,v.
91 DOTFILES=
92 for DOTFILE in ${RCSDIR}.*,v
94 if test -f "$DOTFILE"
95 then
96 DOTFILES="${RCSDIR}.*,v"
97 break
99 done
101 exec rcs -q -n$SYMREVNAME: ${RCSDIR}*$EXT $DOTFILES