diff options
Diffstat (limited to 'toc')
-rw-r--r-- | toc/Makefile | 5 | ||||
-rwxr-xr-x | toc/gtoc (renamed from toc/groc) | 2 | ||||
-rwxr-xr-x | toc/toc | 31 | ||||
-rwxr-xr-x | toc/troc | 17 |
4 files changed, 36 insertions, 19 deletions
diff --git a/toc/Makefile b/toc/Makefile index 6cf0b74..3211efd 100644 --- a/toc/Makefile +++ b/toc/Makefile @@ -1,2 +1,5 @@ +README.pdf: README.t + ./gtoc -Tps README.t | ps2pdf - > README.pdf + example.pdf: example.t - ./groc -Tps example.t | ps2pdf - > example.pdf + ./gtoc -Tps example.t | ps2pdf - > example.pdf @@ -1,4 +1,4 @@ #!/bin/sh export TROFF=groff -exec=${0%groc}troc +exec=${0%gtoc}toc exec "$exec" "$@" @@ -0,0 +1,31 @@ +#!/bin/sh + +# toc -- run troff in three passes + +: ${TROFF:=troff} + +if [ ! -t 0 ]; then + f=`mktemp` + cat > $f + set -- "$@" $f +fi + +if [ -z "$PIPE" ]; then + g=`mktemp` + h=`mktemp` + + 2>$g >/dev/null $TROFF -rte=1 -rto=0 -E "$@" + <$g 2>$h >/dev/null $TROFF -rte=1 -rto=1 -E "$@" + <$h $TROFF -rte=0 -rto=1 "$@" + s=$? + + rm $h $g +else + $TROFF -rte=1 -rto=0 -zE "$@" 2>&1 | + $TROFF -rte=1 -rto=1 -zE "$@" 2>&1 | + $TROFF -rte=0 -rto=1 "$@" + s=$? +fi + +[ ! -t 0 ] && rm $f +exit $s diff --git a/toc/troc b/toc/troc deleted file mode 100755 index 8577531..0000000 --- a/toc/troc +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -: ${TROFF:=troff} - -if [ ! -t 0 ]; then - f=`mktemp` - cat > "$f" - set -- "$@" "$f" -fi - -"$TROFF" -rte=1 -rto=0 -zE "$@" 2>&1 | -"$TROFF" -rte=1 -rto=1 -zE "$@" 2>&1 | -"$TROFF" -rte=0 -rto=1 "$@" -s=$? - -[ ! -t 0 ] && rm "$f" -exit $s |