#!/bin/sh
# **********************************************************************
# Computer Vision/Image Processing Tool Project - Dr. Scott Umbaugh SIUE
# **********************************************************************
#
#             File Name: find_rcs_files.csh
#           Description: find all files checked out by one user
#         Related Files: NONE
#   Initial Coding Date: Mon Jun  2 16:38:54 CDT 1997
#           Portability: C Shell script
#            References: NONE
#             Author(s): Arve Kjolen
#                        Southern Illinois University @ Edwardsville
#
## Copyright (C) 1996 SIUE - by Scott Umbaugh and Arve Kjolen.
##
## Permission to use, copy, modify, and distribute this software and its
## documentation for any purpose and without fee is hereby granted, provided
## that the above copyright notice appear in all copies and that both that
## copyright notice and this permission notice appear in supporting
## documentation.  This software is provided "as is" without express or
## implied warranty.
##
# RCS (Revision Control System) Information
# ...Added automatically by RCS 
#
## $Log: find_rcs_files,v $
## Revision 1.3  1997/07/09 14:19:29  yawei
## changed CVIPHOME to absolute pathname to run on crontab daemon
##
## Revision 1.2  1997/06/03 02:20:48  yawei
## use hard coded user list for temporary purpose, since
## the /etc/group is not up-to-date
##
## Revision 1.1  1997/06/02 21:40:27  yawei
## Initial revision
##
#

# rcsfind - find all files checked out by one
# particular person.  Username is given on command line.
# Arve Kjoelen - 5/20/96
# Modified to run under cron 7/22/96 - Arve Kjoelen

#cd $CVIPHOME
cd /home/cvip/cvipapps/CVIPtools3.6
find . -name "*,v" -print > /tmp/files.doc
for i in `cat /tmp/files.doc`
do
#   for users in `/bin/cat /etc/group | grep cvipadm | awk -F: '{print $4}' | awk -F, '{ for (j=NF; j>0; --j) print $j}'`
   for users in yawei akjoele sumbaug wzheng smakam
   do
      egrep $users $i | grep strict > /dev/null
      if [ $? = 0 ]
      then
         echo $i >> /tmp/${users}.doc
      fi
   done
done

#for users in `/bin/cat /etc/group | grep cvipadm | awk -F: '{print $4}' | awk -F, '{ for (j=NF; j>0; --j) print $j}'` 
for users in yawei akjoele sumbaug wzheng smakam
do
   if [ -s /tmp/${users}.doc ]
   then
      echo " " >> /tmp/${users}.doc
      echo " " >> /tmp/${users}.doc
      echo "The above CVIPtools file(s) are checked out by you as of `date`" >> /tmp/${users}.doc
      echo "Please remember to check them back in when you are done with them" >> /tmp/${users}.doc 
      echo " " >> /tmp/${users}.doc 
      echo "- The rcs check script" >> /tmp/${users}.doc 
      cat /tmp/${users}.doc | mail -s "CVIPtools rcs update" $users
   fi
   rm -f /tmp/${users}.doc
done
