|
1 /* |
|
2 * arguments.c |
|
3 * |
|
4 * Created on: 15.09.2011 |
|
5 * Author: beckermi |
|
6 */ |
|
7 |
|
8 #include "arguments.h" |
|
9 |
|
10 int checkArgument(const char* arg, const char* expected) { |
|
11 int len = strlen(expected); |
|
12 int ret = 0; |
|
13 |
|
14 if (arg[0] == '-') { |
|
15 if (arg[1] != '-') { |
|
16 for (int t = 0 ; t < len ; t++) { |
|
17 ret |= (strchr(arg, expected[t]) > 0) << t; |
|
18 } |
|
19 } |
|
20 } |
|
21 |
|
22 return ret; |
|
23 } |
|
24 |
|
25 bool registerArgument(int* reg, int mask) { |
|
26 bool ret = (*reg & mask) > 0; |
|
27 *reg |= mask; |
|
28 return ret; |
|
29 } |