Index: ossp-pkg/rc/rc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.c,v rcsdiff -q -kk '-r1.32' '-r1.33' -u '/v/ossp/cvs/ossp-pkg/rc/rc.c,v' 2>/dev/null --- rc.c 2002/06/26 14:11:16 1.32 +++ rc.c 2002/06/26 14:42:53 1.33 @@ -43,14 +43,13 @@ ex_try { /* Configuration block */ configNew(); /* Construct a new configuration */ configLoad(argc, (const char **)argv); /* Load cli, env, and conf */ - configDebug(); /* FIXME Remove FIXME */ configVerify(); /* Test for usage, help, and version options */ } ex_catch(Except) { /* Exceptions of the configuration block */ - TRACE("Hopla, in config exception block"); - if ((rc_return_t)Except.ex_value == RC_ERR_USE) { + if ((rc_return_t)Except.ex_value == RC_WRN_TRM) + exit(0); + else if ((rc_return_t)Except.ex_value == RC_ERR_USE) clioptPrintusage(); - } else { fprintf(stderr, "Class '%s' threw exception %d in %s:%s():%d.\n",\ (char *)Except.ex_class, (int)Except.ex_value,\ Index: ossp-pkg/rc/rc.h RCS File: /v/ossp/cvs/ossp-pkg/rc/rc.h,v rcsdiff -q -kk '-r1.29' '-r1.30' -u '/v/ossp/cvs/ossp-pkg/rc/rc.h,v' 2>/dev/null --- rc.h 2002/06/26 14:11:16 1.29 +++ rc.h 2002/06/26 14:42:53 1.30 @@ -52,16 +52,17 @@ /* Rc return codes */ typedef enum { - RC_OK = 1, /* Success */ - RC_ERR_0 = 2, /* Error base */ - RC_ERR_USE = 3, /* Usage error */ - RC_ERR_MEM = 4, /* Memory error */ - RC_ERR_SYS = 5, /* System error (see errno) */ - RC_ERR_IO = 6, /* Input/output error */ - RC_ERR_INT = 7, /* Internal error */ - RC_WRN_0 = 8, /* Warning base */ - RC_WRN_OWR = 9, /* Overwrite warning */ - RC_WRN_NUL = 10 /* NULL pointer warning */ + RC_OK = 1, /* Success */ + RC_ERR_0 = 2, /* Error base */ + RC_ERR_USE = 3, /* Usage error */ + RC_ERR_MEM = 4, /* Memory error */ + RC_ERR_SYS = 5, /* System error (see errno) */ + RC_ERR_IO = 6, /* Input/output error */ + RC_ERR_INT = 7, /* Internal error */ + RC_WRN_0 = 8, /* Warning base */ + RC_WRN_OWR = 9, /* Overwrite warning */ + RC_WRN_NUL = 10, /* NULL pointer warning */ + RC_WRN_TRM = 11 /* Request to terminate app */ } rc_return_t; /* Config function prototypes */ Index: ossp-pkg/rc/rc_cliopt.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_cliopt.c,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/rc/rc_cliopt.c,v' 2>/dev/null --- rc_cliopt.c 2002/06/26 14:11:16 1.11 +++ rc_cliopt.c 2002/06/26 14:42:53 1.12 @@ -290,12 +290,11 @@ } } - if (cliOpt < -1) { - /* An error occurred during option processing */ + if (cliOpt < -1) { /* The option given was not found in the index */ fprintf(stderr, "%s: %s\n", popt_badoption(m_Optcon, POPT_BADOPTION_NOALIAS), popt_strerror(cliOpt)); - return(RC_THROW(RC_ERR_INT)); + return(RC_THROW(RC_ERR_USE)); } return(RC_THROW(RC_OK)); Index: ossp-pkg/rc/rc_config.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_config.c,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/rc/rc_config.c,v' 2>/dev/null --- rc_config.c 2002/06/26 14:11:16 1.17 +++ rc_config.c 2002/06/26 14:42:53 1.18 @@ -255,20 +255,30 @@ rc_return_t configVerify(void) { ex_t Except; + short bStop = FALSE; try { /* Basic checks of version, usage, and help options */ - if (configGetval(RC_VER_VAL)) + if (configGetval(RC_VER_VAL)) { fprintf(stdout, "OSSP rc %s\n", RC_VERSION); - if (configGetval(RC_USE_VAL)) + bStop = TRUE; + } + if (configGetval(RC_USE_VAL)) { clioptPrintusage(); - if (configGetval(RC_HLP_VAL)) + bStop = TRUE; + } + if (configGetval(RC_HLP_VAL)) { clioptPrintusage(); /* FIXME Replace with real help FIXME */ + bStop = TRUE; + } } catch(Except) { rethrow; } - return(RC_THROW(RC_OK)); + if (bStop) /* Did user request a non-operation? */ + return(RC_THROW(RC_WRN_TRM)); /* Yes, so terminate after handling. */ + else + return(RC_THROW(RC_OK)); /* No, we should continue processing. */ } /*************************************** Index: ossp-pkg/rc/rc_proc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v' 2>/dev/null --- rc_proc.c 2002/06/26 14:11:16 1.4 +++ rc_proc.c 2002/06/26 14:42:53 1.5 @@ -36,6 +36,7 @@ #include #include "rc.h" /* Public interfaces */ +#include "rc_config.h" /* Option definitions */ /************************************************ @@ -135,6 +136,10 @@ ************************************************/ rc_return_t procRun(rc_proc_t *pRc) { + + if (configGetval(RC_DBG_VAL)) /* Dump the running config table */ + configDebug(); /* if debug switch is turned on */ + scriptDump(pRc->m_pScript); return(RC_THROW(RC_OK));