lib/Tools/doc
author wenzelm
Fri, 07 Mar 1997 11:48:46 +0100
changeset 2754 59bd96046ad6
parent 2332 ae592411c199
child 2916 d761a62da697
permissions -rwxr-xr-x
moved settings comment to build;

#!/bin/bash -norc
#
# $Id$
#
# DESCRIPTION: view Isabelle documentation
#
# TODO:
#  - other formats than dvi (??)


PRG=$(basename $0)

function usage()
{
  echo
  echo "Usage: $PRG [DOC]"
  echo
  echo "  View Isabelle documentation DOC, or show list of available documents."
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## args

DOC=""
[ $# -ge 1 ] && { DOC="$1"; shift }

[ $# -ne 0 -o "$DOC" = "-?" ] && usage


## main

if [ -z "$DOC" ]; then
  for DIR in $ISABELLE_DOCS
  do
    [ -f $DIR/Contents ] && cat $DIR/Contents
  done
else
  for DIR in $ISABELLE_DOCS
  do
    [ -f $DIR/$DOC.dvi ] && exec $DVI_VIEWER $DIR/$DOC.dvi
  done
  fail "Unknown Isabelle document: $DOC"  
fi