Add shell for testing

Added motive.c, which is basically a test for libmotive.
Fixed a number of bugs found while getting gif writing up and running.