Page MenuHomeFreeBSD

dtc: remove unknown option printf, since getopt will print it
ClosedPublic

Authored by bcran on Feb 13 2020, 4:03 PM.

Details

Summary

Since we don't set opterr to 0, getopt prints a message when it
encounters an unknown/invalid option. We therefore don't need to
print our own message in the default handler.

Test Plan

Before:
% dtc -z
dtc: illegal option -- z
Unknown option ?

After:
% dtc -z
dtc: illegal option -- z

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

change should also go here: https://github.com/davidchisnall/dtc

Oh I was wondering if there was an upstream!

Oh I was wondering if there was an upstream!

It's a pseudo-upstream - we don't bring it in via vendor/, but @theraven uses the git repo to coordinate development.

I'd be tempted to drop this one since the other message is more informative -- adding David.

Remove the print statement in the default handler.

bcran retitled this revision from dtc: unknown getopt option character is in optopt, not ch to dtc: remove unknown option printf, since getopt will print it.Feb 13 2020, 6:41 PM
bcran edited the summary of this revision. (Show Details)
bcran edited the test plan for this revision. (Show Details)

This looks fine, but please submit it as a GitHub PR so that it goes through CI (I can't imagine it failing).

This looks fine, but please submit it as a GitHub PR so that it goes through CI (I can't imagine it failing).

Done! https://github.com/davidchisnall/dtc/pull/63

This has been accepted to the GitHub repo; please commit at-will.

This revision is now accepted and ready to land.Feb 18 2020, 7:28 PM