From b867e112fe62cb72b09ae7c379dfc9eabd013d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 23 Jun 2021 02:23:15 +0200 Subject: Rename troc/groc to toc/gtoc --- toc/Makefile | 5 ++++- toc/groc | 4 ---- toc/gtoc | 4 ++++ toc/toc | 31 +++++++++++++++++++++++++++++++ toc/troc | 17 ----------------- 5 files changed, 39 insertions(+), 22 deletions(-) delete mode 100755 toc/groc create mode 100755 toc/gtoc create mode 100755 toc/toc delete mode 100755 toc/troc (limited to 'toc') 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 diff --git a/toc/groc b/toc/groc deleted file mode 100755 index 80a65a2..0000000 --- a/toc/groc +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -export TROFF=groff -exec=${0%groc}troc -exec "$exec" "$@" diff --git a/toc/gtoc b/toc/gtoc new file mode 100755 index 0000000..f64ddbe --- /dev/null +++ b/toc/gtoc @@ -0,0 +1,4 @@ +#!/bin/sh +export TROFF=groff +exec=${0%gtoc}toc +exec "$exec" "$@" diff --git a/toc/toc b/toc/toc new file mode 100755 index 0000000..2b21790 --- /dev/null +++ b/toc/toc @@ -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 -- cgit v1.2.3