Thu, 09 Feb 2012 15:56:18 +0100
allow parallel use of -s and -S
/* * arguments.c * * Created on: 15.09.2011 * Author: Mike */ #include "arguments.h" int checkArgument(const char* arg, const char* expected) { int len = strlen(expected); int ret = 0; if (arg[0] == '-') { if (arg[1] != '-') { for (int t = 0 ; t < len ; t++) { ret |= (strchr(arg, expected[t]) > 0) << t; } } } return ret; } bool registerArgument(int* reg, int mask) { bool ret = (*reg & mask) > 0; *reg |= mask; return ret; } bool checkParamOpt(int* paropt) { bool ret = *paropt == 0; *paropt = 1; return ret; } void parseCSL(char* csl, string_list_t* list) { if (csl != NULL) { char* finder = strtok(csl, ","); while (finder != NULL) { add_string(list, finder); finder = strtok(NULL, ","); } } }