From afeaceef5fe47a82cf7dbf536dbbe45cbda72500 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Oct 2017 12:45:17 -0500 Subject: Windows had issues - revert code changes for get_option --- tools/lib/h5tools_utils.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 1b5911b..a081c7e 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -205,8 +205,9 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_opt = l_opts[i].shortval; if (l_opts[i].has_arg != no_arg) { - if (arg[len] == '=') + if (arg[len] == '=') { opt_arg = &arg[len + 1]; + } else if (l_opts[i].has_arg != optional_arg) { if (opt_ind < (argc - 1)) if (argv[opt_ind + 1][0] != '-') @@ -295,13 +296,16 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; /* we do have an extra argument, check if not last */ if ( (opt_ind+1) < argc ) { - if ( argv[opt_ind][0] != '-' ) + if ( argv[opt_ind][0] != '-' ) { opt_arg = argv[opt_ind++]; - else + } + else { opt_arg = NULL; + } } - else + else { opt_arg = NULL; + } } else { /* set up to look at next char in token, next time */ -- cgit v0.12