summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2005-06-02 11:20:31 -0400
committerNathan Binkert <binkertn@umich.edu>2005-06-02 11:20:31 -0400
commitba73e1cc3938e9862d4327f0d77ef8da50794d10 (patch)
tree97a658e1e3fcf17c1d6694193aa200e1d5d9dfd3
parent0ee75f27b8d7bdc803ca2b30b578de7c3231cb84 (diff)
downloadgem5-ba73e1cc3938e9862d4327f0d77ef8da50794d10.tar.xz
clean up command line stuff
sim/main.cc: Clean uo usage output and print usage when no options are given Don't accept mpy files anymore since we don't use them. --HG-- extra : convert_revision : c3b16f602f301d2de12547285334c0037d829998
-rw-r--r--sim/main.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/sim/main.cc b/sim/main.cc
index 94928e36a..ed8bf9e63 100644
--- a/sim/main.cc
+++ b/sim/main.cc
@@ -127,11 +127,12 @@ showBriefHelp(ostream &out)
" -I add the directory <dir> to python's path\n"
" -P execute <python> directly in the configuration\n"
" --var=val set the python variable <var> to '<val>'\n"
-" <configfile> config file name (.py or .mpy)\n",
+" <configfile> config file name (ends in .py)\n\n",
prog);
- ccprintf(out, "%s -X\n -X extract embedded files\n", prog);
- ccprintf(out, "%s -h\n -h print long help\n", prog);
+ ccprintf(out, "%s -X\n -X extract embedded files\n\n", prog);
+ ccprintf(out, "%s -h\n -h print short help\n\n", prog);
+ ccprintf(out, "%s -H\n -H print long help\n\n", prog);
}
/// Show verbose help message. Includes parameter listing from
@@ -245,12 +246,17 @@ main(int argc, char **argv)
signal(SIGINT, exitNowHandler); // dump final stats and exit
signal(SIGABRT, abortHandler);
- sayHello(cerr);
-
bool configfile_found = false;
PythonConfig pyconfig;
string outdir;
+ if (argc < 2) {
+ showBriefHelp(cerr);
+ exit(1);
+ }
+
+ sayHello(cerr);
+
// Parse command-line options.
// Since most of the complex options are handled through the
// config database, we don't mess with getopts, and just parse
@@ -283,6 +289,10 @@ main(int argc, char **argv)
break;
case 'h':
+ showBriefHelp(cerr);
+ exit(1);
+
+ case 'H':
showLongHelp(cerr);
exit(1);
@@ -328,9 +338,8 @@ main(int argc, char **argv)
string file(arg_str);
string base, ext;
- if (!split_last(file, base, ext, '.') ||
- ext != "py" && ext != "mpy")
- panic("Config file '%s' must end in '.py' or '.mpy'\n", file);
+ if (!split_last(file, base, ext, '.') || ext != "py")
+ panic("Config file '%s' must end in '.py'\n", file);
pyconfig.load(file);
configfile_found = true;