#!/bin/bash
#
# by Chih-Wei Huang
#                        27-31 July 1998
#                Updated 20 September 1998
#

PATH=.:$PATH
FUNCTIONS="`type -path bg5sgmlfunctions`"
if [ -z $FUNCTIONS ]; then
    echo "$0: include file not found!"
    exit 1
fi
. $FUNCTIONS


for src in $filelist
do
    checksrcfile $src
    [ $? = 0 ] && continue

    encodingbg5 $src

    pushd . > /dev/null
    cd $TMP
    sgml2html $options $name.sgml

    if [ -e $name.html ]; then
        list=`ls $name*.html`
    elif [ -e $name.htm ]; then
        list=`ls $name*.htm`
    else
        exit 2
    fi
    popd > /dev/null

    for file in $list
    do
        sed 's/<HEAD>/<HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text\/html; charset=big5">/g' $TMP/$file | \
        $B2A -d -o $file
    done
done

cleartmp

