2016-01-07 08:51:53 +00:00
|
|
|
#!/bin/sh
|
1998-07-13 12:29:13 +00:00
|
|
|
|
2012-05-14 19:45:48 +00:00
|
|
|
OUTDIR=$1
|
|
|
|
shift
|
|
|
|
|
1998-07-13 12:29:13 +00:00
|
|
|
# Create libc.texinfo from the chapter files.
|
|
|
|
|
2012-05-14 19:45:48 +00:00
|
|
|
trap "rm -f ${OUTDIR}*.$$; exit 1" 1 2 15
|
1998-07-17 12:36:43 +00:00
|
|
|
|
2012-05-14 19:45:48 +00:00
|
|
|
exec 3>${OUTDIR}incl.$$ 4>${OUTDIR}smenu.$$ 5>${OUTDIR}lmenu.$$
|
1998-07-17 12:36:43 +00:00
|
|
|
|
|
|
|
build_menu () {
|
|
|
|
while IFS=: read file node; do
|
|
|
|
echo "@include $file" >&3
|
|
|
|
echo "* $node:: `sed -n 's/^@c %MENU% //p' $file`" >&4
|
|
|
|
$AWK 'BEGIN { do_menu = 0 }
|
|
|
|
/^@node / { sub(/^@node /, ""); sub(/,.*$/, ""); node = $0 }
|
|
|
|
/^@menu/ { printf "\n%s\n\n", node; do_menu = 1; next }
|
|
|
|
/^@end menu/ { do_menu = 0 }
|
|
|
|
do_menu { print }' $file >&5
|
|
|
|
done
|
|
|
|
}
|
1998-07-13 12:29:13 +00:00
|
|
|
|
1998-07-17 12:36:43 +00:00
|
|
|
collect_nodes () {
|
1999-01-07 09:55:57 +00:00
|
|
|
egrep '^(@c )?@node.*Top' "$@" /dev/null | cut -d, -f-2 |
|
|
|
|
sed 's/@c //; s/, /:/; s/:@node /:/; s/ /_/g; s/:/ /g' |
|
1998-07-17 12:36:43 +00:00
|
|
|
$AWK '{ file[$2] = $1; nnode[$2] = $3 }
|
|
|
|
END { for (x in file)
|
|
|
|
if (file[x] != "")
|
|
|
|
print file[x] ":" x, file[nnode[x]] ":" nnode[x] }' |
|
1999-01-18 09:38:36 +00:00
|
|
|
$AWK -f tsort.awk | sed 's/_/ /g'
|
1998-07-13 12:29:13 +00:00
|
|
|
}
|
|
|
|
|
2002-12-10 11:08:11 +00:00
|
|
|
# Emit "@set ADD-ON" for each add-on contributing a manual chapter.
|
|
|
|
for addon in $2; do
|
|
|
|
addon=`basename $addon .texi`
|
|
|
|
echo >&3 "@set $addon"
|
|
|
|
done
|
|
|
|
|
1998-07-17 12:36:43 +00:00
|
|
|
collect_nodes $1 | build_menu
|
|
|
|
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
|
|
|
|
{ echo; echo 'Add-ons'; echo; } >&4
|
|
|
|
|
1999-01-07 09:55:57 +00:00
|
|
|
egrep '^(@c )?@node.*Top' `echo $2 /dev/null | tr ' ' '\n' | sort` |
|
|
|
|
cut -d, -f1 | sed 's/@c //;s/@node //' | build_menu
|
1998-07-17 12:36:43 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
{ echo; echo 'Appendices'; echo; } >&4
|
|
|
|
|
|
|
|
collect_nodes $3 | build_menu
|
|
|
|
|
|
|
|
exec 3>&- 4>&- 5>&-
|
1998-07-13 12:29:13 +00:00
|
|
|
|
2012-05-14 19:45:48 +00:00
|
|
|
mv -f ${OUTDIR}incl.$$ ${OUTDIR}chapters.texi
|
1998-07-13 12:29:13 +00:00
|
|
|
|
1998-07-17 12:36:43 +00:00
|
|
|
{
|
|
|
|
echo '@menu'
|
|
|
|
$AWK -F: '
|
|
|
|
/^\*/ {
|
|
|
|
printf("%-32s", $1 "::");
|
|
|
|
x = split($3, word, " ");
|
|
|
|
hpos = 34;
|
|
|
|
for (i = 1; i <= x; i++) {
|
|
|
|
hpos += length(word[i]) + 1;
|
|
|
|
if (hpos > 78) {
|
|
|
|
printf("\n%34s", "");
|
|
|
|
hpos = 35 + length(word[i]);
|
|
|
|
}
|
|
|
|
printf(" %s", word[i]);
|
|
|
|
}
|
|
|
|
print ".";
|
|
|
|
}
|
|
|
|
|
|
|
|
!/^\*/ { print; }
|
2012-05-14 19:45:48 +00:00
|
|
|
' ${OUTDIR}smenu.$$
|
1998-07-13 12:29:13 +00:00
|
|
|
cat <<EOF
|
2001-08-28 08:05:41 +00:00
|
|
|
* Free Manuals:: Free Software Needs Free Documentation.
|
2001-07-06 05:37:16 +00:00
|
|
|
* Copying:: The GNU Lesser General Public License says
|
1998-07-13 12:29:13 +00:00
|
|
|
how you can copy and share the GNU C Library.
|
2001-07-06 09:21:36 +00:00
|
|
|
* Documentation License:: This manual is under the GNU Free
|
|
|
|
Documentation License.
|
1998-07-13 12:29:13 +00:00
|
|
|
|
|
|
|
Indices
|
|
|
|
|
|
|
|
* Concept Index:: Index of concepts and names.
|
|
|
|
* Type Index:: Index of types and type qualifiers.
|
|
|
|
* Function Index:: Index of functions and function-like macros.
|
|
|
|
* Variable Index:: Index of variables and variable-like macros.
|
|
|
|
* File Index:: Index of programs and files.
|
|
|
|
|
2013-02-22 04:45:17 +00:00
|
|
|
@detailmenu
|
1998-07-13 12:29:13 +00:00
|
|
|
--- The Detailed Node Listing ---
|
|
|
|
EOF
|
2012-05-14 19:45:48 +00:00
|
|
|
cat ${OUTDIR}lmenu.$$
|
2013-02-22 04:45:17 +00:00
|
|
|
echo '@end detailmenu'
|
2012-05-14 19:45:48 +00:00
|
|
|
echo '@end menu'; } >${OUTDIR}top-menu.texi.$$
|
|
|
|
mv -f ${OUTDIR}top-menu.texi.$$ ${OUTDIR}top-menu.texi
|
1998-07-13 12:29:13 +00:00
|
|
|
|
2012-05-14 19:45:48 +00:00
|
|
|
rm -f ${OUTDIR}*.$$
|