arguments.c

Sun, 16 Oct 2011 12:20:52 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 16 Oct 2011 12:20:52 +0200
changeset 19
8bac9fd0629d
parent 10
ecf787666f44
child 20
43725438ac50
permissions
-rw-r--r--

generalized suffix_list to string_list

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