#!/bin/sh

name="$0"

usage () {
    cat <<EOF >&2
Usage: $name [options...]
where option is one of:
  -h    print generated HTML, then stop
  -o    open a browser on the generated HTML
EOF
    exit 1
}

show=all
stop=none

while [ $# -gt 0 ]; do
    case $1 in
	-h)	show=html;  stop=html;	shift;;
	-o)	show=open;  stop=open;	shift;;
	*)	usage ;;
    esac
done

set -x

echo '<script language="JavaScript">'	>  temp.html
cat  demo.js				>> temp.html
echo '</script>'			>> temp.html

[ $show = html ] && cat temp.html
[ $stop = html ] && exit 0

[ $show = open ] && open temp.html
[ $stop = open ] && exit 0
