ncurses 4.1
[ncurses.git] / sysdeps / unix / sysv / linux / edit_man.sh
1 #!/bin/sh
2 # this script is generated by the configure-script
3 prefix=$1
4 shift
5 mandir=$1
6 shift
7 edit_man_sed=$1
8 shift
9
10 datadir="${prefix}/share"
11 MKDIRS="mkinstalldirs"
12 INSTALL="/usr/bin/install -c"
13 INSTALL_DATA="${INSTALL} -m 644"
14 TMP=${TMPDIR-/tmp}/man$$
15 trap "rm -f $TMP" 0 1 2 5 15
16
17 for i in $*
18 do
19 case $i in
20 *.[0-9]*)
21         section=`expr "$i" : '.*\.\([0-9]\)[xm]*'`;
22         if [ ! -d $mandir/man${section} ]; then
23                 $MKDIRS $mandir/man$section
24         fi
25         source=`basename $i`
26         target=`grep "^$source" man/man_db.renames | mawk '{print $2}'`
27         if test -z "$target" ; then
28                 echo '? missing rename for '$source
29                 target="$source"
30         fi
31         target="$mandir/man$section/$target"
32         sed -e 's,@DATADIR@,$datadir,' < $i | sed -f ${edit_man_sed} >$TMP
33         echo installing $target
34         $INSTALL_DATA $TMP $target
35         ;;
36 esac
37 done