#!/bin/sh
#
# Copyright (c) 2008 by Bruce Blinn
#
# NAME
#	findfile - search for a file
#
# SYNOPSIS
#	findfile fileName [directory ...]
#
# DESCRIPTION
#	This command searches the specified directories and their
#	subdirectories for the file.  If no directories are listed
#	on the command line, the current directory is searched.  If
#	the file is found, the path name of the file is printed.
#
#	The file name may contain wildcard characters, but if it
#	does, it must be quoted so that the wildcard characters will
#	be processed inside this shell script rather than being
#	expanded into file names on the command line.  For example:
#
#		findfile "*.c"
#
# RETURN VALUE
#	0	Successful completion.  It is not an error if the
#		file is not found.
#
#	1	Error - see the message written to standard error.
#
####################################################################
CMDNAME=$(basename $0)
USAGE="Usage: $CMDNAME fileName [directory ...]"
NAME=			# File being searched for.

if [ $# -eq 0 ]; then
	echo "$USAGE" 1>&2
	exit 1
fi

NAME=$1
shift

find "${@:-.}" -name "$NAME" -follow -print
