#!/bin/sh

. /etc/efingerd/log  # do some logging

echo

if [ $1 = 'vanya' ]; then      # special action if vanya wants to finger us
  echo 'What do you want?????' # from any computer
  echo 'Go away'
  exit 0                       # and finish without telling him who is logged
fi

if [ $1 = 'jzatko' ]; then  # not so special action if jzatko wants to finger us
  echo 'Hellooooooooooooooo'
  echo
fi


if [ $1 = 'matos' ]; then  # this user likes short listings
  who -q
  exit 0
fi


if [ $2 = 'pascal.fmph.uniba.sk' ]; then # ban the whole computer pascal
  echo 'Sorry, we do not want you to know who is here.'
  exit 0
fi

if [ $1\@$2 = 'torvalds@transmeta.com' ]; then  
# a very special occasion
# you should put here site specific action
# this here is just an example:
tail -100 /var/log/kern.log
  exit 0
fi


if [ $1 = '(null)' ]; then
  echo Hello $2,      # we do not know who it is - does not run ident
else 
  echo Hello $1\@$2,  # else greet him
fi

echo users currently logged in are:
echo
who -iHw        # and display the user listing in readable form
                 # or:
# finger         # classical alternative
                 # or:
# ps aux         # this reveals too much - do not use this command, unless 
                 # you trust people who finger you
echo
