diff options
Diffstat (limited to 'macros/plain/contrib/pdcmac/dtxtags')
-rw-r--r-- | macros/plain/contrib/pdcmac/dtxtags | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/macros/plain/contrib/pdcmac/dtxtags b/macros/plain/contrib/pdcmac/dtxtags new file mode 100644 index 0000000000..97c5949c6f --- /dev/null +++ b/macros/plain/contrib/pdcmac/dtxtags @@ -0,0 +1,67 @@ +#! /bin/sh
+
+# dtxtags -- getenerate a TAGS file for the DTX files
+version="1.1 Time-stamp: <pdc 1995-04-06>"
+
+# The grep line produces LINE:BYTE:PATTERN
+# the sed converts this to LINE:BYTE:PATTERN:TAG
+
+tmp=${TMP-/tmp}/mktags$$
+trap 'rm -f $tmp*' 0
+
+me=`basename $0`
+outfile=TAGS
+
+touch $tmp
+while test $# -gt 0; do
+ case $1 in
+ --o*=*)
+ outfile=`expr $1 : '.*=\(.*\)$'` ;;
+ -o|--o*)
+ outfile=$2; shift ;;
+ -o*)
+ outfile=`expr $1 : '-.\(.*\)$'` ;;
+ -h|--h*)
+ cat <<@EOF
+$me: construct an etags-style tags file from DTX files.
+
+USAGE:
+ $me [ --output=OUTFILE ] [ INFILE... ]
+ $me --help | --version
+@EOF
+ exit 0 ;;
+ -V|--v*)
+ echo This is $me $version
+ exit 0 ;;
+ -*)
+ echo >&2 $me: $1: not understood, try $me --help
+ exit 2 ;;
+ *)
+ i=$1
+ echo >&2 $1:
+ egrep -nb '^[ ]\|[ ]*\\([a-z]*def|new)' <$1 |
+ sed '
+ s/\([ ]*|\\[a-z]*\\[A-Za-z]*\).*$/\1/
+ t finish
+ s/\([ ]*|\\[a-z]*\\.\).*$/\1/
+ t finish
+ s/\([ ]*|\\[a-z]*[^a-z]\).*$/\1/
+ : finish
+ s/\([0-9]*\):\([0-9]*\):\(.*\)/\3\1,\2/
+ ' > $tmp.a
+ wc $tmp.a
+ echo '' >> $tmp
+ echo $1,`wc -c <$tmp.a` >>$tmp
+ cat $tmp.a >> $tmp
+ ;;
+ esac
+ shift
+
+done
+
+mv 2>/dev/null $outfile $outfile.bak &&
+echo >&2 backup written to $outfile.bak
+
+mv $tmp $outfile
+
+exit 0
|