w#!/bin/sh
#
# Name: cit.sh
#
# Date: 08/28/2003
#
# Copyright: 2003 CyberSoft Operating Corporation, All Rights Reserved. 
#
# Description: This is a general script that will demonstrate how to run the Cit program. 
# The --dbpath option specifies the directory for reading cit_danger.db and writing cit.db.
# The example sets dbpath to the current directory.
#

VFIND=vfind
VPATH=/
VOPTS=
COPTS=
UOPTS=
mflag=
pflag=
vflag=
uflag=
cflag=
while getopts p:c: name
do
	case $name in
#	m)
#		mflag=1
#		;;
	p)
		pflag=1
		pval=$OPTARG
		;;
#	v)
#		vflag=1
#		vval=$OPTARG
#		;;
#	u)
#		uflag=1
#		uval=$OPTARG
#		;;
	c)
		cflag=1
		cval=$OPTARG
		;;
	?) printf "Usage: %s  [-p <path>] [-c 'cit options'] \n" $0
		exit 1
		;;
	esac
done

if [ ! -z "${mflag}" ]; then
	VFIND=vfind-mt
fi
if [ ! -z "${pflag}" ]; then
	VPATH=${pval}
fi
if [ ! -z "${vval}" ]; then
	VOPTS=${vval}
fi
if [ ! -z "${uflag}" ]; then
	UOPTS=${uval}
fi
if [ ! -z "${cflag}" ]; then
	COPTS=${cval}
fi

PATH=/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export PATH

VSTK_HOME=<vstk_home>
export VSTK_HOME

# use the find command in $VSTK_HOME unless it is not there, then use the
# one installed on the system.

FIND=$VSTK_HOME/programs/find
if [ ! -x ${FIND} ]; then
	FIND=find
fi

${FIND} ${VPATH} -mount -type f ! -name core -a ! -fstype proc \
    -a -perm -u+r,-g+r,-o+r -print | 
   | $VSTK_HOME/bin/cit --dbpath . ${COPTS}
