History

Update exec to use the more traditional -h flag for help along with the common Windows' -?.

arr committed 9 years ago

Commit 1af55281 parent e9e85041 file · +6 −4Browse files

Showing the changes to src/exec/main.cpp (1 of 1 file). Show all

Unified · Split

src/exec/main.cpp+6−4
@@ -231,7 +231,7 @@ void print_banner(const exec_options &options) · 230 unmodified lines
231void print_help()231void print_help()
232{232{
233 std::cout233 std::cout
234 << "Usage: disvm-exec [-d[e|m|x]*] [-l[s|S|t|T|e|g|m]*] [-t <num>] [-q] [-?] <entry module> <args>*\n"234 << "Usage: disvm-exec [-d[e|m|x]*] [-l[s|S|t|T|e|g|m]*] [-t <num>] [-q] [-h] <entry module> <args>*\n"
235 " d - Enable debugger\n"235 " d - Enable debugger\n"
236 " e - Break on entry\n"236 " e - Break on entry\n"
237 " m - Break on module load\n"237 " m - Break on module load\n"
@@ -246,7 +246,7 @@ void print_help() · 8 unmodified lines
246 " m - Memory allocations (noisy)\n"246 " m - Memory allocations (noisy)\n"
247 " q - Suppress banner and configuration\n"247 " q - Suppress banner and configuration\n"
248 " t - Specify the number of system threads to use (0 < x <= 4)\n"248 " t - Specify the number of system threads to use (0 < x <= 4)\n"
249 " ? - Print help\n";249 " h - Print help (alternative: '?')\n";
250}250}
251 251
252void log_callback(const debug::component_trace_t origin, const debug::log_level_t level, const char *msg_fmt, std::va_list args)252void log_callback(const debug::component_trace_t origin, const debug::log_level_t level, const char *msg_fmt, std::va_list args)
@@ -285,7 +285,7 @@ void enable_logging(debug::component_trace_t c) · 32 unmodified lines
285void process_arg(char* arg, std::function<char *()> next, exec_options &options)285void process_arg(char* arg, std::function<char *()> next, exec_options &options)
286{286{
287 assert(arg != nullptr && next != nullptr);287 assert(arg != nullptr && next != nullptr);
288 if (arg[0] != '-')288 if (arg[0] != '-' && arg[0] != '/')
289 {289 {
290 for (; arg != nullptr; arg = next())290 for (; arg != nullptr; arg = next())
291 options.vm_args.push_back(arg);291 options.vm_args.push_back(arg);
@@ -357,6 +357,7 @@ void process_arg(char* arg, std::function<char *()> next, exec_options &options) · 65 unmodified lines
357 options.quiet_start = true;357 options.quiet_start = true;
358 break;358 break;
359 359
360 case 'h':
360 case '?':361 case '?':
361 options.print_help = true;362 options.print_help = true;
362 break;363 break;
@@ -386,8 +387,9 @@ int main(int argc, char* argv[]) · 23 unmodified lines
386 {387 {
387 std::cerr << ae.what();388 std::cerr << ae.what();
388 if (ae.arg != nullptr)389 if (ae.arg != nullptr)
389 std::cerr << ": " << ae.arg << std::endl;390 std::cerr << ": " << ae.arg << "\n" << std::endl;
390 391
392 print_help();
391 return EXIT_FAILURE;393 return EXIT_FAILURE;
392 }394 }
393 395