#!/bin/sh - # # greppeople - search for users in the IUCS Web People Directory; CGI # Steve Kinzler, kinzler@cs.indiana.edu, May 97 # Rob Henderson, robh, Oct 01 - Converted to new web structure # ############################################################################### PATH=/bin:/usr/bin; export PATH wwwpicons=/picons/db/users/edu/indiana piconsdir=/l/$wwwpicons head=/l/www/People/headonly.html tail=/l/www/People/tailonly.html cd /l/www/People/auto ############################################################################### tmpA=/tmp/gpA$$ tmpB=/tmp/gpB$$ tmpT=/tmp/gpT$$ #trap "rm -f $tmpA $tmpB $tmpT; exit" 0 1 2 13 15 cat *T.html | sed -n 's/^//p' > $tmpA || exit $? sed -n '/^__END__/,$p' < bin/mkpeople > $tmpT || exit $? cat < EOF sed '1,/^__TITLE__/d; /^__/,$d' < $tmpT || exit $? echo '

Search Results

' sed '1,/^__INTRO__/d; /^__/,$d' < $tmpT || exit $? cat <

[ Main Index ]

EOF sed '1,/^__SEARCH__/d; /^__/,$d' < $tmpT || exit $? if test -n "$QUERY_STRING"; then set x `echo "$QUERY_STRING" | perl -pe 's/.*isindex=//; s/&.*//; s/\+/ /g; s/%([\da-f]{2})/pack('C', hex $1)/gie; s/[*?\[\]]//g'`; shift fi echo '

Matches for ' echo "$@" | sed 's/&/\&/g; s//\>/g' echo '

' nil=t for word do case "$word" in '') continue;; *) nil=;; esac grep -i "$word" < $tmpA > $tmpB mv $tmpB $tmpA || exit $? done if test -n "$nil"; then cat <No search words. Enter a name or a fragment of a name. EOF elif test -s $tmpA; then sort < $tmpA | sed 's/ \*
/
/' | while read line do OIFS="$IFS"; IFS="/.$IFS" set $line IFS="$OIFS" user="$3" if test -s "$piconsdir/$user/face.gif"; then cat < EOF elif test -s "$piconsdir/$user/face.xbm"; then cat < EOF else cat < EOF fi echo "$line" done else cat <No matches. Try a less specific name search. EOF fi echo '

' sed '1,/^__TAIL__/d; /^__/,$d' < $tmpT cat $tail