sgml2x-1.0.0/0040755000175000001440000000000007657002604012137 5ustar dwitchuserssgml2x-1.0.0/bin/0040755000175000001440000000000007657002601012704 5ustar dwitchuserssgml2x-1.0.0/bin/rlatex0100755000175000001440000000106307374511346014135 0ustar dwitchusers#!/bin/sh set -e LATEXPRG=${LATEXPRG:-latex} while true; do pid=$$ export pid rm -f /tmp/rlok$pid ( if ${LATEXPRG} $* then touch /tmp/rlok$pid fi ) | tee /tmp/rlso$pid if [ ! -f /tmp/rlok$pid ] then rm -f /tmp/rlso$pid echo >&2 "$(basename $0): Exiting in error" exit 1 fi if ! grep -E '^(LaTeX Warning: (Label\(s\) may|There were undefined references)|Package longtable Warning: Table widths have changed)' /tmp/rlso$pid >/dev/null then rm -f /tmp/rlso$pid exit 0 fi echo "Re-running LaTeX" done sgml2x-1.0.0/bin/runjade0100755000175000001440000000375607501412470014267 0ustar dwitchusers#! /usr/bin/perl -w # This is a wrapper around *jade. Some versions of *jade have the # nasty habit of returning a zero exit status, even when they detected # an error. This scripts scans the output on-the-fly, and exits 1 if # it finds an error. # It also filters out those highly poluting "DTDDECL catalog entries # are not supported" warnings that openjade 1.3.1 prints (presumably a # limitation of opensp 1.3.4, to be lifted if/when a 1.3.2 is released # with opensp-1.5 support, or when openjade-1.4 becomes usable). use strict; use POSIX; # for WEXITSTATUS & Co # check usage #die "command to run must be one single argument" unless $#ARGV == 0; pipe RDHDL, WRHDL or die "pipe"; # mechanism to record child termination my $childlives = 1; sub hdl { $childlives = 0; } $SIG{CHLD} = \&hdl; my $pid = fork; die "fork" unless defined $pid; # run child if ($pid == 0) { # child $SIG{CHLD} = 'DEFAULT'; close RDHDL; open (STDERR, ">&WRHDL"); close WRHDL; exec @ARGV or die "exec"; # NOTREACHED exit 1; } close WRHDL; # record errors my $errors = 0; do { # don't go further if we have nothing to read yet my ($rin, $win, $ein); $rin = $win = ''; vec($rin,fileno(RDHDL),1) = 1; $ein = $rin; select ($rin, $win, $ein, undef) or die "select"; while () { $errors++ if m/:[0-9]*:[0-9]*:E:/; print STDERR $_ unless m/:W: DTDDECL catalog entries are not supported/; } } while $childlives; # wait for child to get its exit status my $kid = wait; die "death of unexpected child $kid" if $kid != $pid; if (WIFEXITED($?)) { if (WEXITSTATUS($?) == 0) { die "command found $errors error(s) but forgot to set exit status" if $errors > 0; } else { exit (WEXITSTATUS($?)); } } elsif (WIFSIGNALED($?)) { printf STDERR "command got signal %d\n", WTERMSIG($?); raise (WTERMSIG($?)); } elsif (WIFSTOPPED($?)) { printf STDERR "command stopped by signal %d\n", WSTOPSIG($?); die "unexpected condition"; } else { die "invalid status $?"; } exit 0; sgml2x-1.0.0/bin/sgml2x0100755000175000001440000003760007656777116014074 0ustar dwitchusers#!/bin/bash set -e MYVERSION=@VERSION@ # parse invocation name and dir SCRIPTNAME=$(basename "$0") ORIGDIR=$(pwd) SCRIPTDIR=$(dirname "$0") case ${SCRIPTDIR} in /*) : ;; *) SCRIPTDIR=${ORIGDIR}/${SCRIPTDIR} ;; esac # First, try "docclass-2-target", then obsolete "docclass2target" SINGLEDOCCLASS=${SCRIPTNAME%-2-*} if [ "x$SINGLEDOCCLASS" != "x$SCRIPTNAME" ] then TARGETFORMAT=${SCRIPTNAME#${SINGLEDOCCLASS}-2-} else SINGLEDOCCLASS=${SCRIPTNAME%2*} TARGETFORMAT=${SCRIPTNAME#${SINGLEDOCCLASS}2} fi # if called as sgml2xxx, don't assume a single docclass #[ "${SINGLEDOCCLASS}" != sgml ] || SINGLEDOCCLASS= # stdlib error() { echo >&2 "ERROR: ${SCRIPTNAME}: $*" exit 1 } warn() { [ $VERBOSITY -lt 1 ] || echo >&2 "Warning: ${SCRIPTNAME}: $*" } notice() { [ $VERBOSITY -lt 2 ] || echo >&2 "Notice: ${SCRIPTNAME}: $*" } trace() { [ $VERBOSITY -lt 3 ] || echo >&2 "Trace: ${SCRIPTNAME}: $*" } debug() { [ $VERBOSITY -lt 4 ] || echo >&2 "Debug: ${SCRIPTNAME}: $*" } translate_verbosity() { case "$1" in quiet) echo 0 ;; default) echo 1 ;; verbose) echo 2 ;; trace) echo 3 ;; debug) echo 4 ;; *) error "unknown verbosity \`$1'" ;; esac } version() { echo "sgml2x version ${MYVERSION}" exit 0 } usage() { # ensure the conf has been read if [ -z "${BACKENDS}" ] then readconf fi local stylefmt=' %15s : %s\n' # usage message cat < [ ...] Options: -c|--catalog use specified SGML catalog -C|--confdirs use (whitespace-separated) list of confdirs (cumulative) default: "${DEFAULTCONFDIRS}" -r|--remarks include remarks in document -D|--dssslproc select the dsssl processor to use -j|--jade [DEPRECATED] synonym for --dssslproc -o|--openjade [DEPRECATED] use openjade to format (now the default) -O|--jadeopts pass additionnal options to jade (cumulative) --jadetexfilter a perl filter, with enough quotes (use -n to check) -n|--no-act print commands instead of running them -q|--quiet set verbosity to 0 -v|--verbose increase verbosity (cumulative) -V|--version print the version of this program --verbosity set verbosity to (default: "default") -s|--style