"Fossies" - the Fresh Open Source Software Archive

Member "rman-3.2/contrib/man2html" (26 Jul 2003, 2049 Bytes) of package /linux/www/old/rman-3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/ksh
    2 
    3 # Take a man tree and make an html tree out of it
    4 
    5 DOMAIN=$(domainname)
    6 ARCH=$(arch)
    7  
    8 case ${DOMAIN} in
    9    acf)     localeo=reo1 ;;
   10    bwfid)   localeo=reo1 ;;
   11    chfid)   localeo=neo1 ;;
   12    hkfid)   localeo=teo1 ;;
   13    lnfid)   localeo=leo1 ;;
   14    nyfid)   localeo=neo1 ;;
   15    psfid)   localeo=leo1 ;;
   16    sffid)   localeo=neo1 ;;
   17    tkfid)   localeo=teo1 ;;
   18    esac
   19 
   20 sections="{1,2,3,4,5,6,7,8}"
   21 from=/usr/man
   22 to=/u/eo/repository/system/unix/man
   23 
   24 function disambiguate
   25 {
   26 newbase=${1}
   27 newname="${newbase}.1"
   28 dis=2
   29 while [ -a "${newname}" ]
   30    do
   31       newname=$newbase"."$dis
   32       dis=$(expr $dis + 1)
   33       done
   34 }
   35 
   36 while getopts f:t:l:is:v c
   37    do
   38       case $c in
   39          f) from=$OPTARG ;;
   40          t) to=$OPTARG ;;
   41          l) localeo=$OPTARG ;;
   42          i) indexonly=1 ;;
   43          s) sections=$OPTARG ;;
   44          v) verbose=1 ;;
   45          esac
   46       done
   47 shift OPTIND-1
   48 
   49 if [ "${verbose}" ]
   50    then
   51       print "from: $from"
   52       print "to: $to"
   53       print "localeo: $localeo"
   54       print "sections: $sections"
   55       if [ "${indexonly}" ]
   56      then
   57         print "indexonly: 1"
   58      fi
   59    fi
   60 
   61 cd $from
   62 
   63 if [ ! "${indexonly}" ]
   64    then
   65       print "Processing the man pages ..."
   66       for i in man${sections}/*
   67      do
   68         if [ "$verbose" ]
   69            then
   70           print $i
   71            fi
   72         # n=${i%.*}
   73         name=${to}/${i}
   74         if [ -a "${name}" ]
   75            then
   76           oldname=$name
   77           disambiguate $name
   78           name=$newname
   79           print "Collision - ${oldname} will be stored as ${name}"
   80            fi
   81         eqn $i | tbl | nroff -man | rman -f HTML | sed -e "s/MS_LOCAL_HOST/${localeo}/g" > ${name}
   82         done
   83    fi
   84 
   85 print "Building the index.html files ..."
   86 cd $to
   87 for i in man${sections}
   88    do
   89       if [ "$verbose" ]
   90      then
   91         print $i
   92      fi
   93       cd $i
   94       rm -f index.html
   95       echo '<ul>' > ../new.html
   96       for j in *
   97      do
   98         if [ "$verbose" ]
   99            then
  100           print -n "$j "
  101            fi
  102         print
  103         print "<li> <a href=$j>$j</a>" >> ../new.html
  104         done
  105       echo '</ul>' >> ../new.html
  106       mv ../new.html index.html
  107       cd ..
  108       done