Example #1
0
/* KMain - EXTERN
 *  executable entrypoint "main" is implemented by
 *  an OS-specific wrapper that takes care of establishing
 *  signal handlers, logging, etc.
 *
 *  in turn, OS-specific "main" will invoke "KMain" as
 *  platform independent main entrypoint.
 *
 *  "argc" [ IN ] - the number of textual parameters in "argv"
 *  should never be < 0, but has been left as a signed int
 *  for reasons of tradition.
 *
 *  "argv" [ IN ] - array of NUL terminated strings expected
 *  to be in the shell-native character set: ASCII or UTF-8
 *  element 0 is expected to be executable identity or path.
 */
rc_t CC KMain ( int argc, char *argv [] )
{
    Args * args;
    rc_t rc;

    KStsLevelSet (1);

    rc = ArgsMakeAndHandle (&args, argc, argv, 1, Options,
                            sizeof (Options) / sizeof (Options[0]));
    if (rc)
        LOGERR (klogInt, rc, "failed to parse command line parameters");

    else
    {
        uint32_t ocount;

        rc = ArgsOptionCount (args, OPTION_DEC_SRA, &ocount);
        if (rc)
            LOGERR (klogInt, rc, "failed to examine decrypt "
                    "sra option");
        else
        {
            DecryptSraFlag = (ocount > 0);

            rc = CommonMain (args);
        }
        ArgsWhack (args);
    }

    if (rc)
        STSMSG (1, ("exiting: %R (%u)", rc, rc));
    else
        STSMSG (1, ("exiting: success"));
    return rc;
}
Example #2
0
rc_t init_ref_regions( BSTree * tree, Args * args )
{
    uint32_t count;
    rc_t rc;

    BSTreeInit( tree );
    rc = ArgsOptionCount( args, OPTION_REF, &count );
    if ( rc != 0 )
    {
        LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
    }
    else
    {
        uint32_t i;
        for ( i = 0; i < count && rc == 0; ++i )
        {
            const char * s;
            rc = ArgsOptionValue( args, OPTION_REF, i, &s );
            if ( rc != 0 )
                LOGERR( klogInt, rc, "ArgsOptionValue() failed" );
            else
                rc = parse_and_add_region( tree, s );
        }
    }
    return rc;
}
Example #3
0
static rc_t gather_matepair_distances( Args * args, samdump_opts * opts )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, OPT_MATE_DIST, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "error counting comandline option '$(t)'", "t=%s", OPT_REGION ) );
    }
    else if ( count > 0 )
    {
        uint32_t i;

        VectorInit( &opts->mp_dist, 0, 10 );
        for ( i = 0; i < count && rc == 0; ++i )
        {
            const char * s;
            rc = ArgsOptionValue( args, OPT_MATE_DIST, i, &s );
            if ( rc != 0 )
            {
                (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline option '$(t)'", "t=%s", OPT_MATE_DIST ) );
            }
            else
                rc = parse_and_add_matepair_dist( &opts->mp_dist, s );
        }
        opts->use_matepair_filter = ( VectorLength( &opts->mp_dist ) > 0 );
    }
    return rc;
}
Example #4
0
static rc_t get_max_remove( const Args * args, uint64_t * max_rem )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, OPTION_MAXREM, &count );
    if ( rc != 0 )
    {
        PLOGERR( klogErr, ( klogErr, rc,
                 "ArgsOptionCount( $(option) ) failed in $(func)", "option=%s,func=%s", OPTION_MAXREM, __func__ ) );
    }
    else if ( count > 0 )
    {
        const char * s = NULL;
        rc = ArgsOptionValue( args, OPTION_MAXREM, 0, &s );
        if ( rc != 0 )
        {
            PLOGERR( klogErr, ( klogErr, rc,
                     "ArgsOptionValue( $(option), 0 ) failed in $(func)", "option=%s,func=%s", OPTION_MAXREM, __func__ ) );
        }
        else if ( s != NULL )
        {
            char *endp;
            *max_rem = strtou64( s, &endp, 10 );
        }
    }
    return rc;
}
Example #5
0
rc_t CC KMain(int argc, char *argv[]) {
    Args *args;
    rc_t rc; /*, orc; */

    rc = ArgsMakeAndHandle(&args, argc, argv, 0);
    if (rc == 0)
    {
        uint32_t pcount;
        rc_t orc;

        /* non standard use of --quiet */
        rc = ArgsOptionCount(args, OPTION_QUIET, &pcount);
        if (rc)
            LOGERR(klogErr, rc, "error check " OPTION_QUIET " option");

        else
            rc = run (pcount != 0);

        orc = ArgsWhack(args);
        if (rc == 0)
            rc = orc;
    }

    return rc;
}
Example #6
0
static rc_t gather_region_options( Args * args, samdump_opts * opts )
{
    uint32_t count;

    rc_t rc = ArgsOptionCount( args, OPT_REGION, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "error counting comandline option '$(t)'", "t=%s", OPT_REGION ) );
    }
    else if ( count > 0 )
    {
        uint32_t i;

        BSTreeInit( &opts->regions );
        for ( i = 0; i < count && rc == 0; ++i )
        {
            const char * s;
            rc = ArgsOptionValue( args, OPT_REGION, i, &s );
            if ( rc != 0 )
            {
                (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline option '$(t)'", "t=%s", OPT_REGION ) );
            }
            else
                rc = parse_and_add_region( &opts->regions, s );
        }
        if ( rc == 0 )
        {
            check_ref_regions( &opts->regions );
            opts->region_count = count_ref_regions( &opts->regions );
        }
    }
    return rc;
}
Example #7
0
rc_t get_ro( Args * args, const char * name, const int32_t ** RO, uint32_t * ro_count )
{
    rc_t rc = ArgsOptionCount( args, name, ro_count );
    *RO = NULL;
    if ( ( rc == 0 )&&( *ro_count > 0 ) )
    {
        *RO = calloc( sizeof **RO, *ro_count );
        if ( *RO == NULL )
            rc = RC( rcApp, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
        else
        {
            uint32_t i;
            for ( i = 0; i < *ro_count && rc == 0; ++i )
            {
                const char * s;
                rc = ArgsOptionValue( args, name, i, &s );
                if ( rc == 0 )
                {
                    ((int32_t*)(*RO))[i] = atoi( s );
                }
            }
        }
    }
    return rc;
}
Example #8
0
static
uint64_t ArgsGetOptU64 ( Args *self, const ctx_t *ctx, const char *optname, uint32_t *count )
{
    rc_t rc;
    uint64_t val = 0;

    uint32_t dummy;
    if ( count == NULL )
        count = & dummy;

    rc = ArgsOptionCount ( self, optname, count );
    if ( rc == 0 && * count != 0 )
    {
        const char *str;
        rc = ArgsOptionValue ( self, optname, 0, & str );
        if ( rc != 0 )
            INTERNAL_ERROR ( rc, "failed to retrieve '%s' parameter", optname );
        else
        {
            char *end;
            val = strtou64 ( str, & end, 0 );
            if ( end [ 0 ] != 0 )
            {
                rc = RC ( rcExe, rcArgv, rcParsing, rcParam, rcIncorrect );
                ERROR ( rc, "bad '%s' parameter: '%s'", optname, str );
            }
        }
    }

    return val;
}
Example #9
0
static rc_t cg_dump_get_uint32t_option( Args * args, const char * name, uint32_t * value, bool * found  )
{
    uint32_t count;

    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
    }
    else
    {
        *found = ( count > 0 );
    }

    if ( rc == 0 && ( *found ) )
    {
        const char * s;
        rc = ArgsOptionValue( args, name, 0,  &s );
        if ( rc != 0 )
        {
            (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect value of $(name) option", "name=%s", name ) );
        }
        else
        {
            *value = atoi( s );
        }
    }
    return rc;
}
Example #10
0
static KRepCategory get_repo_select( const Args * args, const char * name )
{
    KRepCategory res = krepBadCategory;
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc != 0 )
    {
        PLOGERR( klogErr, ( klogErr, rc,
                 "ArgsOptionCount() failed in $(func)", "func=%s", __func__ ) );
    }
    else if ( count > 0 )
    {
        const char * s = NULL;
        rc = ArgsOptionValue( args, name, 0, &s );
        if ( rc == 0 && s != NULL )
        {
            if ( string_cmp_1 ( s, "user" ) )
                res = krepUserCategory;
            else if ( string_cmp_1 ( s, "site" ) )
                res = krepSiteCategory;
            else if ( string_cmp_1 ( s, "rem" ) )
                res = krepRemoteCategory;
        }
    }
    return res;
}
Example #11
0
rc_t CC KMain ( int argc, char *argv [] )
{
    Args * args;
    rc_t rc;

    rc = ArgsMakeAndHandle (&args, argc, argv, 1, 
                            Options, sizeof (Options) / sizeof (OptDef));
    if (rc == 0)
    {
        do
        {
            uint32_t pcount;

            rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
            if (rc)
                break;

            force = (pcount > 0);

            rc = ArgsOptionCount (args, OPTION_RECURSE, &pcount);
            if (rc)
                break;

            recurse = (pcount > 0);


            rc = ArgsOptionCount (args, OPTION_TEST, &pcount);
            if (rc)
                break;

            test = (pcount > 0);

            rc = ArgsOptionCount (args, OPTION_PRESERVE, &pcount);
            if (rc)
                break;

            clobber_protections = (pcount > 0);

            rc  = run (args);

        }while (0);

        ArgsWhack (args);
    }
    return rc;
}
Example #12
0
static rc_t get_str_option( const Args * args, const char * option_name, const char ** dst, const char * default_value )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, option_name, &count );
    if ( ( rc == 0 )&&( count > 0 ) )
        rc = ArgsOptionValue( args, option_name, 0, (const void **)dst );
	else
		(*dst) = string_dup_measure ( default_value, NULL );
    return rc;
}
Example #13
0
/* KMain - EXTERN
 *  executable entrypoint "main" is implemented by
 *  an OS-specific wrapper that takes care of establishing
 *  signal handlers, logging, etc.
 *
 *  in turn, OS-specific "main" will invoke "KMain" as
 *  platform independent main entrypoint.
 *
 *  "argc" [ IN ] - the number of textual parameters in "argv"
 *  should never be < 0, but has been left as a signed int
 *  for reasons of tradition.
 *
 *  "argv" [ IN ] - array of NUL terminated strings expected
 *  to be in the shell-native character set: ASCII or UTF-8
 *  element 0 is expected to be executable identity or path.
 */
rc_t CC KMain ( int argc, char *argv [] )
{
    Args* args = NULL;
    rc_t rc;

    rc = ArgsMakeAndHandle(&args, argc, argv, 1, Options, sizeof Options / sizeof (OptDef));
    if (rc)
        LOGERR (klogInt, rc, "failed to parse command line parameters");
    if (rc == 0)
    {
        uint32_t pcount;
        bool force;

        rc = ArgsOptionCount (args, OPTION_FORCE, &pcount);
        if (rc)
            LOGERR (klogInt, rc, "failed to examine force option");
        else
        {
            force = (pcount > 0);

            rc = ArgsParamCount (args, &pcount);
            if (rc)
                LOGERR (klogInt, rc, "failed to count parameters");
            else
            {
                if (pcount != 2) {
                    MiniUsage (args);
                    rc = RC(rcApp, rcArgv, rcParsing, rcParam, rcInsufficient);
                }
                else
                {
                    const char * src;

                    rc = ArgsParamValue (args, 0, (const void **)&src);
                    if (rc)
                        LOGERR (klogInt, rc, "failed to get source parameter");
                    else
                    {
                        const char * dst;
                        rc = ArgsParamValue (args, 1, (const void **)&dst);
                        if (rc)
                            LOGERR (klogInt, rc, "failed to get destination parameter");
                        else
                        {
                            rc = nenctool (src, dst, force);
                        }
                    }
                }
            }
        }
        ArgsWhack (args);
    }
    STSMSG (1, ("exiting: %R (%u)", rc, rc));
    return rc;
}
Example #14
0
static const char* get_str_option( const Args *my_args, const char *name )
{
    const char* res = NULL;
    uint32_t count;
    rc_t rc = ArgsOptionCount( my_args, name, &count );
    if ( ( rc == 0 )&&( count > 0 ) )
    {
        ArgsOptionValue( my_args, name, 0, (const void **)&res );
    }
    return res;
}
Example #15
0
static bool get_bool_option( const Args * args, const char * name )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc != 0 )
    {
        PLOGERR( klogErr, ( klogErr, rc,
                 "ArgsOptionCount() failed in $(func)", "func=%s", __func__ ) );
        return false;
    }
    return ( count > 0 );
}
Example #16
0
LIB_EXPORT rc_t CC XMLLogger_Make(const XMLLogger** cself, KDirectory* dir, const Args *args)
{
    rc_t rc = 0;
    const char* path = NULL, *sfd = NULL;
    int fd = -1;
    uint32_t count;

    if( (rc = ArgsOptionCount(args, XMLLogger_Args[eopt_file].name, &count)) != 0 || count > 1 ) {
        rc = rc ? rc : RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
    } else if( count > 0 && (rc = ArgsOptionValue(args, XMLLogger_Args[eopt_file].name, 0, (const void **)&path)) != 0 ) {

    } else if( (rc = ArgsOptionCount(args, XMLLogger_Args[eopt_fd].name, &count)) != 0 || count > 1 ) {
        rc = rc ? rc : RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
    } else if( count > 0 && (rc = ArgsOptionValue(args, XMLLogger_Args[eopt_fd].name, 0, (const void **)&sfd)) != 0 ) {

    } else {
        do {
            long val = 0;
            char* end = NULL;

            if( sfd != NULL ) {
                if( path != NULL ) {
                    rc = RC(rcApp, rcArgv, rcParsing, rcParam, rcExcessive);
                    break;
                }
                errno = 0;
                val = strtol(sfd, &end, 10);
                if( errno != 0 || sfd == end || *end != '\0' || val < 0 || val > INT_MAX ) {
                    rc = RC(rcApp, rcArgv, rcReading, rcParam, rcInvalid);
                    break;
                }
                fd = val;
            }
            rc = XMLLogger_Make2(cself, dir, path, fd);
        } while( false );
    }
    return rc;
}
Example #17
0
rc_t CC Args_parse_inf_file( Args * args, const char * file_option )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, file_option, &count );
    if ( rc != 0 )
        LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
    else if ( count > 0 )
    {
        uint32_t count2 = 0;
        do
        {
            uint32_t idx;
            for ( idx = count2; idx < count && rc == 0; ++idx )
            {
                const char *filename;
                rc = ArgsOptionValue( args, file_option, idx, (const void **)&filename );
                if ( rc != 0 )
                    LOGERR( klogInt, rc, "ArgsOptionValue() failed" );
                else if ( filename != NULL )
                {
                    int argc;
                    char ** argv;
                    rc = Args_tokenize_file_into_argv( filename, &argc, &argv );
                    if ( rc == 0 && argv != NULL && argc > 0 )
                    {
                        rc = ArgsParse ( args, argc, argv );
                        Args_free_token_argv( argc, argv );
                    }
                }
            }
            count2 = count;
            rc = ArgsOptionCount( args, file_option, &count );
            if ( rc != 0 )
                LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
        } while ( rc == 0 && count > count2 );
    }
    return rc;
}
Example #18
0
static uint32_t get_uint32_option( const Args *my_args,
                                   const char *name,
                                   const uint32_t def )
{
    uint32_t count, res = def;
    rc_t rc = ArgsOptionCount( my_args, name, &count );
    if ( ( rc == 0 )&&( count > 0 ) )
    {
        const char *s;
        rc = ArgsOptionValue( my_args, name, 0,  &s );
        if ( rc == 0 ) res = strtoul( s, NULL, 10 );
    }
    return res;
}
Example #19
0
static rc_t get_bool_option( const Args *args, const char *name, bool *res, const bool def )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc == 0 && count > 0 )
    {
        *res = true;
    }
    else
    {
        *res = def;
    }
    return rc;
}
Example #20
0
static rc_t get_bool_option( Args * args, const char * name, bool *value )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "error reading comandline option '$(t)'", "t=%s", name ) );
    }
    else
    {
        *value = ( count > 0 );
    }
    return rc;
}
Example #21
0
static rc_t cg_dump_get_bool_option( Args * args, const char * name, bool * value )
{
    uint32_t count;

    rc_t rc = ArgsOptionCount( args, name, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "cannot detect count of $(name) option", "name=%s", name ) );
    }
    else
    {
        *value = ( count > 0 );
    }
    return rc;
}
Example #22
0
static void append_str_options( const Args *my_args, const char *name, VNamelist *dst )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( my_args, name, &count );
    if ( ( rc == 0 )&&( count > 0 ) )
    {
        uint32_t idx;
        for ( idx=0; idx<count; ++idx )
        {
            const char* s;
            if ( ArgsOptionValue( my_args, name, idx, (const void **)&s ) == 0 )
                VNamelistAppend( dst, s );
        }
    }
}
Example #23
0
static
bool ArgsGetOptBool ( Args *self, const ctx_t *ctx, const char *optname, uint32_t *count )
{
    rc_t rc;
    bool val = false;

    uint32_t dummy;
    if ( count == NULL )
        count = & dummy;

    rc = ArgsOptionCount ( self, optname, count );
    if ( rc == 0 && * count != 0 )
        val = true;

    return val;
}
Example #24
0
static
const char *ArgsGetOptStr ( Args *self, const ctx_t *ctx, const char *optname, uint32_t *count )
{
    rc_t rc;
    const char *val = NULL;

    uint32_t dummy;
    if ( count == NULL )
        count = & dummy;

    rc = ArgsOptionCount ( self, optname, count );
    if ( rc == 0 && * count != 0 )
    {
        rc = ArgsOptionValue ( self, optname, 0, & val );
        if ( rc != 0 )
            INTERNAL_ERROR ( rc, "failed to retrieve '%s' parameter", optname );
    }

    return val;
}
Example #25
0
rc_t get_str_option( const Args *args, const char *name, const char ** res )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, name, &count );
    *res = NULL;
    if ( rc != 0 )
        LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
    else
    {
        if ( count > 0 )
        {
            rc = ArgsOptionValue( args, name, 0, res );
            if ( rc != 0 )
            {
                LOGERR( klogInt, rc, "ArgsOptionValue() failed" );
            }
        }
    }
    return rc;
}
Example #26
0
static rc_t get_str_option( Args * args, const char * name, const char ** s )
{
    uint32_t count;

    rc_t rc = ArgsOptionCount( args, name, &count );
    *s = NULL;
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "error counting comandline option '$(t)'", "t=%s", name ) );
    }
    else if ( count > 0 )
    {
        rc = ArgsOptionValue( args, name, 0, s );
        if ( rc != 0 )
        {
            (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline option '$(t)'", "t=%s", name ) );
        }
    }
    return rc;
}
Example #27
0
rc_t get_uint32_array( const Args *args, const char *name,
                       uint32_t *res, uint32_t *count )
{
    uint32_t max = *count;
    rc_t rc = ArgsOptionCount( args, name, count );
    if ( rc != 0 )
        LOGERR( klogInt, rc, "ArgsOptionCount() failed" );
    else
    {
        uint32_t i;
        if ( *count > max ) *count = max;
        for ( i = 0; i < *count && rc == 0; ++ i )
        {
            const char * s;
            rc = ArgsOptionValue( args, name, i, &s );
            if ( rc == 0 )
                *(res++) = atoi( s );
        }
    }
    return rc;
}
Example #28
0
rc_t get_slices( const Args * args, const char *option, Vector * slices )
{
    uint32_t count, i;
    rc_t rc = ArgsOptionCount( args, option, &count );
    for ( i = 0; i < count && rc == 0; ++i )
    {
        const char * value;
        rc = ArgsOptionValue( args, option, i, ( const void ** )&value );
        if ( rc == 0 && value != NULL )
        {
            String S;
            StringInitCString( &S, value );
            {
                slice * s = make_slice_from_str( &S );
                rc = VectorAppend( slices, NULL, s );
                if ( rc != 0 )
                    release_slice( s );
            }
        }
    }
    return rc;
}
Example #29
0
static rc_t get_user_repo_name( const Args * args, const char ** name )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, OPTION_URNAME, &count );
    if ( rc != 0 )
    {
        PLOGERR( klogErr, ( klogErr, rc,
                 "ArgsOptionCount( $(option) ) failed in $(func)", "option=%s,func=%s", OPTION_URNAME, __func__ ) );
    }
    else if ( count > 0 )
    {
        const char * s = NULL;
        rc = ArgsOptionValue( args, OPTION_URNAME, 0, &s );
        if ( rc != 0 )
        {
            PLOGERR( klogErr, ( klogErr, rc,
                     "ArgsOptionValue( $(option), 0 ) failed in $(func)", "option=%s,func=%s", OPTION_URNAME, __func__ ) );
        }
        else if ( s != NULL )
            *name = string_dup_measure ( s, NULL );
    }
    return rc;
}
Example #30
0
static rc_t ParamsConstruct(int argc, char* argv[], Params* prm) {
    rc_t rc = 0;
    Args* args = NULL;
    int count = 0;
    assert(argc && argv && prm);
    memset(prm, 0, sizeof *prm);
    args = prm->args;
    do {
        uint32_t pcount = 0;
        rc = ArgsMakeAndHandle(&args, argc, argv, 1,
            Options, sizeof Options / sizeof (OptDef));
        if (rc) {
            LOGERR(klogErr, rc, "While calling ArgsMakeAndHandle");
            break;
        }
        prm->args = args;
        rc = ArgsParamCount(args, &prm->argsParamCnt);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get query parameter[s]");
            break;
        }
        if (prm->argsParamCnt > 0) {
            prm->modeShowCfg = true;
            ++count;
        }

        prm->xml = true;
        rc = ArgsOptionCount(args, OPTION_OUT, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_OUT "' argument");
            break;
        }
        if (pcount) {
            const char* dummy = NULL;
            rc = ArgsOptionValue(args, OPTION_OUT, 0, &dummy);
            if (rc) {
                LOGERR(klogErr, rc, "Failure to get '" OPTION_OUT "' argument");
                break;
            }
            if (!strcmp(dummy, "n")) {
                prm->xml = false;
            }
            else if (strcmp(dummy, "x")) {
                rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInvalid);
                LOGERR(klogErr, rc, "Bad " OPTION_OUT " value");
                break;
            }
        }

        rc = ArgsOptionCount(args, OPTION_CFG, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_CFG "' argument");
            break;
        }
        if (pcount) {
            if (!prm->modeShowCfg) {
                prm->modeShowCfg = true;
                ++count;
            }
        }

        rc = ArgsOptionCount(args, OPTION_ENV, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_ENV "' argument");
            break;
        }
        if (pcount) {
            prm->modeShowEnv = true;
            ++count;
        }

        rc = ArgsOptionCount(args, OPTION_FIL, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_FIL "' argument");
            break;
        }
        if (pcount) {
            prm->modeShowFiles = true;
            ++count;
        }

        rc = ArgsOptionCount(args, OPTION_IMP, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_IMP "' argument");
            break;
        }
        if (pcount) {
            rc = ArgsOptionValue(args, OPTION_IMP, 0, &prm->ngc);
            if (rc) {
                LOGERR(klogErr, rc, "Failure to get '" OPTION_IMP "' argument");
                break;
            }
        }

        rc = ArgsOptionCount(args, OPTION_MOD, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_MOD "' argument");
            break;
        }
        if (pcount) {
            prm->modeShowModules = true;
            ++count;
        }

#if 0
        rc = ArgsOptionCount(args, OPTION_NEW, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_NEW "' argument");
            break;
        }
        if (pcount) {
            prm->modeCreate = true;
            ++count;
        }
#endif

        rc = ArgsOptionCount(args, OPTION_DIR, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_DIR "' argument");
            break;
        }
        if (pcount) {
            prm->modeShowLoadPath = true;
            ++count;
        }

        rc = ArgsOptionCount(args, OPTION_SET, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_SET "' argument");
            break;
        }
        if (pcount) {
            rc = ArgsOptionValue(args, OPTION_SET, 0, &prm->setValue);
            if (rc == 0) {
                const char* p = strchr(prm->setValue, '=');
                if (p == NULL || *(p + 1) == '\0') {
                    rc = RC(rcExe, rcArgv, rcParsing, rcParam, rcInvalid);
                    LOGERR(klogErr, rc, "Bad " OPTION_SET " value");
                    break;
                }
                prm->modeSetNode = true;
                prm->modeCreate = prm->modeShowCfg = prm->modeShowEnv
                    = prm->modeShowFiles = prm->modeShowLoadPath
                    = prm->modeShowModules = false;
                count = 1;
            }
        }

        rc = ArgsOptionCount(args, OPTION_ALL, &pcount);
        if (rc) {
            LOGERR(klogErr, rc, "Failure to get '" OPTION_ALL "' argument");
            break;
        }
        if (pcount
            || ( !prm->modeShowCfg && ! prm->modeShowLoadPath
              && !prm->modeShowEnv && !prm->modeShowFiles
              && !prm->modeShowModules && !prm->modeCreate
              && !prm->modeSetNode && !prm->ngc))
            /* show all by default */
        {
            prm->modeShowCfg = prm->modeShowEnv = prm->modeShowFiles = true;
#ifndef _STATIC
            prm->modeShowModules = true;
#endif
            count += 2;
        }

        if (count > 1) 
        {   prm->showMultiple = true; }
    } while (false);

    return rc;
}