arguments.c

changeset 10
ecf787666f44
child 20
43725438ac50
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arguments.c	Thu Sep 15 13:29:06 2011 +0200
@@ -0,0 +1,29 @@
+/*
+ * arguments.c
+ *
+ *  Created on: 15.09.2011
+ *      Author: beckermi
+ */
+
+#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;
+}

mercurial