summaryrefslogtreecommitdiffstats
path: root/tools/src/h5format_convert
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-29 20:06:48 (GMT)
committerGitHub <noreply@github.com>2021-06-29 20:06:48 (GMT)
commit2090a527c13a13c0ea5b59b319b3402d2ef8f578 (patch)
treeb9d6a7744894956cba1e99630f1803c42d2298e4 /tools/src/h5format_convert
parent4ff544f9977da3bd54eac03cc124961eea7c4daf (diff)
downloadhdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.zip
hdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.tar.gz
hdf5-2090a527c13a13c0ea5b59b319b3402d2ef8f578.tar.bz2
Brings the tools getopt(3) replacement into the main library (#803)
* Moves get_option from the tools library to the C library * Adds H5 prefix to get_option call and variables * Renames the H5_get_option long options struct and enum
Diffstat (limited to 'tools/src/h5format_convert')
-rw-r--r--tools/src/h5format_convert/h5format_convert.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index 321f274..3430c55 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -38,28 +38,28 @@ static int verbose_g = 0;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "hVvd:n";
-static struct long_options l_opts[] = {{"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"he", no_arg, 'h'},
- {"version", no_arg, 'V'},
- {"version", no_arg, 'V'},
- {"versio", no_arg, 'V'},
- {"versi", no_arg, 'V'},
- {"vers", no_arg, 'V'},
- {"verbose", no_arg, 'v'},
- {"verbos", no_arg, 'v'},
- {"verbo", no_arg, 'v'},
- {"verb", no_arg, 'v'},
- {"dname", require_arg, 'd'},
- {"dnam", require_arg, 'd'},
- {"dna", require_arg, 'd'},
- {"dn", require_arg, 'd'},
- {"noop", no_arg, 'n'},
- {"noo", no_arg, 'n'},
- {"no", no_arg, 'n'},
- {"enable-error-stack", no_arg, 'E'},
- {NULL, 0, '\0'}};
+static const char * s_opts = "hVvd:n";
+static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"he", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"verbose", no_arg, 'v'},
+ {"verbos", no_arg, 'v'},
+ {"verbo", no_arg, 'v'},
+ {"verb", no_arg, 'v'},
+ {"dname", require_arg, 'd'},
+ {"dnam", require_arg, 'd'},
+ {"dna", require_arg, 'd'},
+ {"dn", require_arg, 'd'},
+ {"noop", no_arg, 'n'},
+ {"noo", no_arg, 'n'},
+ {"no", no_arg, 'n'},
+ {"enable-error-stack", no_arg, 'E'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -123,7 +123,7 @@ parse_command_line(int argc, const char **argv)
}
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
+ while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'h':
usage(h5tools_getprogname());
@@ -140,11 +140,11 @@ parse_command_line(int argc, const char **argv)
break;
case 'd': /* -d dname */
- if (opt_arg != NULL && *opt_arg)
- dname_g = HDstrdup(opt_arg);
+ if (H5_optarg != NULL && *H5_optarg)
+ dname_g = HDstrdup(H5_optarg);
if (dname_g == NULL) {
h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", opt_arg);
+ error_msg("No dataset name\n", H5_optarg);
usage(h5tools_getprogname());
goto error;
}
@@ -167,19 +167,19 @@ parse_command_line(int argc, const char **argv)
} /* switch */
} /* while */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
h5tools_setstatus(EXIT_FAILURE);
goto error;
}
- fname_g = HDstrdup(argv[opt_ind]);
+ fname_g = HDstrdup(argv[H5_optind]);
- return (0);
+ return 0;
error:
- return (-1);
+ return -1;
;
} /* parse_command_line() */