#!/bin/sh

#. /etc/efingerd/log 

echo
if [ "$1" = "(null)" ]; then
  echo Hello "$2",
else 
  echo Hello "$1@$2",
fi

if [ "$3" = "time" ]; then
  echo The time is...
  date
  exit 0
fi

if [ "$3" = "ping" ]; then
  echo "PONG!"
  ping -c 5 "$2"
  exit 0
fi

if [ "$3" = "fortune" ]; then
  /usr/games/fortune
  exit 0
fi

if [ "$3" = "uptime" ]; then
  /usr/bin/uptime
  exit 0
fi

if [ "$3" = "uname" ]; then
  /bin/uname --all
  exit 0
fi

cat <<EOM
You tried to finger non existant user!!!
Your attempt is logged and sent to C.I.A., K.G.B. and S.I.S.
Expect a visit soon.

EOM
