cadets / freebsd-old

FreeBSD src tree http://www.FreeBSD.org/
Other
12 stars 7 forks source link

dtracedctl(1) --help prints the usage message twice #135

Closed rwatson closed 2 years ago

rwatson commented 2 years ago

When I run dtracedctl --help, I get its usage message twice:

root@scylla1:/usr/home/rnw24 # dtracedctl --help
Usage: dtracedctl
        --cleanup-state  clean state in VM (all if not set).
        --help           display this help page.
        --show-stats     show statistics for a VM (all if not set).
Usage: dtracedctl
        --cleanup-state  clean state in VM (all if not set).
        --help           display this help page.
        --show-stats     show statistics for a VM (all if not set).

This appears to be because the HELP case in the switch statement calls print_help(), but so does the code at the end of the function after getopt_long() runs, if action isn’t usefully set (or matched). Possibly the --help switch statement entry should simply exit after printing usage information.