aboutsummaryrefslogtreecommitdiff
path: root/src/opt.h
blob: 6d661013f209f5934b8229171281115aa0bc2257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef OPT_H
#define OPT_H 1

#define OPT(opt_index) config_opts[opt_index]
#define GETOPT(opt_index) OPT(opt_index).opt
#define OPT_USED(opt_index, uvalue) OPT(opt_index).found = uvalue;
#define d_OPT(opt_index, rvalue) OPT(opt_index).opt.dec = rvalue; OPT_USED(opt_index, 1);
#define s_OPT(opt_index, rvalue) OPT(opt_index).opt.str = rvalue; OPT_USED(opt_index, 1);

union opt_entry {
  char *str;
  int *dec;
};

struct opt {
  union opt_entry opt;
  unsigned char found;
  const union opt_entry def;
};

enum opt_index {
  FIFO_PATH = 0,
  CRYPT_CMD
};


extern struct opt config_opts[];

void
usage(char *arg0);

int
parse_cmd(int argc, char **argv);

#endif