#!/bin/sh
#####
# NAME
#	find-include-dir - find include directory under /usr and /opt dir
# USAGE
#	find-include-dir
# DESCRIPTION
#  This script searchs "include" directory. The target is
#    1) The directory under /usr or /opt directory.
#    2) The directory which the full path does not contain "src"
# NOTE
#  This script require "locate" command. If it is not found.
#  an error occured.
# COPYRIGHT
#  Copyright (C) 2000,2001 Steel Wheels Project.
#  This file is a apart of the papaya utilities. 
#  If you need the information of copyright of this file, see COPYING
#  file distributed with file or see http://www.asahi-net.or.jp/~em7t-hmd
#  web page.

THIS="find-include-dir" ;
LOCATE="/usr/bin/locate"

error(){
	echo "$THIS [ERROR] $1" ;
	exit 1 ;
}

if test -z $LOCATE ; then
	error "locate command is not found." ;
fi

# display location of include directory
if $LOCATE include | \
   grep "include/*$" | \
   grep "^/[up][sp][rt]" | \
   grep -v src
then
	exit 0 ;
else
	exit 1 ;
fi


