contrib: make functions to trap errors

And fix few overlooked quoting style issues, and use the usage()
function when --help is called.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>