#!/bin/sh -
#
# /www/cgi-bin/Phone - Phone and E-mail from central Nikhef server
#
# Author: R.Wilhelm
# Version: 12-JAN-1996
# Version: 24-JAN-1996
# Version: 17-OCT-1997: a03 (search for incomplete name i.e. kerkhof)
# Version: 26-NOV-1998: a03 (link to photo)
#
#-----------------------------------------------------------------------
awk='{
if ($1 == "Name" && $NF == "unknown") {
exit 1
}
if ($1 == "Login") {
nlog = 0;
printf "
%s", $7
for (i=8; i<=NF; i++) printf " %s", $i;
printf "
\n\n";
}
if ($1 == "Office:")
printf "- Office, phone:\n
- %s %s\n", $2, $3
if ($3 == "Email:") {
printf "
- E-mail:\n
- ", $4
printf "%s\n", $4
}
if ($1 == "Mail" && $2 == "last") {
printf "
- Mail last read:"
for (i=4; i<=7; i++) printf " %s", $i
printf "\n"
}
}
END {printf "
"}
'
# fingerhost=`uname -n`
echo Content-type: text/html
echo
if [ "$#" = 0 -o "$1" = "" ]
then
echo ""
echo ""
echo "NIKHEF E-mail and Phone directory"
echo ""
echo ""
echo "E-mail and Telephone Directory
"
echo "Displays"
echo ""
echo "- office number and telephone number"
echo "
- e-mail address and link to homepage (if available)"
echo "
- date when mail was last read"
echo "
- picture (if available)"
echo "
"
echo ""
echo "
Four digit numbers can be dialed directly: +31 20 592 xxxx."
echo "
Six digit numbers (81xxxx) are beep numbers and can also be dialed"
echo "directly: +31 20 592 xxxx."
echo "Notice that most beep numbers are identical with the office phone number,"
echo "so be patient if the callee does not answer immediately."
echo "
Provide name as keyword.
"
echo ""
echo "NIKHEF computer users can modify their office and/or phone number
by executing the command chfn on nikhefh.nikhef.nl"
echo ""
echo ""
else
name="$*"
key=`echo "$name" |sed -e 's/ /./g'`
case "$key" in
-*) key= ;;
*' '*) key= ;;
*'*'*) key= ;;
*'?'*) key= ;;
*'`'*) key= ;;
*';'*) key= ;;
*'&'*) key= ;;
*'|'*) key= ;;
*'$'*) key= ;;
*'\'*) key= ;;
*'/'*) key= ;;
*':'*) key= ;;
*','*) key= ;;
esac
[ "$key" = "" ] && exit 0
echo "
"
echo " $name at NIKHEF"
echo ""
echo ""
echo "E-mail and Phone Directory
"
echo "Keyword: $name
"
echo ""
echo "
"
#
# Use finger to find the user info, process the result with awk.
#
# Als NIS in de lucht komt:
# for i in `ypcat passwd | grep -i ${key} | awk -F: '$NF!="/etc/invalid"{print $1}'`
#
# users=`grep -i ${key} /etc/passwd | awk -F: '$NF!="/etc/invalid"{print $1}'`
users=`
ypcat passwd |\
awk -F: '$NF!="/etc/invalid" && $NF!="/etc/disabled"\
{printf("%s %s\n",$1,$5)}' |\
grep -i ${key} | awk '{print $1}'
`
for i in $users
do
echo "| "
finger -p -m $i | awk "$awk"
if [ -f /user/$i/public_html/index.html ]
then
echo "Homepage"
fi
if [ -f /user/$i/public_html/index.htm ]
then
echo "Homepage"
fi
if [ -f /www/people/thumbnails/$i.jpg ]
then
echo " | "
echo ""
echo " "
fi
done
echo " |
"
echo "
"
echo "Note: Four digit numbers can be dialed directly: +31 20 592 xxxx"
echo ""
echo "
"
echo ""
echo "webmaster@nikhef.nl,"
date
echo ""
echo ""
echo ""
echo ""
fi