New state-based plan

Fails, because allocate must be called before write
Remove allocation state

Merge functionality into the write_sink operation.
This ensures that write_sink's return value reflects
the processing of all available data.
Moving testing into script
Merge branch 'master' of github.com:dspinellis/sgsh