: Use /bin/sh
#
# $Id: Makekit,v 1.12 1992/01/07 10:04:43 geoff Exp $
#
# Copyright 1987, 1988, 1989, 1990, by Geoff Kuenning, Manhattan Beach, CA
# Permission for non-profit use is hereby granted.
# All other rights reserved.
# See "version.h" for a more complete copyright notice.
#
# $Log: Makekit,v $
# Revision 1.12  1992/01/07  10:04:43  geoff
# Add the sq/unsq manual page to the kit.
#
# Revision 1.11  91/07/27  20:48:08  geoff
# Remove the "-s" switch and assume that subset has been run separately;
# this reflects my new scheme for source-controlling the dictionaries.
# Rewrite the dictionary-distribution code to reflect this scheme.  Add
# zapdups.X to the distribution.
# 
# Revision 1.10  91/06/23  22:15:22  geoff
# Add the overlooked ispell.texinfo, and the new Makepatch script
# 
# Revision 1.9  90/09/06  03:22:01  geoff
# Remember to shift when parsing the -s switch
# 
# Revision 1.8  90/09/06  03:13:06  geoff
# Don't preserve old dictionary versions.  Rename dictionaries to sml/med/lrg
# and make the shar components be named eng.[012].??.
# 
# Revision 1.7  90/09/04  14:26:19  geoff
# Add the "-s" (don't run subset) switch and a usage message.  Change the
# default destination directory to "kits", create it if it doesn't exist,
# and remove old kit files from it before creating new ones.  Add a bunch
# of new files to the file list.  Move the shar-creation code to a
# separate script, "makeshar".  Change dictionary names to reflect their
# true sizes.
# 
# Revision 1.6  88/03/27  00:56:24  geoff
# Add the -d option to create the kit in a different directory.  Add icombine,
# sq, and unsq.  Add tgood.c, which was overlooked.  Don't put a shar prefix
# character on the dictionary files, since we can be sure that dictionary
# lines don't start with special characters.
# 
# Revision 1.5  88/03/12  14:51:57  geoff
# Make it smart enough to size the shar files itself
# 
# Revision 1.4  88/02/20  23:09:25  geoff
# Drop icombine;  add makedent and tryaffix.
# 
# Revision 1.3  87/09/26  15:52:27  geoff
# Add some minor stuff, plus dictionary-building code.
# 
# Revision 1.2  87/08/31  00:07:59  geoff
# Update to reflect latest changes
# 
#
#	Make an ispell distribution kit.  This is not a clever script,
#	just a handy one.
#
#	Usage:
#
#	Makekit [-d destdir]
#
#	destdir is the directory in which the kits will be made;  you will
#	want to pick someplace that has lots of space.
#
posting=3
maxsize=60000		# This leaves room for some headers
destdir=kits
USAGE="Usage:  Makekit [-d destdir]"

while [ $# -gt 0 ]
do
    case "$1" in
	-d)
	    destdir="$2"
	    shift; shift
	    ;;
	*)
	    echo "$USAGE" 1>&2
	    exit 1
	    ;;
    esac
done

[ -d "$destdir" ]  ||  mkdir "$destdir"
rm -f $destdir/Post${posting}.??.shar

flist='
Contributors
README
README.OLD
Magiclines
Makefile
Makekit
Makepatch
WISHES
buildhash.c
config.X
correct.c
defmt.c
dump.c
english.4
english.aff
findaffix.X
fixdict.X
german.aff
good.c
hash.c
icombine.c
ispell.1
sq.1
ispell.4
ispell.c
ispell.el
ispell.h
ispell.texinfo
local.h.samp
lookup.c
makedict.sh
makedent.c
makeshar
msgs.h
munchlist.X
parse.y
splitdict
sq.c
subset.X
term.c
tgood.c
tree.c
tryaffix.X
unsq.c
version.h
xgets.c
zapdups.X
'

cursize=0
files=
chmod +x makeshar
sharno=`makeshar -n -m $maxsize -o $destdir/Post${posting}. -v -pX $flist`

chmod +x splitdict

./splitdict $maxsize english.0 $destdir/eng.0.
./splitdict $maxsize english.1 $destdir/eng.1.
./splitdict $maxsize english.2 $destdir/eng.2.
./splitdict $maxsize american.0 $destdir/amer.0.
./splitdict $maxsize american.1 $destdir/amer.1.
./splitdict $maxsize american.2 $destdir/amer.2.
./splitdict $maxsize altamer.0 $destdir/altamer.0.
./splitdict $maxsize altamer.1 $destdir/altamer.1.
./splitdict $maxsize altamer.2 $destdir/altamer.2.
./splitdict $maxsize british.0 $destdir/brit.0.
./splitdict $maxsize british.1 $destdir/brit.1.
./splitdict $maxsize british.2 $destdir/brit.2.

cd $destdir
for i in eng.?.?? amer.?.?? altamer.?.?? brit.?.??
do
    sharno=`expr $sharno + 1`
    pad=
    if [ $sharno -lt 10 ]
    then
	pad=0
    fi
    shar -v $i > Post${posting}.$pad$sharno.shar
done
