-#! /bin/sh
+#!/bin/sh
+
+OUTDIR=$1
+shift
# Create libc.texinfo from the chapter files.
-trap "rm -f *.$$; exit 1" 1 2 15
+trap "rm -f ${OUTDIR}*.$$; exit 1" 1 2 15
-exec 3>incl.$$ 4>smenu.$$ 5>lmenu.$$
+exec 3>${OUTDIR}incl.$$ 4>${OUTDIR}smenu.$$ 5>${OUTDIR}lmenu.$$
build_menu () {
while IFS=: read file node; do
END { for (x in file)
if (file[x] != "")
print file[x] ":" x, file[nnode[x]] ":" nnode[x] }' |
- tsort | sed 's/_/ /g; $d'
+ $AWK -f tsort.awk | sed 's/_/ /g'
}
collect_nodes $1 | build_menu
-if [ -n "$2" ]; then
-
- { echo; echo 'Add-ons'; echo; } >&4
-
- egrep '^(@c )?@node.*Top' `echo $2 /dev/null | tr ' ' '\n' | sort` |
- cut -d, -f1 | sed 's/@c //;s/@node //' | build_menu
-
-fi
-
{ echo; echo 'Appendices'; echo; } >&4
-collect_nodes $3 | build_menu
+collect_nodes $2 | build_menu
exec 3>&- 4>&- 5>&-
-mv -f incl.$$ chapters.texi
+mv -f ${OUTDIR}incl.$$ ${OUTDIR}chapters.texi
{
echo '@menu'
}
!/^\*/ { print; }
- ' smenu.$$
+ ' ${OUTDIR}smenu.$$
cat <<EOF
-* Copying:: The GNU Library General Public License says
+* Free Manuals:: Free Software Needs Free Documentation.
+* Copying:: The GNU Lesser General Public License says
how you can copy and share the GNU C Library.
+* Documentation License:: This manual is under the GNU Free
+ Documentation License.
Indices
* Variable Index:: Index of variables and variable-like macros.
* File Index:: Index of programs and files.
+ @detailmenu
--- The Detailed Node Listing ---
EOF
- cat lmenu.$$
- echo '@end menu'; } >top-menu.texi.$$
-mv -f top-menu.texi.$$ top-menu.texi
+ cat ${OUTDIR}lmenu.$$
+ echo '@end detailmenu'
+ echo '@end menu'; } >${OUTDIR}top-menu.texi.$$
+mv -f ${OUTDIR}top-menu.texi.$$ ${OUTDIR}top-menu.texi
-rm -f *.$$
+rm -f ${OUTDIR}*.$$