lib/Tools/doc
author wenzelm
Wed, 22 Nov 2000 21:41:39 +0100
changeset 10511 efb3428c9879
parent 9788 df671fa2562a
child 10555 2323ec838401
permissions -rwxr-xr-x
tuned;

#!/bin/bash
#
# $Id$
# Author: Markus Wenzel, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# DESCRIPTION: view Isabelle documentation


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
  ORIG_IFS="$IFS"
  IFS=":"
  for DIR in $ISABELLE_DOCS
  do
    [ -f "$DIR/Contents" ] && grep -v "^>>" "$DIR/Contents"
  done
  IFS="$ORIG_IFS"
else
  ORIG_IFS="$IFS"
  IFS=":"
  for DIR in $ISABELLE_DOCS
  do
    [ -f "$DIR/$DOC.dvi" ] && { cd "$DIR"; IFS="$ORIG_IFS"; exec $DVI_VIEWER "$DOC.dvi"; }
  done
  IFS="$ORIG_IFS"
  fail "Unknown Isabelle document: $DOC"  
fi