Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/usr.bin/split



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)



Home | Main Index | Thread Index | Old Index