1#! /bin/sh
2# this script is generated by the configure-script CF_MAN_PAGES macro.
3prefix="/usr/local"
4datadir="${prefix}/share"
5NCURSES_OSPEED="short"
6TERMINFO="/usr/local/share/terminfo"
7MKDIRS="sh /boot/home/develop/haiku/haiku/src/libs/ncurses/mkinstalldirs"
8INSTALL="/bin/install -c"
9INSTALL_DATA="${INSTALL} -m 644"
10transform="s,x,x,"
11
12TMP=${TMPDIR-/tmp}/man$$
13trap "rm -f $TMP" 0 1 2 5 15
14
15form=$1
16shift || exit 1
17
18verb=$1
19shift || exit 1
20
21mandir=$1
22shift || exit 1
23
24srcdir=$1
25top_srcdir=$srcdir/..
26shift || exit 1
27
28if test "$form" = normal ; then
29	if test "no" = yes ; then
30	if test "no" = no ; then
31		sh $0 format $verb $mandir $srcdir $*
32		exit 0
33	fi
34	fi
35	cf_subdir=$mandir/man
36	cf_tables=no
37else
38	cf_subdir=$mandir/cat
39	cf_tables=yes
40fi
41
42# process the list of source-files
43for i in $* ; do
44case $i in #(vi
45*.orig|*.rej) ;; #(vi
46*.[0-9]*)
47	section=`expr "$i" : '.*\.\([0-9]\)[xm]*'`;
48	if test $verb = installing ; then
49	if test ! -d $cf_subdir${section} ; then
50		$MKDIRS $cf_subdir$section
51	fi
52	fi
53	aliases=
54	source=`basename $i`
55	inalias=$source
56	test ! -f $inalias && inalias="$srcdir/$inalias"
57	if test ! -f $inalias ; then
58		echo .. skipped $source
59		continue
60	fi
61	aliases=`sed -f $top_srcdir/man/manlinks.sed $inalias | sort -u`
62	# perform program transformations for section 1 man pages
63	if test $section = 1 ; then
64		target=$cf_subdir${section}/`echo $source|sed "${transform}"`
65	else
66		target=$cf_subdir${section}/$source
67	fi
68	prog_captoinfo=`echo captoinfo|sed "${transform}"`
69	prog_clear=`echo clear|sed "${transform}"`
70	prog_infocmp=`echo infocmp|sed "${transform}"`
71	prog_infotocap=`echo infotocap|sed "${transform}"`
72	prog_tic=`echo tic|sed "${transform}"`
73	prog_toe=`echo toe|sed "${transform}"`
74	prog_tput=`echo tput|sed "${transform}"`
75	sed	-e "s,@DATADIR@,$datadir," \
76		-e "s,@TERMINFO@,$TERMINFO," \
77		-e "s,@NCURSES_OSPEED@,$NCURSES_OSPEED," \
78		-e "s,@CAPTOINFO@,$prog_captoinfo," \
79		-e "s,@CLEAR@,$prog_clear," \
80		-e "s,@INFOCMP@,$prog_infocmp," \
81		-e "s,@INFOTOCAP@,$prog_infotocap," \
82		-e "s,@TIC@,$prog_tic," \
83		-e "s,@TOE@,$prog_toe," \
84		-e "s,@TPUT@,$prog_tput," \
85		< $i >$TMP
86if test $cf_tables = yes ; then
87	tbl $TMP >$TMP.out
88	mv $TMP.out $TMP
89fi
90	if test $form = format ; then
91		nroff -man $TMP >$TMP.out
92		mv $TMP.out $TMP
93	fi
94	suffix=`basename $target | sed -e 's%^[^.]*%%'`
95	if test $verb = installing ; then
96		echo $verb $target
97		$INSTALL_DATA $TMP $target
98		test -n "$aliases" && (
99			cd $cf_subdir${section} && (
100				source=`echo $target |sed -e 's%^.*/\([^/][^/]*/[^/][^/]*$\)%\1%'`
101				test -n "" && source=`echo $source |sed -e 's%\.$%%'`
102				target=`basename $target`
103				for cf_alias in $aliases
104				do
105					if test $section = 1 ; then
106						cf_alias=`echo $cf_alias|sed "${transform}"`
107					fi
108
109					if test "yes" = yes ; then
110						if test -f $cf_alias${suffix} ; then
111							if ( cmp -s $target $cf_alias${suffix} )
112							then
113								continue
114							fi
115						fi
116						echo .. $verb alias $cf_alias${suffix}
117						rm -f $cf_alias${suffix}
118						ln -s $target $cf_alias${suffix}
119					elif test "$target" != "$cf_alias${suffix}" ; then
120						echo ".so $source" >$TMP
121						echo .. $verb alias $cf_alias${suffix}
122						rm -f $cf_alias${suffix}
123						$INSTALL_DATA $TMP $cf_alias${suffix}
124					fi
125				done
126			)
127		)
128	elif test $verb = removing ; then
129		echo $verb $target
130		rm -f $target
131		test -n "$aliases" && (
132			cd $cf_subdir${section} && (
133				for cf_alias in $aliases
134				do
135					if test $section = 1 ; then
136						cf_alias=`echo $cf_alias|sed "${transform}"`
137					fi
138
139					echo .. $verb alias $cf_alias${suffix}
140					rm -f $cf_alias${suffix}
141				done
142			)
143		)
144	else
145#		echo ".hy 0"
146		cat $TMP
147	fi
148	;;
149esac
150done
151
152if test no = yes ; then
153if test $form != format ; then
154	sh $0 format $verb $mandir $srcdir $*
155fi
156fi
157
158exit 0
159