diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-02-27 01:07:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-27 01:07:39 (GMT) |
commit | e8b030363999befa548b94ac5c505d170540aebc (patch) | |
tree | 23e9d091c88e76bfe8ab842efa87cdda89e39974 /tools/src/misc | |
parent | 1c10010a316c0885cd71fad6c8d0067a0eb8f7f1 (diff) | |
download | hdf5-e8b030363999befa548b94ac5c505d170540aebc.zip hdf5-e8b030363999befa548b94ac5c505d170540aebc.tar.gz hdf5-e8b030363999befa548b94ac5c505d170540aebc.tar.bz2 |
1.10 Fix tools incompatibility (#1449)
* fix tools incompatibility with get_option #1443
* Fix get_option function
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/src/misc')
-rw-r--r-- | tools/src/misc/h5clear.c | 16 | ||||
-rw-r--r-- | tools/src/misc/h5mkgrp.c | 26 |
2 files changed, 21 insertions, 21 deletions
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 15c170d..60e2e63 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -44,8 +44,8 @@ static hsize_t increment = DEFAULT_INCREMENT; /* * Command-line options: only publicize long options */ -static const char * s_opts = "hVsmzi*"; -static struct h5_long_options l_opts[] = { +static const char * s_opts = "hVsmzi*"; +static struct long_options l_opts[] = { {"help", no_arg, 'h'}, {"version", no_arg, 'V'}, {"status", no_arg, 's'}, {"image", no_arg, 'm'}, {"filesize", no_arg, 'z'}, {"increment", optional_arg, 'i'}, {NULL, 0, '\0'}}; @@ -121,7 +121,7 @@ parse_command_line(int argc, const char *const *argv) } /* parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -147,12 +147,12 @@ parse_command_line(int argc, const char *const *argv) case 'i': increment_eoa_eof = TRUE; - if (H5_optarg != NULL) { - if (HDatoi(H5_optarg) < 0) { + if (opt_arg != NULL) { + if (HDatoi(opt_arg) < 0) { usage(h5tools_getprogname()); goto done; } - increment = (hsize_t)HDatoi(H5_optarg); + increment = (hsize_t)HDatoi(opt_arg); } break; @@ -164,14 +164,14 @@ parse_command_line(int argc, const char *const *argv) } /* end while */ /* check for file name to be processed */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto error; } /* end if */ - fname_g = HDstrdup(argv[H5_optind]); + fname_g = HDstrdup(argv[opt_ind]); done: return (0); diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index 1942216..9b0d8f0 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -22,10 +22,10 @@ int d_status = EXIT_SUCCESS; /* command-line options: short and long-named parameters */ -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'}, {NULL, 0, '\0'}}; +static const char * s_opts = "hlpvV"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"latest", no_arg, 'l'}, + {"parents", no_arg, 'p'}, {"verbose", no_arg, 'v'}, + {"version", no_arg, 'V'}, {NULL, 0, '\0'}}; /* Command line parameter settings */ typedef struct mkgrp_opt_t { @@ -124,7 +124,7 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options) } /* Parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { /* Display 'help' */ case 'h': @@ -161,33 +161,33 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options) } /* end while */ /* Check for file name to be processed */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); leave(EXIT_FAILURE); } /* Retrieve file name */ - options->fname = HDstrdup(argv[H5_optind]); - H5_optind++; + options->fname = HDstrdup(argv[opt_ind]); + opt_ind++; /* Check for group(s) to be created */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { 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 - H5_optind); + options->ngroups = (size_t)(argc - opt_ind); options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; - while (H5_optind < argc) { - options->groups[curr_group] = HDstrdup(argv[H5_optind]); + while (opt_ind < argc) { + options->groups[curr_group] = HDstrdup(argv[opt_ind]); curr_group++; - H5_optind++; + opt_ind++; } return 0; |