ossp-pkg/rc/rc_config.c 1.23 -> 1.24
--- rc_config.c 2002/07/29 16:34:59 1.23
+++ rc_config.c 2002/07/30 16:32:40 1.24
@@ -218,12 +218,45 @@
/************************************************
* configVerify(void) *
* Verify config options help, usage, or version *
+* and ensure that no uncompatible option *
+* combinations were given *
************************************************/
rc_return_t configVerify(void)
{
ex_t Except;
short bStop = FALSE;
+
+
+ try { /* Checks for legal option combination */
+ /* I'm too braindead to remember digital logic theory from the */
+ /* Uni, so I'll hack my own XOR gates with plain math instead */
+ /* Exec XOR Eval XOR Print */
+ if (!configGetval(RC_EVL_VAL) \
+ + !configGetval(RC_EXC_VAL) \
+ + !configGetval(RC_PRN_VAL) < 2) { /* Warning! Magic number */
+ fprintf(stderr, RC_EEP_TEXT);
+ bStop = TRUE;
+ }
+ /* Silent XOR OutputOptions */
+ if (configGetval(RC_SIL_VAL) && (configGetval(RC_DBG_VAL) \
+ || configGetval(RC_VER_VAL) || configGetval(RC_EVL_VAL) \
+ || configGetval(RC_HLP_VAL) || configGetval(RC_INF_VAL) \
+ || configGetval(RC_LBL_VAL) || configGetval(RC_PRN_VAL) \
+ || configGetval(RC_RAW_VAL) || configGetval(RC_VRB_VAL) \
+ || configGetval(RC_QRY_VAL))) {
+ fprintf(stderr, RC_SLO_TEXT);
+ bStop = TRUE;
+ }
+ }
+ catch(Except) {
+ rethrow;
+ }
+ if (bStop) { /* Did user blow an option rule? */
+ clioptPrintusage(); /* Yes, so announce it as SUE. */
+ return(RC_THROW(RC_ERR_TRM));
+ }
+
try { /* Basic checks of version, usage, and help options */
if (configGetval(RC_USE_VAL)) {
clioptPrintusage();
|
|