#!/bin/sh

PKGS=/usr/contrib/lib/m3/pkg
PLATFORM=FreeBSD2

cd ${PKGS}
for DIR in libm3 * ; do
   if [ -d ${DIR} ] ; then
      if [ ! -d ${DIR}/${PLATFORM} ] ; then
         continue
      fi
      # echo package ${DIR}:
      RESULT=`m3where -h -d ${PKGS}/${DIR} $* 2>/dev/null | \
              egrep -v 'searching in|not found'`
      if [ -n "${RESULT}" ] ; then
         echo ${RESULT}
         exit 0
      fi
   fi
done
exit 1
