#!/usr/bin/env sh ## ## wrapper for chklref program ## Automatically generated by configure from chklref.in ## ######################################################################### # Written and (C) by Jérôme Lelong # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # ######################################################################### prefix=@prefix@ bindir=@bindir@ SCRIPTSDIR=@SCRIPTSDIR@ PERL=@perl_path@ LATEX=@latex_path@ PDFLATEX=@pdflatex_path@ print_usage() { printf "usage: chklref [-d] [-q] [-p] file[.tex]\n"; printf "\t-p : use pdflatex instead of latex\n"; printf "\t-q : latex runs silently\n"; printf "\t-d : debugging mode\n"; printf "\t-h : displays this help\n"; } out='/dev/stdout' latex_cmd=$LATEX debug=0 while getopts "pqhd" Option do case $Option in p) latex_cmd=$PDFLATEX;; h) print_usage; exit 0;; q) out='/dev/null';; d) debug=1;; *) printf "illegal option\n"; print_usage; exit 0;; esac done shift $(($OPTIND - 1)) if [ $# -ne 1 ]; then print_usage; exit 0; fi # POSIX extractions of dirname and basename basetexfile=${1##*/} basetexfile=${basetexfile%.tex} dirtexfile=${1%/*} if [ "${dirtexfile}" = "$1" ]; then dirtexfile="."; fi cd -- "${dirtexfile}" printf "Running $latex_cmd on $basetexfile.tex to collect labels, references and environment declarations\n\n" $latex_cmd --interaction errorstopmode "${basetexfile}" > "$out" 2>&1 rm -f -- "$basetexfile".tex.chk $latex_cmd --interaction errorstopmode --jobname "$basetexfile" \ '\RequirePackage{chklref}\input' "{$basetexfile.tex}" > "$out" 2>&1 $PERL "$SCRIPTSDIR"/chkparser "$basetexfile".tex.chk [ $debug -ne 0 ] || rm -f -- "$basetexfile".tex.chk