lib/Tools/doc
author wenzelm
Fri, 11 Apr 1997 17:30:15 +0200
changeset 2936 bd33e7aae062
parent 2916 d761a62da697
child 2940 baae674b1d29
permissions -rwxr-xr-x
fixed { ... } shell syntax to accomodate bash 2.x;

#!/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 ] && { cd $DIR; exec $DVI_VIEWER $DOC.dvi; }
  done
  fail "Unknown Isabelle document: $DOC"  
fi