summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack/h5repack_main.c
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-02-27 01:07:39 (GMT)
committerGitHub <noreply@github.com>2022-02-27 01:07:39 (GMT)
commite8b030363999befa548b94ac5c505d170540aebc (patch)
tree23e9d091c88e76bfe8ab842efa87cdda89e39974 /tools/src/h5repack/h5repack_main.c
parent1c10010a316c0885cd71fad6c8d0067a0eb8f7f1 (diff)
downloadhdf5-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/h5repack/h5repack_main.c')
-rw-r--r--tools/src/h5repack/h5repack_main.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 04a87b9..8ab9637 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -31,38 +31,38 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
-static struct h5_long_options l_opts[] = {{"alignment", require_arg, 'a'},
- {"block", require_arg, 'b'},
- {"compact", require_arg, 'c'},
- {"indexed", require_arg, 'd'},
- {"file", require_arg, 'e'},
- {"filter", require_arg, 'f'},
- {"help", no_arg, 'h'},
- {"infile", require_arg, 'i'}, /* for backward compability */
- {"low", require_arg, 'j'},
- {"high", require_arg, 'k'},
- {"layout", require_arg, 'l'},
- {"minimum", require_arg, 'm'},
- {"native", no_arg, 'n'},
- {"outfile", require_arg, 'o'}, /* for backward compability */
- {"sort_by", require_arg, 'q'},
- {"ssize", require_arg, 's'},
- {"threshold", require_arg, 't'},
- {"ublock", require_arg, 'u'},
- {"verbose", no_arg, 'v'},
- {"sort_order", require_arg, 'z'},
- {"enable-error-stack", no_arg, 'E'},
- {"fs_pagesize", require_arg, 'G'},
- {"latest", no_arg, 'L'},
- {"metadata_block_size", require_arg, 'M'},
- {"fs_persist", require_arg, 'P'},
- {"fs_strategy", require_arg, 'S'},
- {"fs_threshold", require_arg, 'T'},
- {"version", no_arg, 'V'},
- {"merge", no_arg, 'X'},
- {"prune", no_arg, 'W'},
- {NULL, 0, '\0'}};
+static const char * s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW";
+static struct long_options l_opts[] = {{"alignment", require_arg, 'a'},
+ {"block", require_arg, 'b'},
+ {"compact", require_arg, 'c'},
+ {"indexed", require_arg, 'd'},
+ {"file", require_arg, 'e'},
+ {"filter", require_arg, 'f'},
+ {"help", no_arg, 'h'},
+ {"infile", require_arg, 'i'}, /* for backward compability */
+ {"low", require_arg, 'j'},
+ {"high", require_arg, 'k'},
+ {"layout", require_arg, 'l'},
+ {"minimum", require_arg, 'm'},
+ {"native", no_arg, 'n'},
+ {"outfile", require_arg, 'o'}, /* for backward compability */
+ {"sort_by", require_arg, 'q'},
+ {"ssize", require_arg, 's'},
+ {"threshold", require_arg, 't'},
+ {"ublock", require_arg, 'u'},
+ {"verbose", no_arg, 'v'},
+ {"sort_order", require_arg, 'z'},
+ {"enable-error-stack", no_arg, 'E'},
+ {"fs_pagesize", require_arg, 'G'},
+ {"latest", no_arg, 'L'},
+ {"metadata_block_size", require_arg, 'M'},
+ {"fs_persist", require_arg, 'P'},
+ {"fs_strategy", require_arg, 'S'},
+ {"fs_threshold", require_arg, 'T'},
+ {"version", no_arg, 'V'},
+ {"merge", no_arg, 'X'},
+ {"prune", no_arg, 'W'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: usage
@@ -462,18 +462,18 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
int ret_value = 0;
/* parse command line options */
- while (EOF != (opt = H5_get_option(argc, argv, s_opts, l_opts))) {
+ while (EOF != (opt = get_option(argc, argv, s_opts, l_opts))) {
switch ((char)opt) {
/* -i for backward compatibility */
case 'i':
- infile = H5_optarg;
+ infile = opt_arg;
has_i++;
break;
/* -o for backward compatibility */
case 'o':
- outfile = H5_optarg;
+ outfile = opt_arg;
has_o++;
break;
@@ -495,7 +495,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case 'f':
/* parse the -f filter option */
- if (h5repack_addfilter(H5_optarg, options) < 0) {
+ if (h5repack_addfilter(opt_arg, options) < 0) {
error_msg("in parsing filter\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -505,7 +505,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case 'l':
/* parse the -l layout option */
- if (h5repack_addlayout(H5_optarg, options) < 0) {
+ if (h5repack_addlayout(opt_arg, options) < 0) {
error_msg("in parsing layout\n");
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
@@ -514,9 +514,9 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'm':
- options->min_comp = HDstrtoull(H5_optarg, NULL, 0);
+ options->min_comp = HDstrtoull(opt_arg, NULL, 0);
if ((int)options->min_comp <= 0) {
- error_msg("invalid minimum compress size <%s>\n", H5_optarg);
+ error_msg("invalid minimum compress size <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -524,8 +524,8 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'e':
- if ((ret_value = read_info(H5_optarg, options)) < 0) {
- error_msg("failed to read from repack options file <%s>\n", H5_optarg);
+ if ((ret_value = read_info(opt_arg, options)) < 0) {
+ error_msg("failed to read from repack options file <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -541,7 +541,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'j':
- bound = HDatoi(H5_optarg);
+ bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing low bound\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -552,7 +552,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'k':
- bound = HDatoi(H5_optarg);
+ bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing high bound\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -571,13 +571,13 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'c':
- options->grp_compact = HDatoi(H5_optarg);
+ options->grp_compact = HDatoi(opt_arg);
if (options->grp_compact > 0)
options->latest = TRUE; /* must use latest format */
break;
case 'd':
- options->grp_indexed = HDatoi(H5_optarg);
+ options->grp_indexed = HDatoi(opt_arg);
if (options->grp_indexed > 0)
options->latest = TRUE; /* must use latest format */
break;
@@ -585,10 +585,10 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case 's': {
int idx = 0;
int ssize = 0;
- char *msgPtr = HDstrchr(H5_optarg, ':');
+ char *msgPtr = HDstrchr(opt_arg, ':');
options->latest = TRUE; /* must use latest format */
if (msgPtr == NULL) {
- ssize = HDatoi(H5_optarg);
+ ssize = HDatoi(opt_arg);
for (idx = 0; idx < 5; idx++)
options->msg_size[idx] = ssize;
}
@@ -597,7 +597,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
HDstrcpy(msgType, msgPtr + 1);
msgPtr[0] = '\0';
- ssize = HDatoi(H5_optarg);
+ ssize = HDatoi(opt_arg);
if (!HDstrncmp(msgType, "dspace", 6))
options->msg_size[0] = ssize;
else if (!HDstrncmp(msgType, "dtype", 5))
@@ -612,25 +612,25 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
} break;
case 'u':
- options->ublock_filename = H5_optarg;
+ options->ublock_filename = opt_arg;
break;
case 'b':
- options->ublock_size = (hsize_t)HDatol(H5_optarg);
+ options->ublock_size = (hsize_t)HDatol(opt_arg);
break;
case 'M':
- options->meta_block_size = (hsize_t)HDatol(H5_optarg);
+ options->meta_block_size = (hsize_t)HDatol(opt_arg);
break;
case 't':
- options->threshold = (hsize_t)HDatol(H5_optarg);
+ options->threshold = (hsize_t)HDatol(opt_arg);
break;
case 'a':
- options->alignment = HDstrtoull(H5_optarg, NULL, 0);
+ options->alignment = HDstrtoull(opt_arg, NULL, 0);
if (options->alignment < 1) {
- error_msg("invalid alignment size\n", H5_optarg);
+ error_msg("invalid alignment size\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -640,7 +640,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case 'S': {
char strategy[MAX_NC_NAME];
- HDstrcpy(strategy, H5_optarg);
+ HDstrcpy(strategy, opt_arg);
if (!HDstrcmp(strategy, "FSM_AGGR"))
options->fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
else if (!HDstrcmp(strategy, "PAGE"))
@@ -650,7 +650,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
else if (!HDstrcmp(strategy, "NONE"))
options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
else {
- error_msg("invalid file space management strategy\n", H5_optarg);
+ error_msg("invalid file space management strategy\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -661,29 +661,29 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
} break;
case 'P':
- options->fs_persist = HDatoi(H5_optarg);
+ options->fs_persist = HDatoi(opt_arg);
if (options->fs_persist == 0)
/* To distinguish the "specified" zero value */
options->fs_persist = -1;
break;
case 'T':
- options->fs_threshold = HDatol(H5_optarg);
+ options->fs_threshold = HDatol(opt_arg);
if (options->fs_threshold == 0)
/* To distinguish the "specified" zero value */
options->fs_threshold = -1;
break;
case 'G':
- options->fs_pagesize = HDstrtoll(H5_optarg, NULL, 0);
+ options->fs_pagesize = HDstrtoll(opt_arg, NULL, 0);
if (options->fs_pagesize == 0)
/* To distinguish the "specified" zero value */
options->fs_pagesize = -1;
break;
case 'q':
- if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(H5_optarg))) {
- error_msg("failed to set sort by form <%s>\n", H5_optarg);
+ if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) {
+ error_msg("failed to set sort by form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -691,8 +691,8 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
break;
case 'z':
- if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(H5_optarg))) {
- error_msg("failed to set sort order form <%s>\n", H5_optarg);
+ if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) {
+ error_msg("failed to set sort order form <%s>\n", opt_arg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -710,9 +710,9 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
/* If neither -i nor -o given, get in and out files positionally */
if (0 == (has_i + has_o)) {
- if (argv[H5_optind] != NULL && argv[H5_optind + 1] != NULL) {
- infile = argv[H5_optind];
- outfile = argv[H5_optind + 1];
+ if (argv[opt_ind] != NULL && argv[opt_ind + 1] != NULL) {
+ infile = argv[opt_ind];
+ outfile = argv[opt_ind + 1];
if (!HDstrcmp(infile, outfile)) {
error_msg("file names cannot be the same\n");