summaryrefslogtreecommitdiffstats
path: root/unix/installManPage
diff options
context:
space:
mode:
Diffstat (limited to 'unix/installManPage')
-rwxr-xr-xunix/installManPage71
1 files changed, 23 insertions, 48 deletions
diff --git a/unix/installManPage b/unix/installManPage
index 3d5fa7b..6bdccf0 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -5,14 +5,13 @@
###
Gzip=:
-Sym=""
-Loc=""
+SymOrLoc=""
Gz=""
Suffix=""
while true; do
case $1 in
- -s | --symlinks ) Sym="-s " ;;
+ -s | --symlinks ) SymOrLoc="-s " ;;
-z | --compress ) Gzip=$2; shift ;;
-e | --extension ) Gz=$2; shift ;;
-x | --suffix ) Suffix=$2; shift ;;
@@ -44,11 +43,11 @@ if test -f $ManPage ; then : ; else
echo "source manual page file must exist"
exit 1
fi
-if test -d "$Dir" ; then : ; else
+if test -d $Dir ; then : ; else
echo "target directory must exist"
exit 1
fi
-test -z "$Sym" && Loc="$Dir/"
+test -z "$SymOrLoc" && SymOrLoc="$Dir/"
########################################################################
### Extract Target Names from Manual Page
@@ -60,36 +59,20 @@ test -z "$Sym" && Loc="$Dir/"
# backticks which doesn't pass backslashes literally.
#
Names=`sed -n '
-# Look for a line that starts with .SH NAME
- /^\.SH NAME/,/^\./{
-
-
- /^\./!{
-
- # Remove all commas...
- s/,//g
-
- # ... and backslash-escaped spaces.
- s/\\\ //g
-
- /\\\-.*/{
- # Delete from \- to the end of line
- s/ \\\-.*//
- h
- s/.*/./
- x
- }
-
- # Convert all non-space non-alphanum sequences
- # to single underscores.
- s/[^ A-Za-z0-9][^ A-Za-z0-9]*/_/g
- p
- g
- /^\./{
- q
- }
- }
-
+# Look for a line, that starts with .SH NAME
+# optionally allow NAME to be surrounded
+# by quotes.
+ /^\.SH NAME/{
+# Read next line
+ n
+# Remove all commas ...
+ s/,//g
+# ... and backslash-escaped spaces.
+ s/\\\ //g
+# Delete from \- to the end of line
+ s/ \\\-.*//
+# print the result and exit
+ p;q
}' $ManPage`
if test -z "$Names" ; then
@@ -108,32 +91,24 @@ case $ManPage in
exit 2 ;;
esac
-Name=`basename $ManPage .$Section`
SrcDir=`dirname $ManPage`
########################################################################
### Process Page to Create Target Pages
###
-Specials="DString Thread Notifier RegExp library packagens pkgMkIndex safesock FindPhoto FontId MeasureChar"
-for n in $Specials; do
- if [ "$Name" = "$n" ] ; then
- Names="$n $Names"
- fi
-done
-
First=""
for Target in $Names; do
Target=$Target.$Section$Suffix
- rm -f "$Dir/$Target" "$Dir/$Target.*"
+ rm -f $Dir/$Target $Dir/$Target.*
if test -z "$First" ; then
First=$Target
sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
- $ManPage > "$Dir/$First"
- chmod 644 "$Dir/$First"
- $Gzip "$Dir/$First"
+ $ManPage > $Dir/$First
+ chmod 444 $Dir/$First
+ $Gzip $Dir/$First
else
- ln $Sym"$Loc$First$Gz" "$Dir/$Target$Gz"
+ ln $SymOrLoc$First$Gz $Dir/$Target$Gz
fi
done