Changed exit() calls to uses EXIT_FAILURE as specified in the standard.