Subject: Re: CVS commit: src/usr.bin/split
To: Jan Schaumann <jschauma@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: source-changes
Date: 05/31/2007 08:09:01
On Thu, 31 May 2007, Jan Schaumann wrote:
> Modified Files:
> 	src/usr.bin/split: split.1 split.c
> 
> Log Message:
> Add a new command-line option "-n chunk_count", that splits the input
> file into chunk_count smaller files.  Each file will be size/chunk_count
> bytes large, with whatever spillover there is ending up in the chunk_counth
> file.

If you change this line in split3() from

        split1(sb.st_size/chunks, chunks);

to

        split1((sb.st_size + chunks - 1)/chunks, chunks);

then the last file will never be larger than the others, there won't
be any "spillover", and you can remove all the new special cases in
split1().

--apb (Alan Barrett)