Text File

#!/bin/sh # # @(#) mkgntexidir 1.3 95/02/01 11:51:26 # # mkgntexidir - Generate HTML documents from GNU "texi" manuals. # # Chip Rosenthal # Unicom Systems Development # chip@chinacat.unicom.com # http://www.unicom.com/ # # Edit at tabstops=4. #

Progname=`basename $0` USAGE="usage: [document ...]"

# # Before you use this script, you must: # # - Customize the site-specific definitions below. # - Write a datafile that describes your library of documents. # # The command line arguments may be used to select the documents to # process. If no arguments are specified, the entire documentation # library is rebuild. Otherwise, only the named documents are processed. # If you want to rebuild the main menu without processing any of the # documents, specify a single bogus document name on the command line. #

############################################################################## # # Site-Specific Definitions. #

# # Directories. # GN_ROOT=/pub/web # root of the "gn" tree GN_TEXI=online_docs/gnu_docs # where to put library, *relative* to GN_ROOT SRC_ROOT=/local/src # where most of your source packages reside GN_LIB=/local/libexec/gn # a convenience for the definitions below

# # Files. # DESCR=/Texi_docs # description file for the documents library TEXI2HTML=/texi2html # Lionel Cons' texi-to-HTML perl script MKMENUS=/mkmenus # my "mkmenus" utility MKCACHE=/mkcache # the standard gn "mkcache" utility

# # Other definitions. # MAILTO=webmaster@www.unicom.com # server maintainer TEXIOPTS="-verbose -split_node" # options for "texi2html" MENU=menu # output menu file name

# # End of Site-Specific Definitions # ##############################################################################

# # Check that necessary files and directories exist. # for d in / ; do if [ ! -d ] ; then echo ": cannot access directory \"\"" 1>&2 exit 1 fi done for f in ; do if [ ! -f ] ; then echo ": cannot access file \"\"" 1>&2 exit 1 fi done

# # The command line specifies documents we should process. # process_list="$@"

# # Open up the description file on fd 4. # exec 4< || exit 1

# # Open up the stream for the main menu on fd 5. # exec 5>// || exit 1

# # Initialize the menu. # cat << EOF >&5

Maintainer=mailto:

HttpText= <UL> EndText=

EOF

# # Shell procedure to generate the document and directory. # process_document() { if [ $# -ne 2 ] ; then echo "usage: process_document doc_name doc_dir" 1>&2 exit 1 fi _dname="$1" _ddir="$2" _dpath="//"

test -d "" && ( set -x ; rm -rf "" ) ( set -xe mkdir "" cd "" for _ext in .texinfo .texi ; do _doc=${_ddir}/${_dname}${_ext} test -f "" && break done eval "perl " ) }

# # Shell procedure to generate main menu entry for a document. # process_menu() { if [ $# -ne 2 ] ; then echo "usage: process_menu doc_name doc_descr" 1>&2 exit 1 fi _dname="$1" _ddescr="$2"

sed -e 's/^[ ]*|//' >&5 << EOF | |Text= |<LI>${_ddescr} |EndText= | |Hname=Read</A> the <CITE>${_dname}</CITE> manual. |Path=0/${GN_TEXI}/${_dname}/${_dname}_toc.html | |Hname=Search</A> the <CITE>${_dname}</CITE> manual. |Path=7g/${GN_TEXI}/${_dname} | |Hname=dummy entry to get mkcache to enter this directory |Path=1/${GN_TEXI}/${_dname} |Attribute=invisible | EOF }

# # Process the document description file. # lineno=0 while read line <&4 ; do

# # Skip blank lines and comments. # lineno=`expr + 1` case "" in '') continue ;; \#*) continue ;; esac

# # Each line is of the form: # # document directory description ... # set X if [ $# -lt 4 ] ; then echo "(): bad format [line ignored]" 1>&2 continue fi shift ; doc_name="$1" shift ; doc_dir="$1" shift ; doc_descr="$@"

# # Convert directory to a full pathname. # case "" in /*) ;; *) doc_dir="${SRC_ROOT}/${doc_dir}" ;; esac

# # See if we want to process this document. # if [ "X" != "X" ] ; then do_document=false for x in ; do if [ "" = "" ] ; then do_document=true break fi done else do_document=true fi

# # Do the work. # if ; then echo ": processing ${doc_name}..." process_document "" "" else echo ": skipping ${doc_name}..." fi process_menu "" ""

done

# # Finish the menu. # cat << EOF >&5

HttpText= </UL> <HR> This menu and document tree automatically constructed with <A HREF="http://www.unicom.com/gn-info/gn-tools.html#mkgntexidir><CITE></CITE></A> by <A HREF="http://www.unicom.com/personal/chip.html>Chip Rosenthal</A>. The texi-to-HTML conversion was performed by Lionel Cons' <A HREF="http://asis01.cern.ch/infohtml/texi2html.html"><CITE>texi2html.pl</CITE></A> script. EndText=

EOF

# # Close the file streams # exec 4<&- 5>&-

# # Rebuild the cache files. # ( set -x cd / && -r -m )