3 ########################################################################
14 -s | --symlinks ) SymOrLoc="-s " ;;
15 -z | --compress ) Gzip=$2; shift ;;
16 -e | --extension ) Gz=$2; shift ;;
17 -x | --suffix ) Suffix=$2; shift ;;
19 Unknown option "$1". Supported options:
20 -s Use symbolic links for manpages with multiple names.
21 -z PROG Use PROG to compress manual pages.
22 -e EXT Defines the extension added by -z PROG when compressing.
23 -x SUFF Defines an extra extension suffix to use.
24 Option names may not be combined getopt-style.
31 if test "$#" != 2; then
32 echo "Usage: installManPages <options> file dir"
36 ########################################################################
37 ### Parse Required Arguments
42 if test -f $ManPage ; then : ; else
43 echo "source manual page file must exist"
46 if test -d "$Dir" ; then : ; else
47 echo "target directory must exist"
50 test -z "$SymOrLoc" && SymOrLoc="$Dir/"
52 ########################################################################
53 ### Extract Target Names from Manual Page
56 # A sed script to parse the alternative names out of a man page.
58 # Backslashes are trippled in the sed script, because it is in
59 # backticks which doesn't pass backslashes literally.
62 # Look for a line that starts with .SH NAME
66 # Remove all commas ...
68 # ... and backslash-escaped spaces.
70 # Delete from \- to the end of line
72 # Convert all non-space non-alphanum sequences
73 # to single underscores.
74 s/[^ A-Za-z0-9][^ A-Za-z0-9]*/_/g
75 # print the result and exit
79 if test -z "$Names" ; then
80 echo "warning: no target names found in $ManPage"
83 ########################################################################
91 *) echo "unknown section for $ManPage"
95 Name=`basename $ManPage .$Section`
96 SrcDir=`dirname $ManPage`
98 ########################################################################
99 ### Process Page to Create Target Pages
102 Specials="DString Thread Notifier RegExp library packagens pkgMkIndex safesock FindPhoto FontId MeasureChar"
103 for n in $Specials; do
104 if [ "$Name" = "$n" ] ; then
110 for Target in $Names; do
111 Target=$Target.$Section$Suffix
112 rm -f "$Dir/$Target" "$Dir/$Target.*"
113 if test -z "$First" ; then
115 sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
116 $ManPage > "$Dir/$First"
117 chmod 644 "$Dir/$First"
120 ln $SymOrLoc"$First$Gz" "$Dir/$Target$Gz"
124 ########################################################################