Refactor: tools: Clean up shadow NULL-checking in crm_shadow.c
There was some redundancy in NULL-checking shadow that made the code
harder to follow.
For query options, we already NULL-check shadow (from
getenv("CIB_shadow")) during argument processing.
For command options, an optarg is required, and that optarg is copied to
shadow, so we know shadow is non-NULL in that case too.
That only leave the case where no command flag is set. We can simply
treat that case as an error, using default flag '?' to call help and
return a usage error. We can also exit OK early if '?' or '$' is
passed explicitly -- there's no reason to process the rest of the
arguments if help or version is requested. This ensures that we don't
show the help output twice if no command flag is set.
These changes will make it easier to convert to GOption (and more
importantly easier to review that change).
Ref T98
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>