1ebfedea0SLionel Sambuc#!/bin/sh 2ebfedea0SLionel Sambuc# 3ebfedea0SLionel Sambuc# Id 4ebfedea0SLionel Sambuc# 5ebfedea0SLionel Sambuc# install preformatted manual pages 6ebfedea0SLionel Sambuc 7ebfedea0SLionel Sambuccmd="$1"; shift 8ebfedea0SLionel SambucINSTALL_DATA="$1"; shift 9ebfedea0SLionel Sambucmkinstalldirs="$1"; shift 10ebfedea0SLionel Sambucsrcdir="$1"; shift 11ebfedea0SLionel Sambucmanbase="$1"; shift 12ebfedea0SLionel Sambucsuffix="$1"; shift 13ebfedea0SLionel Sambuccatinstall="${INSTALL_CATPAGES-yes}" 14ebfedea0SLionel Sambuc 15ebfedea0SLionel Sambucfor f in "$@"; do 16ebfedea0SLionel Sambuc echo $f 17*0a6a1f1dSLionel Sambuc base=`echo "$f" | sed 's/\.[^.]*$//'` 18*0a6a1f1dSLionel Sambuc section=`echo "$f" | sed 's/^[^.]*\.//'` 19ebfedea0SLionel Sambuc mandir="$manbase/man$section" 20ebfedea0SLionel Sambuc catdir="$manbase/cat$section" 21ebfedea0SLionel Sambuc c="$base.cat$section" 22ebfedea0SLionel Sambuc 23ebfedea0SLionel Sambuc if test "$catinstall" = yes -a -f "$srcdir/$c"; then 24ebfedea0SLionel Sambuc if test "$cmd" = install ; then 25ebfedea0SLionel Sambuc if test \! -d "$catdir"; then 26ebfedea0SLionel Sambuc eval "$mkinstalldirs $catdir" 27ebfedea0SLionel Sambuc fi 28ebfedea0SLionel Sambuc eval "echo $INSTALL_DATA $srcdir/$c $catdir/$base.$suffix" 29ebfedea0SLionel Sambuc eval "$INSTALL_DATA $srcdir/$c $catdir/$base.$suffix" 30ebfedea0SLionel Sambuc elif test "$cmd" = uninstall ; then 31ebfedea0SLionel Sambuc eval "echo rm -f $catdir/$base.$suffix" 32ebfedea0SLionel Sambuc eval "rm -f $catdir/$base.$suffix" 33ebfedea0SLionel Sambuc fi 34ebfedea0SLionel Sambuc fi 35ebfedea0SLionel Sambuc for link in `sed -n -e '/SYNOPSIS/q;/DESCRIPTION/q;s/^\.Nm \([^ ]*\).*/\1/p' $srcdir/$f`; do 36ebfedea0SLionel Sambuc if test "$link" = "$base" ; then 37ebfedea0SLionel Sambuc continue 38ebfedea0SLionel Sambuc fi 39ebfedea0SLionel Sambuc if test "$cmd" = install ; then 40ebfedea0SLionel Sambuc target="$mandir/$link.$section" 41ebfedea0SLionel Sambuc for lncmd in "ln -f $mandir/$base.$section $target" \ 42ebfedea0SLionel Sambuc "ln -s $base.$section $target" \ 43ebfedea0SLionel Sambuc "cp -f $mandir/$base.$section $target" 44ebfedea0SLionel Sambuc do 45ebfedea0SLionel Sambuc if eval "$lncmd"; then 46ebfedea0SLionel Sambuc eval echo "$lncmd" 47ebfedea0SLionel Sambuc break 48ebfedea0SLionel Sambuc fi 49ebfedea0SLionel Sambuc done 50ebfedea0SLionel Sambuc if test "$catinstall" = yes -a -f "$srcdir/$c"; then 51*0a6a1f1dSLionel Sambuc eval target="$catdir/$link.$suffix" 52*0a6a1f1dSLionel Sambuc eval source="$catdir/$base.$suffix" 53*0a6a1f1dSLionel Sambuc for lncmd in "ln -f $source $target" \ 54*0a6a1f1dSLionel Sambuc "ln -fs $source $target" \ 55*0a6a1f1dSLionel Sambuc "cp -f $catdir/$source $target" 56ebfedea0SLionel Sambuc do 57ebfedea0SLionel Sambuc if eval "$lncmd"; then 58ebfedea0SLionel Sambuc eval echo "$lncmd" 59ebfedea0SLionel Sambuc break 60ebfedea0SLionel Sambuc fi 61ebfedea0SLionel Sambuc done 62ebfedea0SLionel Sambuc fi 63ebfedea0SLionel Sambuc elif test "$cmd" = uninstall ; then 64ebfedea0SLionel Sambuc target="$mandir/$link.$section" 65ebfedea0SLionel Sambuc eval "echo rm -f $target" 66ebfedea0SLionel Sambuc eval "rm -f $target" 67ebfedea0SLionel Sambuc if test "$catinstall" = yes; then 68ebfedea0SLionel Sambuc target="$catdir/$link.$suffix" 69ebfedea0SLionel Sambuc eval "echo rm -f $target" 70ebfedea0SLionel Sambuc eval "rm -f $target" 71ebfedea0SLionel Sambuc fi 72ebfedea0SLionel Sambuc fi 73ebfedea0SLionel Sambuc done 74ebfedea0SLionel Sambucdone 75