Print usage after error?
Should the usage message be displayed after an error is caught by parse_options()?
If the user inputs an invalid parameter or argument, should they not be presented with a usage message, showing them the error of their ways.
Currently just a simple message is output, without any further elaboration as to what the correct parameters actually are.
This can be fixed by simply adding of the usage_help() call to end of the error handling section of parse_options(), by changing the fix from Unify case?:` error messages #8:
case 'a':
case 'q':
case 's':
fprintf(stderr,"The `%c' option takes a line number arg.\n", optopt);
break;
to
case 'a':
case 'q':
case 's':
fprintf(stderr,"The `%c' option takes a line number arg.\n", optopt);
usage_help();
break;
Personal note: I don't know how annoying constantly having the usage printed might become. It would seem logical to provide the usage if the user makes an error - as they clearly don't know what they are doing! ;-) Nevertheless, I am not entirely sure what the "getopt" community consensus is about this. Maybe print the usage only after howlingly badly erroneous inputs, and not for a simple typo - although I'm not sure how one would classify erroneous inputs into "good" and "bad" piles.
TL;DR:
This might be (a bit of) a superfluous feature request.
I think that implementing this "feature" would end up being overly verbose and annoying. The -h option displays the usage anyway, if the user needs it.
I think this issue could be closed, tbh.