Add arg-sample code

@mjhubisz

This PR addresses issue #9 by merging the code needed for `arg-sample` into master.


For graceful error reporting you should return a "error" value of some sort so that the caller can deal with it as they want.  If the error is something that should never happen, which seems to be the case here, maybe you should use `abort()` instead.  That way we can get a a coredump and traceback.