summaryrefslogtreecommitdiffstats
path: root/unix/installManPage
diff options
context:
space:
mode:
authorrmax <rmax>2004-11-18 00:43:18 (GMT)
committerrmax <rmax>2004-11-18 00:43:18 (GMT)
commit1b1920d3460f86d0c8c303446d121a41ddb8d8cf (patch)
treeeb3d98f33e7546cdfea54fec2d52cde3b5d61de5 /unix/installManPage
parentbe0dcd9c9fe40b3e3b42c40165565551ba19e8b4 (diff)
downloadtk-1b1920d3460f86d0c8c303446d121a41ddb8d8cf.zip
tk-1b1920d3460f86d0c8c303446d121a41ddb8d8cf.tar.gz
tk-1b1920d3460f86d0c8c303446d121a41ddb8d8cf.tar.bz2
2004-11-18 Reinhard Max <max@suse.de>
* unix/tcl.m4 (SC_CONFIG_MANPAGES): Applied an improved version of * unix/configure.in: patch #996085, that introduces * unix/Makefile.in: --enable-man-suffix. * unix/installManPage: added * unix/mkLinks: removed
Diffstat (limited to 'unix/installManPage')
-rwxr-xr-xunix/installManPage51
1 files changed, 51 insertions, 0 deletions
diff --git a/unix/installManPage b/unix/installManPage
new file mode 100755
index 0000000..16cf005
--- /dev/null
+++ b/unix/installManPage
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+ZIP=:
+while true; do
+ case $1 in
+ -s | --symlinks ) S="-s ";;
+ -z | --compress ) ZIP=$2; shift ;;
+ -e | --extension ) Z=$2; shift ;;
+ -s | --suffix ) SUFFIX=$2; shift ;;
+ *) break ;;
+ esac
+ shift
+done
+if test "$#" != 2; then
+ echo "Usage: installManPages <options> file dir"
+ exit 1
+fi
+
+MANPAGE=$1
+DIR=$2
+test -z "$S" && S="$DIR/"
+
+# Backslashes are trippled in the sed script, because it is in backticks
+# which don't pass backslashes literally.
+NAMES=`sed -n '
+ /^\\.SH NAME/{ # Look for a line, that starts with .SH NAME
+ s/^.*$// # Delete the content of this line from the buffer
+ n # Read next line
+ s/,\|\\\ //g # Remove all commas
+ s/ \\\-.*// # Delete from \- to the end of line
+ p # print the result
+ q
+ }' $MANPAGE`
+
+SECTION=`echo $MANPAGE | sed 's/.*\(.\)$/\1/'`
+SRCDIR=`dirname $MANPAGE`
+FIRST=""
+for f in $NAMES; do
+ f=$f.$SECTION$SUFFIX
+ if test -z "$FIRST" ; then
+ FIRST=$f
+ rm -f $DIR/$FIRST $DIR/$FIRST.*
+ sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
+ $MANPAGE > $DIR/$FIRST
+ chmod 444 $DIR/$FIRST
+ $ZIP $DIR/$FIRST
+ else
+ rm -f $DIR/$f $DIR/$f.*
+ ln $S$FIRST$Z $DIR/$f$Z
+ fi
+done