From: Josh Stone Date: Sat, 4 Aug 2012 21:12:33 +0000 (-0700) Subject: Don't print usage text on stap option errors X-Git-Tag: release-2.0~211 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5ec722e14fb5d7f46c973adcdf8484165a97228a;p=systemtap.git Don't print usage text on stap option errors The help text is so long that it tends to push the actual error message off the screen. Instead, just print a suggestion to consult --help. --- diff --git a/session.cxx b/session.cxx index 067a507c8..52de05f07 100644 --- a/session.cxx +++ b/session.cxx @@ -434,6 +434,14 @@ systemtap_session::version () void systemtap_session::usage (int exitcode) { + // For error cases, just suggest --help, so we don't obscure + // the actual error message with all the help text. + if (exitcode != EXIT_SUCCESS) + { + clog << _("Try '--help' for more information.") << endl; + throw exit_exception(exitcode); + } + version (); clog << endl @@ -1264,7 +1272,7 @@ systemtap_session::parse_cmdline (int argc, char * const argv []) // Invalid/unrecognized option given or argument required, but // not given. In both cases getopt_long() will have printed the // appropriate error message to stderr already. - return 1; + usage(1); break; default: