Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nfc-mfultralight: Show help when no arguments are supplied
For some reason, 0cece94 changed the argc count check to only show the help if argc is 0. Obviously, argc is never zero, as the first argument in argv is always the binary itself. Revert that and show usage if there is no arguments supplied to the binary. Signed-off-by: Olliver Schinagl <[email protected]>
- Loading branch information
7b1ff70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliv3r This change was put in place to allow for single switches to work, ie:
--check-magic
Apparently it was placed incorrectly, but your re-addition of the
< 2
breaks / broke the --check-magic switch.Suggest we need
a) Updated Tests
b) Better command line processing
7b1ff70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quantum-x agree!
getopt(3)
andgetopt_long(3)
where designed for this. Using these functions we could be able to detect no arguments,-h
and invalid arguments and act accordingly in a more readable fashion.Would someone mind proposing a pull-request for improving the command-line processing (patches for unit tests are accepted as well of course but requires waaaaaays more work 😄)?