#!/bin/sh
#
# Extract the Chapter number headings and titles from chapters and
# appendices, and create variables for the chapter number and title
#
# Greg Lehey, 6 April 1996
#
# $Id: getchapternumbers,v 2.1 1997/12/07 08:34:53 grog Exp grog $
#
# $Log: getchapternumbers,v $
# Revision 2.1  1997/12/07 08:34:53  grog
# Base second edition
#
# Revision 1.3  1997/11/24 00:16:22  grog
# Checkin 24 November, first stab at release version
#
# Revision 1.2  1996/05/06 08:58:31  grog
# Minor mods
#
# Revision 1.1  1996/04/06  12:30:52  grog
# Initial revision
#
length=$1
shift
echo .\\\" Chapters
echo .nr CN 0 1
cat $* | ../tools/stripcond $length | egrep '^\.Chapter' | sed 's:^.*\[n\(.*\)\] *"\(.*\)":.ds n\1 \\n+(CN\
.ds \1 Chapter \\\*\[n\1], \\fI\2\\fR:'
echo .\\\" Appendices
echo .nr AN 64 1
cat $* | ../tools/stripcond $length | egrep '^\.Appendix' | sed 's:^.*\[n\(.*\)\] *"\(.*\)":.ds n\1 \\N\'\'\\\\n+[AN]\''\
.ds \1 Appendix \\\*\[n\1], \\fI\2\\fR:'
