#! /bin/csh
#
#               Lint all of tools
#
if ($#argv > 0) then
switch ("$1")
case "-help":
  echo "$0 "
  echo "Run lint over the tools programs, using the lint library built"
  echo "with bin/buildlnt."
  exit 0
default:
endsw
endif
#
# Make sure that we're at the top of the directory
if (! -e bmake) then
    echo "$0 must be run from the top of the tools directory"
    exit(0)
endif
#
if ($?TOOLSDIR == 0) then
    setenv TOOLSDIR  `pwd`
    if (! -e $TOOLSDIR/tools.h) then
	echo "setenv TOOLSDIR before running $0"
        exit 1
    endif
endif
set TOOLS = $TOOLSDIR 
set HASPRUNE    = `bin/findprune $ARCH`

if ($HASPRUNE == 1) then
    find . \( -name libs -prune -o -name man -prune -o -name ref -prune -o \
	      -name lint -prune -o -name '*.old' -prune \) \
	-o -type d -exec $TOOLS/bin/rnlint $TOOLS \{\} \;
else 
    find . -type d -exec $TOOLS/bin/rnlint $TOOLS \{\} \;
endif
exit 0
