Change void functions to int functions for future error handling

The library needs to be changed to never exit the C program. Right
now it performs a program exit, but we want to allow the programmer
to catch the error and handle it themselves. Changing the function
return values away from "void" allows errors to be propagated back
to the calling program.