#!/bin/sh
# This program determines if the hash for a name corresponds to a user
# or an alias (symlink to that user).
# It uses the fact that hashop changes into the hashed dir or follows
# the symlink. For an alias, the cwd will then be different to the
# one calculated by the hash function. Note that hashop will fail if
# $1 is not setup, thus errors to /dev/null
if [ $# -ne 1 ]
then
  echo "Error - usage is as follows:"
  echo "   $0 <username>"
  exit 1
else
  mailpath="`showhashdir $1`"
  mailbox="`hashop $1 pwd 2> /dev/null`"
  if [ -n "$mailbox" ]
  then
    if [ "$mailpath" = "$mailbox" ]
    then
      echo "$1 is a user."
    else
      echo "$1 is an alias."
    fi
  else
    echo "$1 is not setup."
  fi
fi
