#!/bin/sh # # $TOOLS/history # # history - Display the history of one or more programs from an RCS source dir # tree # # Syntax: history [program_name] # Purpose: # 1) Exec an rlog of the desired program (Default of all programs) # # Requirements: # 1) The rcs source tree must be compatible with that used by # the tools replace and history (Ex: $RCSLIBR/file/RCS/*,v) # 2) The environment variable RCSLIBR must have been previously defined by # using the "lib" command. # 3) To create or access an RCS library, the user must be in the rcssys # group, and the library's parent directory must have R/W access for # the rcssys group. # # Environment Variables: # $RCSLIBR = Dir where we can find "program" dir # # Modified: # 01/24/96 Brian Lomasky - Initial creation. # #----------------------------------------------------------------------------- if [ "$DEBUG" != "" ]; then set -x; fi ErrorProc () #Sub Routine { case $ErrNo in 1) echo "\nError - There is no RCS library for ${b}$RCSLIBR${n}";; 2) echo "\nError - Can't display ${b}$Program${n}";; 3) echo "\nError - ${b}$Program${n} can not be found in RCS";; *) echo "\n\nUnknown error $ErrNo.......";; esac RtrnCode=1 exit_proc } #-------------------------------------------------------------------------- exit_proc () #Sub Routine { exit $RtrnCode } #-------------------------------------------------------------------------- # Main Program Flow b=`tput smso` # Bold video attribute n=`tput rmso` # Normal video attribute if [ "$RCSLIBR" = "" ] then echo "\nError - You must first indicate the RCS library to be accessed." echo "" echo " (This is done by typing: ${b}. lib SOURCE${n}" echo " where \$SOURCE is the complete path to the directory" echo " containing the file that you want to replace.)\n" echo " Example: . lib SOURCE\n" exit 1 fi ErrNo=0 RtrnCode=0 Program="" if [ $# != 0 ]; then #--------------------------------------------------------------------- # process command line argument while [ "$1" != "" ]; do Program=$1 # must be program name shift done fi if [ "$Program" = "" ] then echo "${b}Displaying history for all files in the $RCSLIBR RCS" \ "library...${n}\n" # Display the history for every file for file in `ls $RCSLIBR/RCS/* 2>/dev/null`; do echo " ----- Displaying history for" \ "${b}`basename $file ,v`${n} -----" rlog $file | grep -v -e 'RCS file:' -e 'head:' -e 'locks:' \ -e 'access list:' -e 'comment leader:' \ -e 'total revisions:' -e 'description:' | fold if [ $? -ne 0 ]; then ErrNo=2 ErrorProc fi done else echo "${b}Displaying history for $RCSLIBR/$Program...${n}\n" if [ ! -d $RCSLIBR/RCS ]; then ErrNo=1 # No such dir ErrorProc fi if [ ! -r $RCSLIBR/RCS/$Program,v ]; then ErrNo=3 # Not under RCS control ErrorProc fi # Display history for each matching file for file in `ls $RCSLIBR/RCS/$Program,v`; do rlog $file | grep -v -e 'RCS file:' -e 'head:' -e 'locks:' \ -e 'access list:' -e 'comment leader:' \ -e 'total revisions:' -e 'description:' | fold if [ $? -ne 0 ]; then ErrNo=2 ErrorProc fi done fi exit_proc