#!/bin/sh
#
# jadetex: Wrapper script to run JadeTeX
# David Maze <dmaze@mit.edu>
# 3 Oct 2000
# Bug reports to...?  Maybe <bug-outland@mit.edu>.
#

# Sanity check: make sure we're not using newtex, since it'll probably lose.
case `which virtex 2>/dev/null` in
*newtex*)
  echo "WARNING: Using TeX out of the 'newtex' locker.  There are no" >&2
  echo "guarantees that JadeTeX will work in this configuration." >&2
  ;;
*) ;;
esac

# Sanity check: make sure TEXMFCNF isn't already set.
if test ${TEXMFCNF:-unset} != unset
then
  echo "WARNING: the TEXMFCNF environment variable is already set." >&2
  echo "Overriding its setting." >&2
fi

# Set TEXMFCNF to point to the directory containing our texmf.cnf file.
TEXMFCNF=/mit/sgml/share/jadetex
export TEXMFCNF

# Set TEXFORMATS to look for JadeTeX in the right place.  Note that
# this will always have the behavior we want: if TEXFORMATS is unset,
# we get a trailing colon (with the default search path).  Otherwise,
# TEXFORMATS either has a leading colon, in which case it will now
# have a double colon and the default search path is where we expect,
# or it doesn't, and will now only have a single colon (and no default
# search path).
TEXFORMATS=/mit/sgml/share/jadetex:$TEXFORMATS
export TEXFORMATS

# Now go off and run JadeTeX.
exec virtex -progname=`basename $0` "$@"
