Refactor: libcrmcommon: Add pcmk__output_and_clear_error.
This turns a common code block at the end of most command line tools
into a function. Using it does not require converting the tool to
formatted output first. However, it's probably best to at least get it
using glib for command line processing first.