#!/bin/sh

# wsl:  Where in NEMO can I find $last  ?
#	Pass preceding arguments as switches to grep.
#
# Versions:	wsl		Full search (in src)
#		wsll		Full search, list filenames only
#		wsl_usr		Search usr part only
#		wsll_usr	Search usr part, list filenames only
#
# See also: grin (an open source python tool)

if [ $# = 0 ]; then exit; fi

# Problem: $0 is wsl in sbin, full pathname otherwise...  The system
# seems to pick up the name by which it was found in the path search,
# except that the "./" is dropped if it is in the current directory.

short=" "
srcdir="src"

name=$0

case "$name" in
  *wsll|*wsll_*) short="-l" ;;
esac

cd $NEMO

(find inc -name '*\.h' -print; \
 find $srcdir -name Makefile -print; \
 find $srcdir -name '*\.[cCfFh]' -print ) \
	| xargs grep $short "$@" /dev/null
