summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-04-14 08:47:55 +0200
committerYorhel <git@yorhel.nl>2013-04-14 08:47:55 +0200
commitc8d7a655f85ee796ab01360896f04f7111ae81cc (patch)
tree1df55add2b00ce6fb508a785b0625bdfc0d985e4
parent742e8019a9ac853df9bac83904b2ff49867620e2 (diff)
yopt: Add const flag to option list argument
-rw-r--r--yopt.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/yopt.h b/yopt.h
index e8a9949..98d969b 100644
--- a/yopt.h
+++ b/yopt.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 Yoran Heling
+/* Copyright (c) 2012-2013 Yoran Heling
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -74,13 +74,13 @@ typedef struct {
int argsep; /* '--' found */
char **argv;
char *sh;
- yopt_opt_t *opts;
+ const yopt_opt_t *opts;
char errbuf[128];
} yopt_t;
/* opts must be an array of options, terminated with an option with val=0 */
-static inline void yopt_init(yopt_t *o, int argc, char **argv, yopt_opt_t *opts) {
+static inline void yopt_init(yopt_t *o, int argc, char **argv, const yopt_opt_t *opts) {
o->argc = argc;
o->argv = argv;
o->opts = opts;
@@ -90,7 +90,7 @@ static inline void yopt_init(yopt_t *o, int argc, char **argv, yopt_opt_t *opts)
}
-static inline yopt_opt_t *_yopt_find(yopt_opt_t *o, const char *v) {
+static inline const yopt_opt_t *_yopt_find(const yopt_opt_t *o, const char *v) {
const char *tn, *tv;
for(; o->val; o++) {
@@ -132,7 +132,7 @@ static inline int _yopt_err(yopt_t *o, char **val, const char *fmt, ...) {
* value will be in val.
*/
static inline int yopt_next(yopt_t *o, char **val) {
- yopt_opt_t *opt;
+ const yopt_opt_t *opt;
char sh[3];
*val = NULL;