#!/bin/sh ######################################################################### # # FILE : cvsdiff # DATE : 10.07.2001 # AUTHOR : Patrick Meier / patrick.meier@profidatagroup.com # DESCRIPTION : show the diff between two revisions # # Copyrigth (C) 2001 by Patrick Meier, Switzerland # ######################################################################### PN=`basename "$0"` CVS=/usr/local/bin/cvs-1.11.1p1-SUNOS-5.6 CVSBIN="`echo \"$CVS\" | sed 's/.*\/.*\///g'`" CVSPARAMETER= STARTSTRING="==>" export CVS ######################################################################### # getCVSHelp ######################################################################### getCVSHelp() { tag="$1" help="`$CVS $tag --help 2>&1 \ | sed \"s/$tag: invalid option -- -//g\" \ | sed 's/diff: unrecognized option \`--help//g;' \ | sed \"s/Usage:*//g\" \ | sed \"s/$CVSBIN $tag //g\" \ | sed \"s/-d/-dir/g\" \ | sed \"s/\'//g\" \ | sed \"s/(Specify the --help global option for a list of other help options)//g\"`" command="`echo $help | sed \"s/\[files.*/ \[files\.\.\.\]/\"`" description="`echo "$help" | sed \"s/.*\[.*\]//g\"`" echo $command echo "$description" } ######################################################################### # Usage ######################################################################### Usage() { echo "$PN - show the diff between two revisions" printf "usage: $PN [-d cvs-root] " getCVSHelp diff exit 1 } ######################################################################### # ParameterFailed ######################################################################### ParameterFailed() { echo "${STARTSTRING}Parameter faild: $1 ..."; echo "" Usage } ######################################################################### # main ######################################################################### while [ $# -gt 0 ] do case "$1" in -h) Usage; exit 1;; -help) Usage; exit 1;; --help) Usage; exit 1;; -d) if [ $# -gt 1 ] ; then CVSROOT="$2"; shift; else ParameterFailed $1; fi;; -D) if [ $# -gt 1 ] ; then CVSPARAMETER="$1 $2 $CVSPARAMETER"; shift; else ParameterFailed $1; fi;; -r) if [ $# -gt 1 ] ; then CVSPARAMETER="$1 $2 $CVSPARAMETER"; shift; else ParameterFailed $1; fi;; -*) CVSPARAMETER="$1 $CVSPARAMETER";; *) break;; esac shift done $CVS diff $CVSPARAMETER $@ ######################################################################### # EOF #########################################################################