home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- organization: Packaging/Interconnect, M.C.C.
- keywords: X11, man, man_burst
- summary: (intended for use with the X11R4 man pages and similar situations.)
- subject: v10i063: man_burst, csh script to expand multi-name mans via .so references
- From: news@cs.utexas.edu.uucp@@uunet.uu.net:emx.utexas.edu
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 63
- Submitted-by: news@cs.utexas.edu.uucp@@uunet.uu.net:emx.utexas.edu
- Archive-name: man_burst.csh
-
- #! /bin/sh
- # This file was wrapped with "dummyshar". "sh" this file to extract.
- # Contents: man_burst.csh
- echo extracting 'man_burst.csh'
- if test -f 'man_burst.csh' -a -z "$1"; then echo Not overwriting 'man_burst.csh'; else
- sed 's/^X//' << \EOF > 'man_burst.csh'
- X#! /bin/csh -fb
- X# shellscript "man_burst", 25.1.1990, unsupported.
- X# Christopher North-Keys (harp@mcc.com <or> erlkonig@ccwf.cc.utexas.edu)
- X#
- X# expand multi-name man pages by adding .so references within the man dir
- X# so that man(1) can find man pages discussing multiple commands.
- X# (intended for use with the X11R4 man pages and similar situations.)
- X#
- X# run within the directory in which the man pages are to be "burst",
- X# then you will probably have to run makewhatis or catman.
- X# test in verbose/no-write mode by running with -w.
- X
- Xif ($#argv > 0) then
- X if ("$argv[1]" == "-w") then
- X set nowrite
- X echo '--------------------NOWRITE mode set (will not write)'
- X endif
- Xendif
- X
- Xset failures = 0
- X
- Xecho $cwd:h | grep -s man\$ ; @ failures += $status
- Xecho $cwd:t | grep -s man ; @ failures += $status
- X
- Xif ($failures) then
- X echo -n $cwd' may not be a directory of manual pages; continue? '
- X if ("$<" != "y") exit 1
- Xendif
- X
- Xset section = `echo $cwd:t | cut -c4-`
- Xset length
- X
- Xforeach file (*)
- X echo Checking $file
- X
- X # attempt to insure that $file is a [nt]roff/tbl/eqn man sourcefile
- X file $file | grep -s 'roff'
- X if ($status) then
- X head -1 $file | grep -s '\.so'
- X if !($status) then
- X echo $file refers to another manual page.
- X continue
- X endif
- X echo $file' does not appear to be a manual page; skipping.'
- X continue
- X endif
- X
- X set startline = `egrep -n ".SH NAME" $file | cut -d: -f1`
- X @ startline ++
- X set endline = `egrep -n ".SH SYNTAX"\|".SH STRUCTURES" $file | cut -d: -f1`
- X @ length = $endline - $startline
- X set names = `tail +${startline} $file | head -${length} | tr -d "," `
- X
- X set suffix = $file:e
- X foreach name ($names)
- X set target = ${name}.$suffix
- X
- X if (("$name" == "\-") || ("$name" == "\")) break
- X
- X echo " "${name}
- X if (-e $target) then
- X echo already exists as $target
- X continue
- X endif
- X
- X if ($?nowrite) then
- X echo "echo .so man${section}/${file} > $target"
- X else
- X echo ".so man${section}/${file}" > $target
- X endif
- X end
- Xend
- EOF
- chars=`wc -c < 'man_burst.csh'`
- if test $chars != 1961; then echo 'man_burst.csh' is $chars characters, should be 1961 characters!; fi
- fi
- exit 0
-
- ------------------------------------/\----------------------------------------
- Seo: Harp[@Mcc.Com] / \/\ ^*^ Christopher North-Keys
- Tha mi gu trang a'cluich. / \ \ Assoc. Systems Analyst, MCC
- --------------------------------(disclaimer)----------------------------------
-