arguments.c

Thu, 01 Dec 2011 17:06:27 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 01 Dec 2011 17:06:27 +0100
changeset 26
853a1181884b
parent 20
43725438ac50
child 30
d642fdb6745e
permissions
-rw-r--r--

Merge with 3963e8800a1268be93d938c709e2d4be4d0b2d39

/*
 * 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;
}

mercurial