From 5ec722e14fb5d7f46c973adcdf8484165a97228a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 4 Aug 2012 14:12:33 -0700 Subject: [PATCH] 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. --- session.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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: -- 2.43.5