usr/src/cmd/man/src/makewhatis.sh
changeset 13131 374aa7839ed5
parent 0 68f95e015346
equal deleted inserted replaced
13130:e192495818d4 13131:374aa7839ed5
     1 #!/bin/sh -
     1 #!/bin/sh -
     2 #
     2 #
     3 # CDDL HEADER START
     3 # CDDL HEADER START
     4 #
     4 #
     5 # The contents of this file are subject to the terms of the
     5 # The contents of this file are subject to the terms of the
     6 # Common Development and Distribution License, Version 1.0 only
     6 # Common Development and Distribution License (the "License").
     7 # (the "License").  You may not use this file except in compliance
     7 # You may not use this file except in compliance with the License.
     8 # with the License.
       
     9 #
     8 #
    10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    11 # or http://www.opensolaris.org/os/licensing.
    10 # or http://www.opensolaris.org/os/licensing.
    12 # See the License for the specific language governing permissions
    11 # See the License for the specific language governing permissions
    13 # and limitations under the License.
    12 # and limitations under the License.
    19 # information: Portions Copyright [yyyy] [name of copyright owner]
    18 # information: Portions Copyright [yyyy] [name of copyright owner]
    20 #
    19 #
    21 # CDDL HEADER END
    20 # CDDL HEADER END
    22 #
    21 #
    23 #
    22 #
    24 # Copyright (c) 1998 by Sun Microsystems, Inc.
    23 # Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
    25 # All rights reserved
       
    26 #
    24 #
    27 #	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
    25 #	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
    28 #	  All Rights Reserved
    26 #	  All Rights Reserved
    29 #
    27 #
    30 
    28 
    33 # All Rights Reserved
    31 # All Rights Reserved
    34 #
    32 #
    35 # University Acknowledgment- Portions of this document are derived from
    33 # University Acknowledgment- Portions of this document are derived from
    36 # software developed by the University of California, Berkeley, and its
    34 # software developed by the University of California, Berkeley, and its
    37 # contributors
    35 # contributors
    38 
       
    39 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.2	*/
       
    40 
    36 
    41 PATH=/usr/xpg4/bin:$PATH
    37 PATH=/usr/xpg4/bin:$PATH
    42 
    38 
    43 tmpdir=/tmp/whatis.$$
    39 tmpdir=/tmp/whatis.$$
    44 trap "rm -rf $tmpdir; exit 1" 1 2 13 15
    40 trap "rm -rf $tmpdir; exit 1" 1 2 13 15
    66 	-e 's/\\-/-/' \
    62 	-e 's/\\-/-/' \
    67 	-e 's/\\\*-/-/' \
    63 	-e 's/\\\*-/-/' \
    68 	-e 's/ VAX-11//' \
    64 	-e 's/ VAX-11//' \
    69 	-e 's/\\f[PRIB01234]//g' \
    65 	-e 's/\\f[PRIB01234]//g' \
    70 	-e 's/\\s[-+0-9]*//g' \
    66 	-e 's/\\s[-+0-9]*//g' \
       
    67 	-e 's/\\&//g' \
    71 	-e '/ - /!d' \
    68 	-e '/ - /!d' \
    72 	-e 's/.TH [^ ]* \([^ 	]*\).*	\(.*\) -/\2 (\1)	 -/' \
    69 	-e 's/.TH [^ ]* \([^ 	]*\).*	\(.*\) -/\2 (\1)	 -/' \
    73 	-e 's/	 /	/g' | \
    70 	-e 's/	 /	/g' | \
    74 awk '{	title = substr($0, 1, index($0, "- ") - 1)
    71 awk '{	title = substr($0, 1, index($0, "- ") - 1)
    75 	synop = substr($0, index($0, "- "))
    72 	synop = substr($0, index($0, "- "))
    79 			n[i] = substr(n[i], 1, pos-1)
    76 			n[i] = substr(n[i], 1, pos-1)
    80 		printf("%s\t%s %s\t%s\n", n[i], n[1], n[count], synop)
    77 		printf("%s\t%s %s\t%s\n", n[i], n[1], n[count], synop)
    81 	}
    78 	}
    82 }' >$tmpdir/whatis
    79 }' >$tmpdir/whatis
    83 /usr/bin/expand -16,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100 \
    80 /usr/bin/expand -16,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100 \
    84 	$tmpdir/whatis | LC_CTYPE=C LC_COLLATE=C sort | \
    81 	$tmpdir/whatis | LC_CTYPE=C LC_COLLATE=C sort -u | \
    85 	/usr/bin/unexpand -a > windex
    82 	/usr/bin/unexpand -a > windex
    86 chmod 644 windex >/dev/null 2>&1
    83 chmod 644 windex >/dev/null 2>&1
    87 rm -rf $tmpdir
    84 rm -rf $tmpdir
    88 exit 0
    85 exit 0