From c0de7a8dc7987f0d1648e36085d328e290217aaa Mon Sep 17 00:00:00 2001 From: fche Date: Wed, 10 Aug 2005 20:25:35 +0000 Subject: 2005-08-10 Frank Ch. Eigler * tapsets.cxx: Correct hex/decimal misformatting of verbose messages. * main.cxx: Add formal "-h" and "-V" options. * stap.1.in: Document them. --- main.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 7e2a1ec9..390816af 100644 --- a/main.cxx +++ b/main.cxx @@ -30,14 +30,21 @@ using namespace std; void -usage (systemtap_session& s) +version () { clog << "SystemTap translator/driver " << "(version " << VERSION << " built " << DATE << ")" << endl << "Copyright (C) 2005 Red Hat, Inc." << endl << "This is free software; see the source for copying conditions." - << endl + << endl; +} + +void +usage (systemtap_session& s) +{ + version (); + clog << endl << "Usage: stap [options] FILE Run script in file." << endl @@ -46,9 +53,11 @@ usage (systemtap_session& s) << " or: stap [options] -e SCRIPT Run given script." << endl << endl - << "Arguments:" << endl + << "Options:" << endl << " -- no more options after this" << endl - << " -v verbose" << (s.verbose ? " [set]" : "") + << " -v verbose" << (s.verbose ? " [set]" : "") << endl + << " -h show help" << endl + << " -V show version" << endl << endl << " -k keep temporary directory" << endl // << " -t test mode" << (s.test_mode ? " [set]" : "") << endl @@ -123,11 +132,15 @@ main (int argc, char * const argv []) while (true) { - int grc = getopt (argc, argv, "vp:I:e:o:tR:r:m:kg"); + int grc = getopt (argc, argv, "hVvp:I:e:o:tR:r:m:kg"); if (grc < 0) break; switch (grc) { + case 'V': + version (); + exit (0); + case 'v': s.verbose = true; break; @@ -180,7 +193,6 @@ main (int argc, char * const argv []) s.guru_mode = true; break; - case '?': case 'h': default: usage (s); -- cgit