#!/bin/ksh
#
# $Revision: 1.2 $ $Date: 2012-07-26 17:11:48-04 $
# $Source: /home/vogelke/bin/RCS/rcsdate,v $
# $Host: sys7.com $
# $UUID: a1d30408-733c-3608-b494-2e7fb6218376 $
#
#<rcsdate: for an RCS file, set modtime to most recent checkin.

export PATH=/usr/local/bin:/bin:/usr/bin
argv="$*"

for file in $argv
do
    if test -f $file; then

        # sed first gets matching date lines and extracts the date
        # part; second command prints only the first match.

        set X $(rlog $file 2> /dev/null |
          sed -n -e 's/^\(date: .\{19\}\)\(.*\)/\1/p' \
              -n -e '/^date:/{q;}')
        echo "touch -d '$3 $4' $file"
    fi
done

exit 0
