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