summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-04-14 08:50:45 +0200
committerYorhel <git@yorhel.nl>2013-04-14 08:50:45 +0200
commit181e1eaa6c08732ca7c713702496873b8ab60ea0 (patch)
tree646ff5ec651536c092a50b753c21fcbbad23556b
parent79d43d183d03d1ad8ef546e291f13b40d54047b0 (diff)
ylib/yopt.h update
-rw-r--r--ylib/yopt.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/ylib/yopt.h b/ylib/yopt.h
index e8a9949..98d969b 100644
--- a/ylib/yopt.h
+++ b/ylib/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;