summaryrefslogtreecommitdiffstats
path: root/src/opt.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-06 15:42:04 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-06 15:42:04 +0000
commit232dbc756390d30a86ae6de0cc84600eddb1c0b2 (patch)
treee4aadbb4076392bcaf30cce6329dc715375a98d7 /src/opt.c
parent550bda3e54a0895e027fee14860f14171a357ac9 (diff)
downloadlibrcc-232dbc756390d30a86ae6de0cc84600eddb1c0b2.tar.gz
librcc-232dbc756390d30a86ae6de0cc84600eddb1c0b2.tar.bz2
librcc-232dbc756390d30a86ae6de0cc84600eddb1c0b2.tar.xz
librcc-232dbc756390d30a86ae6de0cc84600eddb1c0b2.zip
Recode FS Fixes
Diffstat (limited to 'src/opt.c')
-rw-r--r--src/opt.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/opt.c b/src/opt.c
index 82e1be1..040bea4 100644
--- a/src/opt.c
+++ b/src/opt.c
@@ -4,19 +4,31 @@
#include "opt.h"
rcc_option_value rccGetOption(rcc_context ctx, rcc_option option) {
- if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return (rcc_option_value)0;
+ }
+ if ((option<0)||(option>=RCC_MAX_OPTIONS)) return 0;
return ctx->options[option];
}
int rccOptionIsDefault(rcc_context ctx, rcc_option option) {
- if ((!ctx)||(option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return -1;
+ }
+ if ((option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
return ctx->default_options[option];
}
int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) {
- if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1;
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return -1;
+ }
+ if ((option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
ctx->default_options[option] = 0;
@@ -30,7 +42,12 @@ int rccSetOption(rcc_context ctx, rcc_option option, rcc_option_value value) {
int rccOptionSetDefault(rcc_context ctx, rcc_option option) {
rcc_option_value value;
- if ((!ctx)||(option>=RCC_MAX_OPTIONS)) return -1;
+
+ if (!ctx) {
+ if (rcc_default_ctx) ctx = rcc_default_ctx;
+ else return -1;
+ }
+ if ((option<0)||(option>=RCC_MAX_OPTIONS)) return -1;
ctx->default_options[option] = 1;
value = rccGetOptionDefaultValue(option);