*** empty log message ***
[arla.git] / cf / install-catman.sh
blobbd4aa58aea50e4255282d3ff66583f603faec61f
1 #!/bin/sh
3 # $Id$
5 # install preformatted manual pages
7 INSTALL_DATA="$1"; shift
8 mkinstalldirs="$1"; shift
9 srcdir="$1"; shift
10 manbase="$1"; shift
11 suffix="$1"; shift
13 for f in "$@"; do
14 base=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\1/'`
15 section=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\2/'`
16 mandir="$manbase/man$section"
17 catdir="$manbase/cat$section"
18 c="$base.cat$section"
20 if test -f "$srcdir/$c"; then
21 if test \! -d "$catdir"; then
22 eval "$mkinstalldirs $catdir"
24 eval "echo $INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
25 eval "$INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
27 for link in `sed -n -e '/SYNOPSIS/q;/DESCRIPTION/q;s/^\.Nm \([^ ]*\).*/\1/p' $srcdir/$f`; do
28 if [ "$link" != "$base" ]; then
29 target="$mandir/$link.$section"
30 for cmd in "ln -f $mandir/$base.$section $target" \
31 "ln -s $base.$section $target" \
32 "cp -f $mandir/$base.$section $target"
34 if eval "$cmd"; then
35 eval echo "$cmd"
36 break
38 done
39 if test -f "$srcdir/$c"; then
40 target="$catdir/$link.$suffix"
41 for cmd in "ln -f $catdir/$base.$suffix $target" \
42 "ln -fs $base.$suffix $target" \
43 "cp -f $catdir/$base.$suffix $target"
45 if eval "$cmd"; then
46 eval echo "$cmd"
47 break
49 done
52 done
53 done