All pastes #277382 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-13 04:01 UTC
rendered paste body
#!/bin/sh
# 
# This script makes it easy to use RCS on files
#
# $Author: doug $
# $Revision: 1.14 $
#
# CHANGES
# $Log: miv.sh,v $
# Revision 1.14  2006/12/11 19:49:03  doug
# tweaked keywords
#
# Revision 1.13  2006/12/11 19:46:53  doug
# added comments
#

# Check if a vim aurgument was supplied
if [ $# = 1 ];
then
        # Check if RCS was used on his file before, if not, initialize it
        if [ -e "$1,v" ];
        then
                co -l $1                 # Checkout and lock
                rcsdiff -u $1 >> $1.diff # Append changes to log
                ci -u $1                 # Checkin
        else
                rcs -i $1
                co -l $1
                vim $1
                rcsdiff -u $1 >> $1.diff
                ci -u $1
        fi

# Same as above, but with an arg for vim as well
elif [ $# = 2 ];
then
        if [ -e "$2,v" ];
        then
                co -l $2
                vim $1 $2
                rcsdiff -u $2 >> $2.diff
                ci -u $2
        else
                rcs -i $2
co -l $2
                vim $1 $2
                rcsdiff -u $2 >> $2.diff
                ci -u $2
        fi
else
        echo "miv.sh [vim option] <file>"
fi