#!/bin/sh
#
# "chunk"	K. J. Turner	01/04/96
#
# Breaks filename given as parameter into pieces of some size. This is 1200
# kbytes (1000's of bytes) by default, but the size can be given in kbytes on
# the command line using "-k". The output is multiple files up to the maximum
# size, with suffixes ".1", ".2", etc.
#
# The script will work with binary files. Use "cat" to combine them. For
# example:
#
#  chunk -k512 myfile		to break into myfile.1, myfile.2, ...
#
#  cat myfile.? > myfile	to reconstruct myfile (beware .10, etc.)

prog="`basename $0`"				# program name

chunk="/NextAdmin/Installer.app/chunk"		# original chunk program
kbytes=1200					# default size 1000's of bytes

case $1 in
  -k) kbytes=$2; shift 2;;
  -k*) kbytes=`expr $1 : -k'\(.*\)'`; shift;;
esac

if [ $# -ne 1 ]					# parameters?
  then 
    echo "usage: $prog [-k kbytes] file"	# report parameters
    exit 1
  else
    bytes=`expr $kbytes \* 1000`		# convert to bytes
    $chunk $bytes $1				# break it up
fi
