Home | History | Annotate | Line # | Download | only in man0
tocrc revision 1.1
      1  1.1  mrg #!/bin/sh -
      2  1.1  mrg #
      3  1.1  mrg # Copyright (c) 1993
      4  1.1  mrg #	The Regents of the University of California.  All rights reserved.
      5  1.1  mrg #
      6  1.1  mrg # Redistribution and use in source and binary forms, with or without
      7  1.1  mrg # modification, are permitted provided that the following conditions
      8  1.1  mrg # are met:
      9  1.1  mrg # 1. Redistributions of source code must retain the above copyright
     10  1.1  mrg #    notice, this list of conditions and the following disclaimer.
     11  1.1  mrg # 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  mrg #    notice, this list of conditions and the following disclaimer in the
     13  1.1  mrg #    documentation and/or other materials provided with the distribution.
     14  1.1  mrg # 3. All advertising materials mentioning features or use of this software
     15  1.1  mrg #    must display the following acknowledgement:
     16  1.1  mrg #	This product includes software developed by the University of
     17  1.1  mrg #	California, Berkeley and its contributors.
     18  1.1  mrg # 4. Neither the name of the University nor the names of its contributors
     19  1.1  mrg #    may be used to endorse or promote products derived from this software
     20  1.1  mrg #    without specific prior written permission.
     21  1.1  mrg #
     22  1.1  mrg # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  mrg # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  mrg # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  mrg # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  mrg # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  mrg # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  mrg # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  mrg # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  mrg # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  mrg # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  mrg # SUCH DAMAGE.
     33  1.1  mrg #
     34  1.1  mrg #       @(#)tocrc	8.2 (Berkeley) 5/5/94
     35  1.1  mrg #
     36  1.1  mrg tmp=/tmp/toc$$
     37  1.1  mrg trap "rm $tmp ; exit" 2 3 15
     38  1.1  mrg :   tocx files for all sections and everything else
     39  1.1  mrg 
     40  1.1  mrg if [ ! -f tocx8 ]; then
     41  1.1  mrg 	for x in 1 2 3 4 5 6 7 8; do
     42  1.1  mrg 		/usr/libexec/getNAME -t `cat man$x` |
     43  1.1  mrg 			sed \
     44  1.1  mrg 				-e 's/.s-2//g' \
     45  1.1  mrg 				-e 's/.s-1//g' \
     46  1.1  mrg 				-e 's/.s0//g' \
     47  1.1  mrg 				-e 's/.s+1//g' \
     48  1.1  mrg 				-e 's/  *.-  */: /' \
     49  1.1  mrg 				-e 's/ *$/./' \
     50  1.1  mrg 				-e 's/.TH.*	//' \
     51  1.1  mrg 				-e 's/@g@//' \
     52  1.1  mrg 				-e 's/@G@//' \
     53  1.1  mrg 			> tocx$x
     54  1.1  mrg 	done
     55  1.1  mrg fi
     56  1.1  mrg :   permuted index and toc files
     57  1.1  mrg 
     58  1.1  mrg cat tocx* cshcmd > /tmp/cattoc
     59  1.1  mrg 
     60  1.1  mrg ptx -r -t -b break -f -w 108 -i ignore /tmp/cattoc ptxx
     61  1.1  mrg 
     62  1.1  mrg for x in 1 2 3 4 5 6 7 8; do
     63  1.1  mrg 	grep '^intro' <tocx$x >$tmp
     64  1.1  mrg 	sed \
     65  1.1  mrg 		-e '2,${' \
     66  1.1  mrg 		-e '/^intro/d' \
     67  1.1  mrg 		-e '}' \
     68  1.1  mrg 		-e 's/ .*://' \
     69  1.1  mrg 		-e 's/.$//' \
     70  1.1  mrg 		-e 's/([^)]*) /" "/' \
     71  1.1  mrg 		-e 's/.*/.xx "&"/' \
     72  1.1  mrg 		-e '/""/d' \
     73  1.1  mrg 		$tmp tocx$x \
     74  1.1  mrg 	>toc$x
     75  1.1  mrg done
     76  1.1  mrg exit
     77