Fix: we're using c99 features in some places, so use them/declare them everywhere...
authorElronnd <[email protected]>
Wed, 10 Jul 2019 20:32:10 +0000 (10 13:32 -0700)
committerElronnd <[email protected]>
Wed, 10 Jul 2019 20:32:10 +0000 (10 13:32 -0700)
README
example.c
optfetch.c
optfetch.h

diff --git a/README b/README
index ed410e8..82d44b3 100644 (file)
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ See example.c for usage.  Most of the OPTTYPES should be self-explanatory.  Do
 note that in the case of OPTTYPE_BOOL, simply receiving the flag constitutes
 being enabled, so if you want to do something like "--dox yes", you will have to
 pass an OPTTYPE_STRING and do a strcmp yourself.  The library is written in ansi
-c89, so it should work *pretty much* anywhere.
+c99, so it should work *pretty much* anywhere.
 
 The function takes pointers to argc and argv because it modifies them.  It
 removes all the flags, leaving only the arguments.  argv[0] is untouched, and
index 7306fa9..b095591 100644 (file)
--- a/example.c
+++ b/example.c
@@ -3,7 +3,7 @@
 #include <stdbool.h>
 
 int main(int argc, char **argv) {
-       int debug = false;
+       bool debug = false;
        char *name = NULL;
        float boat = 0.0;
 
index ca80764..6de7bf7 100644 (file)
@@ -52,11 +52,8 @@ static int get_option_index_long(char *opt, char **potentialopts, uint len) {
 }
 
 
-signed char fetchopts(int *argc, char ***argv, struct opttype *opts) {
+void fetchopts(int *argc, char ***argv, struct opttype *opts) {
        uint numopts = countopts(opts);
-       if (!numopts) {
-               return 0;
-       }
 
        char *longopts[numopts];
        char shortopts[numopts];
@@ -185,6 +182,4 @@ end:
                /* -1, because argv starts at 1 (with 0 as program name), but newargv starts at 0 */
                (*argv)[i] = newargv[i-1];
        }
-
-       return 1;
 }
index 7b5e8d7..4979001 100644 (file)
@@ -20,4 +20,4 @@ struct opttype {
 #define OPTTYPE_LONGDOUBLE 13
 #define OPTTYPE_STRING 14
 
-signed char fetchopts(int *argc, char ***argv, struct opttype *opts);
+void fetchopts(int *argc, char ***argv, struct opttype *opts);