@@ -82,10 +82,20 @@ dataval = data; *dataval = strtoull(value, NULL, 10); return(0); } + +static int lc_process_var_bool_byexistance(void *data, const char *value) { + int *dataval; + + dataval = data; + + *dataval = 1; + + return(0); +} static int lc_process_var_bool(void *data, const char *value) { int *dataval; dataval = data; @@ -210,10 +220,13 @@ return(lc_process_var_sizeint(data, value)); break; case LC_VAR_SIZE_SHORT: return(lc_process_var_sizeshort(data, value)); break; + case LC_VAR_BOOL_BY_EXISTANCE: + return(lc_process_var_bool_byexistance(data, value)); + break; case LC_VAR_TIME: case LC_VAR_DATE: case LC_VAR_FILENAME: case LC_VAR_DIRECTORY: PRINTERR_D("Not implemented yet!"); @@ -364,11 +377,11 @@ /* Ignore this handler if they don't match. */ if (strcasecmp(lastcomponent_handler, cmdarg) != 0) { continue; } - if (handler->type == LC_VAR_NONE) { + if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) { cmdoptarg = NULL; } else { cmdargidx++; if (cmdargidx >= argc) { PRINTERR("Argument required."); @@ -408,11 +421,11 @@ handler->type == LC_VAR_SECTIONEND || handler->type == LC_VAR_UNKNOWN) { continue; } - if (handler->type == LC_VAR_NONE) { + if (handler->type == LC_VAR_NONE || handler->type == LC_VAR_BOOL_BY_EXISTANCE) { cmdoptarg = NULL; } else { cmdargidx++; if (cmdargidx >= argc) { PRINTERR("Argument required."); @@ -495,10 +508,11 @@ } } if (value == NULL && handler->type != LC_VAR_NONE && + handler->type != LC_VAR_BOOL_BY_EXISTANCE && handler->type != LC_VAR_SECTION && handler->type != LC_VAR_SECTIONSTART && handler->type != LC_VAR_SECTIONEND) { lc_errno = LC_ERR_BADFORMAT; break;