#!/bin/sh
# which --- show all instances of program in path
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1991-07-17
# Last modified: 1994-03-09
# Public domain

if test $# = 0; then
  echo "Usage: where {prog}" 1>&2
  exit 1
fi

path=`echo $PATH | sed -e 's/^:/.:/;s/::/:.:/g;s/:$/:./;s/:/ /g'`

exitstat=1

for p in $path ; do
  if test -f "$p/$1" ; then
    echo "$p/$1"
    exitstat=0
  fi
done

exit $exitstat

# where ends here
