2001-02-13 16:46:19 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-02-19 15:46:56 +00:00
|
|
|
# $Id: install-catman.sh,v 1.3 2001/09/29 16:05:38 assar Exp $
|
2001-02-13 16:46:19 +00:00
|
|
|
#
|
|
|
|
# install preformatted manual pages
|
|
|
|
|
|
|
|
INSTALL_DATA="$1"; shift
|
|
|
|
mkinstalldirs="$1"; shift
|
|
|
|
srcdir="$1"; shift
|
2002-02-19 15:46:56 +00:00
|
|
|
manbase="$1"; shift
|
2001-02-13 16:46:19 +00:00
|
|
|
suffix="$1"; shift
|
|
|
|
|
|
|
|
for f in "$@"; do
|
|
|
|
base=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\1/'`
|
|
|
|
section=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\2/'`
|
2002-02-19 15:46:56 +00:00
|
|
|
mandir="$manbase/man$section"
|
|
|
|
catdir="$manbase/cat$section"
|
2001-02-13 16:46:19 +00:00
|
|
|
c="$base.cat$section"
|
2002-02-19 15:46:56 +00:00
|
|
|
|
2001-02-13 16:46:19 +00:00
|
|
|
if test -f "$srcdir/$c"; then
|
|
|
|
if test \! -d "$catdir"; then
|
|
|
|
eval "$mkinstalldirs $catdir"
|
|
|
|
fi
|
|
|
|
eval "echo $INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
|
|
|
|
eval "$INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
|
|
|
|
fi
|
2002-02-19 15:46:56 +00:00
|
|
|
for link in `sed -n -e '/SYNOPSIS/q;/DESCRIPTION/q;s/^\.Nm \([^ ]*\).*/\1/p' $srcdir/$f`; do
|
|
|
|
if [ "$link" != "$base" ]; then
|
|
|
|
target="$mandir/$link.$section"
|
|
|
|
for cmd in "ln -f $mandir/$base.$section $target" \
|
|
|
|
"ln -s $base.$section $target" \
|
|
|
|
"cp -f $mandir/$base.$section $target"
|
|
|
|
do
|
|
|
|
if eval "$cmd"; then
|
|
|
|
eval echo "$cmd"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if test -f "$srcdir/$c"; then
|
|
|
|
target="$catdir/$link.$suffix"
|
|
|
|
for cmd in "ln -f $catdir/$base.$suffix $target" \
|
|
|
|
"ln -fs $base.$suffix $target" \
|
|
|
|
"cp -f $catdir/$base.$suffix $target"
|
|
|
|
do
|
|
|
|
if eval "$cmd"; then
|
|
|
|
eval echo "$cmd"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
2001-02-13 16:46:19 +00:00
|
|
|
done
|