aboutsummaryrefslogtreecommitdiff
path: root/src/opt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/opt.h')
-rw-r--r--src/opt.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/opt.h b/src/opt.h
new file mode 100644
index 0000000..6d66101
--- /dev/null
+++ b/src/opt.h
@@ -0,0 +1,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