summaryrefslogtreecommitdiffstats
path: root/tools/src/misc/h5mkgrp.c
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/misc/h5mkgrp.c
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/misc/h5mkgrp.c')
-rw-r--r--tools/src/misc/h5mkgrp.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index 516191c..a85ee4d 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -22,8 +22,8 @@
int d_status = EXIT_SUCCESS;
/* command-line options: short and long-named parameters */
-static const char * s_opts = "hlpvV";
-static struct long_options l_opts[] = {
+static const char * s_opts = "hlpvV";
+static struct h5_long_options l_opts[] = {
{"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, {"parents", no_arg, 'p'},
{"verbose", no_arg, 'v'}, {"version", no_arg, 'V'}, {"vol-value", require_arg, '1'},
{"vol-name", require_arg, '2'}, {"vol-info", require_arg, '3'}, {NULL, 0, '\0'}};
@@ -140,7 +140,7 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t));
/* 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) {
/* Display 'help' */
case 'h':
@@ -171,18 +171,18 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
case '1':
vol_info.type = VOL_BY_VALUE;
- vol_info.u.value = (H5VL_class_value_t)HDatoi(opt_arg);
+ vol_info.u.value = (H5VL_class_value_t)HDatoi(H5_optarg);
custom_fapl = TRUE;
break;
case '2':
vol_info.type = VOL_BY_NAME;
- vol_info.u.name = opt_arg;
+ vol_info.u.name = H5_optarg;
custom_fapl = TRUE;
break;
case '3':
- vol_info.info_string = opt_arg;
+ vol_info.info_string = H5_optarg;
break;
/* Bad command line argument */
@@ -193,33 +193,33 @@ parse_command_line(int argc, const char *argv[], mkgrp_opt_t *options)
} /* end while */
/* Check for file name to be processed */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing file name\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
/* Retrieve file name */
- options->fname = HDstrdup(argv[opt_ind]);
- opt_ind++;
+ options->fname = HDstrdup(argv[H5_optind]);
+ H5_optind++;
/* Check for group(s) to be created */
- if (argc <= opt_ind) {
+ if (argc <= H5_optind) {
error_msg("missing group name(s)\n");
usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
/* Allocate space for the group name pointers */
- options->ngroups = (size_t)(argc - opt_ind);
+ options->ngroups = (size_t)(argc - H5_optind);
options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *));
/* Retrieve the group names */
curr_group = 0;
- while (opt_ind < argc) {
- options->groups[curr_group] = HDstrdup(argv[opt_ind]);
+ while (H5_optind < argc) {
+ options->groups[curr_group] = HDstrdup(argv[H5_optind]);
curr_group++;
- opt_ind++;
+ H5_optind++;
}
/* Setup a custom fapl for file accesses */