GINSU - Chop up/Stitch together large files.
11/24/2000: Version 1.0 is released.  This release includes minor updates to the error message handling. The 0.9.2 release seems stable, so with this minor update I proclaim it ready for prime time.

The DOS and Win32 versions are not updated yet, as I will have to get time on my home computer to build them.

GINSU   Copyright © 2000 Chris Gonnerman
CRC.C/H   Copyright © 1996-1997 Id Software, Inc.
Copyright © 1999,2000 contributors of the QuakeForge project

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


The DOS version is fully functional except for long filename support.  Included in the source archive is the Turbo C project file, ginsu.prj, used to create it.

The Win32 version is compatible with the DOS version, but supports long filenames correctly (so far, anyway).


First, edit the Makefile and set the variables for PREFIX, BINDIR, MANDIR, etc. as needed for your installation. If you have a GNU-compatible install command in your path, and want to use /usr/local/bin and /usr/local/man for the install directories, it should be fine.

Run make. If it builds OK, then (as a privileged user, i.e. root) run make install. That's it, you're done.


Say you have this nasty Windows driver that you need to transport on diskettes, but the file is 3.1 Mb in size (yes, this is EXACTLY why I wrote this program). Do this:

     ginsu big-ugly-file.exe

Ginsu will chop the big ugly file into pieces, where each piece (except the last) is exactly the size of the free space on a FAT 3.5" 1.44Mb disk. The "cutfiles" will be named bigugl01.gcf, bigugl02.gcf, etc. Up to 99 slices may be made.

Copy the cutfiles to disk, one at a time (or look at the -p option below for help). Take the disks to the client site and copy them to a folder, along with the DOS or Win32 compiled version (available as separate downloads).

To reconstruct the file, do this:

     ginsu bigugl01.gcf

in the directory where all the cutfiles are located.

Yeah, there are a mess of options, not all well documented; see the man page for more info. This software is not nearly fully tested yet, also.

Below is a plaintext version of the manual page for version 0.9, which may already be out of date. Check the manual page for up-to-date info.

Usage: ginsu [options] [filename]

ginsu reads stdin if filename is not given.

If the given file or stream does not include a ginsu chop file (gcf) header, it is assumed to be an "original" file to be chopped. A header is generated and the file is chopped into pieces and stored. If stdin is processed, 'ginsu.fil' is stored as the original filename.

If the given file has a gcf header, it is assumed to be one of a number of gcf files that contain the pieces of the original file. Note that you can't use stdin in this case. ginsu validates the filename (which must be in proper format), reads the header, and begins reconstruction.

GCF Filename Format: aaaaaNN.gcf (i.e. textaa01.gcf)

Filename is made from first six alphabetics of the original filename, if any, converted to lowercase and padded with 'a' characters to exactly six long; then, an index number (01 to 99) for the 'slice' index of this file; finally, '.gcf' as a file extension.

Options include:

     -cN  target file size in K (for chopping) 
     -v   verbose level output 
     -V   debug level output 
     -q   quiet output (no warnings) 
     -Q   very quiet output (no messages at all) 
     -t   target file name (for reconstruction) original filename is 
          used otherwise, if available in chop mode, this is stored 
          in the header as the "original" filename. 
     -d   Device mode (see below) 
     -p   Prompted mode (see below) 
     -S   File stem (overrides default) 
     -P   Path (for cutfiles, overrides current directory default)

Option arguments must immediately follow the option, to avoid confusion with filenames; option keyletters may not be combined. For example, this is valid:

     ginsu -v -c100 original.fil

But these are not:

     ginsu -v -c 100 original.fil 
     ginsu -vc100 original.fil

The magic header of a gcf file contains lines to run ginsu if the gcf file is executed directly under Unix-like OS's, and the filename is constructed to be legal under DOS, Unix/Linux, and Windows. The Win32 version of ginsu can be associated with the .gcf extension, so that reconstruction can be initiated by double-clicking any individual gcf file.

The header is also created such that a "head <filename>.gcf" will produce printable output under Unix, and has a ^Z character following so that the DOS TYPE command will print just the header without any following binary data.

In stitch mode, "device mode" assumes that the filename given is probably not valid, and skips the validation step; it then opens, processes, and closes the same filename over and over, prompting before each time. The reason for this is to support /dev/fd0* under Unix/Linux. Disks must be inserted in order, since in this case ginsu can't select which file to process first.

In chop mode, the -d option must be followed by the device name; ginsu will prompt to change disks between sections, and will also set the maximum chop size to the size of the media (if supported).

In stitch mode, the -p option enables prompting but assumes that the filename IS valid; this is useful under DOS/Windows for processing A:\AAAAAA01.GCF, for instance, where you need to change disks before each file is processed.

In chop mode, the -p option must be followed immediately by the path to write files to; ginsu will prompt before each section, allowing the disk change to be performed.