From 440e62e29c0a4dae2d32e5da8c968b19c417969d Mon Sep 17 00:00:00 2001 From: "Fish (David B. Trout)" Date: Thu, 2 Mar 2023 19:01:29 -0800 Subject: [PATCH] Fix commit f7373b7c2ddd29879fbf2992fcd54bae1794fb55: Show version and help if no arguments given, but ONLY IF default config file isn't found. Otherwise use the default config file just as we always were prior to commit f7373b7c2ddd29879fbf2992fcd54bae1794fb55. Fixes GitHub Issue #548. --- impl.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/impl.c b/impl.c index afac6604a..fb6c6d02b 100644 --- a/impl.c +++ b/impl.c @@ -835,14 +835,6 @@ int rc; init_progname( argc, argv ); init_sysblk_version_str_arrays( NULL ); - if (argc < 2) - { - display_version( stdout, 0, NULL ); - arghelp(); - WRMSG( HHC02343, "S", 1 ); - return 1; - } - /* Initialize SETMODE and set user authority */ SETMODE( INIT ); @@ -1147,9 +1139,15 @@ int rc; set_thread_priority_id( sysblk.loggertid, sysblk.srvprio ); LOG_TID_BEGIN( sysblk.loggertid, LOGGER_THREAD_NAME ); + /* Always show version right away */ + display_version( stdout, 0, NULL ); + /* Process command-line arguments. Exit if any serious errors. */ if ((rc = process_args( argc, argv )) != 0) { + /* Show them our command line arguments */ + arghelp(); + // "Terminating due to %d argument errors" WRMSG( HHC02343, "S", rc ); delayed_exit( rc ); @@ -1853,8 +1851,8 @@ static int process_args( int argc, char* argv[] ) /* Terminate if invalid arguments were detected */ if (arg_error) { - /* Show them all of our command-line arguments... */ - arghelp(); + /* Do nothing. Caller will call "arghelp" to + show them our command-line arguments... */ } else /* Check for config and rc file, but don't open */ {