This is a very n00b question but I'm writing a nix based tool and would like to have verbosity flags, based on the number of vvv's passed in I would go about printing debug/information statements in my program.
My question is how would I go about using opargs for this, since optargs can only parse one character at a time.
Also suppose I know I'm at verbosity level 3, do all my print statements have to be in an if condition? Or there a clever way of going about it using the pre-processor?
Also if someone could point me to some code online which does this, that would be awesome.
Thanks
I figure it out, thought I'd post here if someone else comes across this in the future:
Basically for all my different verbosity statements I defined a special print using the preprocessor like:
#define dprintf \
if (verbosity == 1) printf
I then put in the statements as needed in the code e.g.
dprintf ("Verbosity is at level 1.");
My opt atgs looks something like this
case 'v':
verbosity++;
break;