#!/bin/csh
#
# This script is used to create map of the files available in 
# specified tree ...
#
if ( "$1" != "-focus" ) then
   # Temorarie, but normally this program is in path...
   setenv SUBFONT `pwd`/subfont

   set root=$1
   if ( "$1" == "" ) then
      set root="/usr/local/lib/texmf/fonts"
   endif
   set CWD=`pwd`
   if ( -e $CWD/mkmap ) then
      set itself=$CWD/mkmap
   else
      echo Can not found itself when try search in cuurent directory.
      exit
   endif
   echo >SubFont.map
   echo >Fontmap.t1
   cd root
   find . -name "*.pf[ab]" -exec $itself -focus {} $CWD/Fontmap.t1 $CWD/SubFont.map \;
else
   set fn=$2
   set gsmap=$3
   set sfmap=$4
   set font=`$SUBFONT $fn | grep /FontName | cut -d/ -f3 | cut '-d ' -f1`
   echo font /$font/ in file /$fn/
   echo "$font $fn" >>$sfmap
   echo "/$font ($fn) ;" >>$gsmap
endif
####