summaryrefslogtreecommitdiffstats
path: root/tools/src/h5diff/h5diff_common.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/h5diff/h5diff_common.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/h5diff/h5diff_common.c')
-rw-r--r--tools/src/h5diff/h5diff_common.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index c7060e9..9e1b6ed 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -25,24 +25,24 @@ static int check_d_input(const char *);
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S";
-static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'},
- {"version", no_arg, 'V'},
- {"report", no_arg, 'r'},
- {"verbose", optional_arg, 'v'},
- {"quiet", no_arg, 'q'},
- {"count", require_arg, 'n'},
- {"delta", require_arg, 'd'},
- {"relative", require_arg, 'p'},
- {"nan", no_arg, 'N'},
- {"compare", no_arg, 'c'},
- {"use-system-epsilon", no_arg, 'e'},
- {"follow-symlinks", no_arg, 'l'},
- {"no-dangling-links", no_arg, 'x'},
- {"exclude-path", require_arg, 'E'},
- {"exclude-attribute", require_arg, 'A'},
- {"enable-error-stack", no_arg, 'S'},
- {NULL, 0, '\0'}};
+static const char * s_opts = "hVrv*qn:d:p:NcelxE:A:S";
+static struct long_options l_opts[] = {{"help", no_arg, 'h'},
+ {"version", no_arg, 'V'},
+ {"report", no_arg, 'r'},
+ {"verbose", optional_arg, 'v'},
+ {"quiet", no_arg, 'q'},
+ {"count", require_arg, 'n'},
+ {"delta", require_arg, 'd'},
+ {"relative", require_arg, 'p'},
+ {"nan", no_arg, 'N'},
+ {"compare", no_arg, 'c'},
+ {"use-system-epsilon", no_arg, 'e'},
+ {"follow-symlinks", no_arg, 'l'},
+ {"no-dangling-links", no_arg, 'x'},
+ {"exclude-path", require_arg, 'E'},
+ {"exclude-attribute", require_arg, 'A'},
+ {"enable-error-stack", no_arg, 'S'},
+ {NULL, 0, '\0'}};
/*-------------------------------------------------------------------------
* Function: check_options
@@ -226,7 +226,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
exclude_attr_head = NULL;
/* 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) {
default:
usage();
@@ -250,20 +250,20 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
* special check for short opt
*/
if (!strcmp(argv[i], "-v")) {
- if (H5_optarg != NULL)
- H5_optind--;
+ if (opt_arg != NULL)
+ opt_ind--;
opts->mode_verbose_level = 0;
break;
}
else if (!strncmp(argv[i], "-v", (size_t)2)) {
- if (H5_optarg != NULL)
- H5_optind--;
+ if (opt_arg != NULL)
+ opt_ind--;
opts->mode_verbose_level = atoi(&argv[i][2]);
break;
}
else {
- if (H5_optarg != NULL)
- opts->mode_verbose_level = HDatoi(H5_optarg);
+ if (opt_arg != NULL)
+ opts->mode_verbose_level = HDatoi(opt_arg);
else
opts->mode_verbose_level = 0;
}
@@ -302,7 +302,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
}
/* init */
- exclude_node->obj_path = H5_optarg;
+ exclude_node->obj_path = opt_arg;
exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_prev = exclude_head;
@@ -330,7 +330,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
}
/* init */
- exclude_attr_node->obj_path = H5_optarg;
+ exclude_attr_node->obj_path = opt_arg;
exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_attr_prev = exclude_attr_head;
@@ -350,23 +350,23 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
case 'd':
opts->delta_bool = 1;
- if (check_d_input(H5_optarg) == -1) {
- HDprintf("<-d %s> is not a valid option\n", H5_optarg);
+ if (check_d_input(opt_arg) == -1) {
+ HDprintf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->delta = HDatof(H5_optarg);
+ opts->delta = HDatof(opt_arg);
/* do not check against default, the DBL_EPSILON is being replaced by user */
break;
case 'p':
opts->percent_bool = 1;
- if (check_p_input(H5_optarg) == -1) {
- HDprintf("<-p %s> is not a valid option\n", H5_optarg);
+ if (check_p_input(opt_arg) == -1) {
+ HDprintf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->percent = HDatof(H5_optarg);
+ opts->percent = HDatof(opt_arg);
/* -p 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->percent, 0.0))
@@ -375,12 +375,12 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
case 'n':
opts->count_bool = 1;
- if (check_n_input(H5_optarg) == -1) {
- HDprintf("<-n %s> is not a valid option\n", H5_optarg);
+ if (check_n_input(opt_arg) == -1) {
+ HDprintf("<-n %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->count = HDstrtoull(H5_optarg, NULL, 0);
+ opts->count = HDstrtoull(opt_arg, NULL, 0);
break;
case 'N':
@@ -409,15 +409,15 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
opts->exclude_attr = exclude_attr_head;
/* check for file names to be processed */
- if (argc <= H5_optind || argv[H5_optind + 1] == NULL) {
+ if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
error_msg("missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
- *fname1 = argv[H5_optind];
- *fname2 = argv[H5_optind + 1];
- *objname1 = argv[H5_optind + 2];
+ *fname1 = argv[opt_ind];
+ *fname2 = argv[opt_ind + 1];
+ *objname1 = argv[opt_ind + 2];
H5TOOLS_DEBUG("file1 = %s", *fname1);
H5TOOLS_DEBUG("file2 = %s", *fname2);
@@ -428,8 +428,8 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
}
H5TOOLS_DEBUG("objname1 = %s", *objname1);
- if (argv[H5_optind + 3] != NULL) {
- *objname2 = argv[H5_optind + 3];
+ if (argv[opt_ind + 3] != NULL) {
+ *objname2 = argv[opt_ind + 3];
}
else {
*objname2 = *objname1;