#!/bin/sh
#
# makeoutline - this combines the files from the +3 manual into a
# 'plus3man.txt' file designed to be viewed using emacs' outline mode.
#
# this uses 'echo -n', so you may need bash or ksh.

file=plus3man.txt
blank=blank.tmp

# make a small blank file
cat <<EOF >$blank




EOF


# a little header, with outline mode setting

cat <<'EOF' >$file
* ZX Spectrum +3 Manual					-*- outline -*-

Copyright (c) 1987 Amstrad plc. Reproduced with permission.

Transcribed by:

Russell Marks (mr216@gre.ac.uk)
Thomas Ahn Kjaer (takjaer@daimi.aau.dk)
Ian Coates (oktup@mono.city.ac.uk)


EOF

echo "* Contents" >>$file
sed '1,6d' <contents >>$file
cat $blank >>$file

echo "* Introduction" >>$file
sed '1,2d' <introduction >>$file
cat $blank >>$file

for i in 1 2 3 4 5 6 7; do
	# I think this needs bash/ksh?
	echo -n "* " >>$file
	cat chapter$i $blank >>$file
done


cat <<'EOF' >>$file
* Chapter 8

** Chapter 8 Part 1
EOF

sed '1,4d' <chapter8.part1 >>$file
cat $blank >>$file

for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 \
		24 25 26 27 28 29 30 31 32 33; do
	echo -n "** Chapter 8 " >>$file
	cat chapter8.part$i $blank >>$file
done


for i in 9 10; do
	echo -n "* " >>$file
	cat chapter$i $blank >>$file
done


rm -f $blank
