Exit with status 1, not 255, on error.

Replaced "return -1" with "return 1". Program exit statuses are 8 bit
unsigned numbers, and 1 is standard for a generic error exit.
Return 2 if no file name given. Better message.

2 conventionally means that the program was called incorrectly. I
expanded the error message to give the user more direction.
Trivial optimization, saved line.

Since a bank can only have one bank type, break out of
the loop after finding that it matches.

Instead of making bank_name=data->bank_name, just use
data->bank_name.
Collapse nested if/else, add const.

Noted that if{}else{if{}else{}} is the same as if{}else if{}else{}, and
switched to the second for clarity. Added curly brackets in parallel
structure on first 'if' block for clarity.

Made oldtime const.
Save a line in Output, add const unsigned.

Make index a const unsigned int in Output().

Save a line by directly returning the pointer instead
of assigning it to a variable first.
Eliminate w2test and use w2 itself instead.

Intead of holding a separate variable to track whether w2 is open, make
sure that it is NULL if it is not open (good practice anyway) and check
that.
Check that chunksize is bigger than overlap.

Since I notice that things will certainly go to hell if this is
violated. Return 255 (which I'm using to mean "programmer error") in
this case.
Error better on failed open.  Comment.

If we can't open a file, say which index it is.  Check
in both places we open files, not just one.

Add comment pointing out that the current logic does not (I think)
handle the case of finding that the event is in an overlap region after
no events having been in the non-overlap region. i.e. the case where we
need to open both files on the same event.
Change %lx to %x to get rid of compiler warning.
Add outbase, more errors, indentation.
Make use of the database optional.

This is meant primarily for testing.  And it's a kludge
that should be improved on, probably by using getopt.
Add .gitignore, invert usedb test (bug fix).
Return value, nodb help text.

Return 127, not 255, on programming error to avoid conflicting
with shell convention of 128+n meaning killed by signal n.

Check if the 3rd argument is something other than nodb and complain.
Set chunk to 1 second, remove debugging text, use switch.
Flip order of functions, use getopt.

Put main at the bottom where it is right and proper for it to be
and get rid of the prototypes.

Use getopt to get options, make options for changing the chunksize,
overlap size, maximum number of output files, to not use the database.
Also take the input file and out basename with options.
Add help text.
Count events, move variables around.

Now count events processed and print the number at the end.

Move chunksize, overlap, ticks and increment out of global
scope.
Const, naming, fprintf, other trivialities.
Options for SQL server, some fiddling.

Fiddling = indentation, early return instead of big if block,
stuff like that.
Reindent to 2 columns, rename p to zfile.

Just to make it hard to track changes, I've changed the indentation
from 4 to 2.
Rearrange time code, add -n option.

-n causes chopper to exit if an output file already exists
rather than overwriting it.