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 | |
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')
-rw-r--r-- | tools/src/h5copy/h5copy.c | 48 | ||||
-rw-r--r-- | tools/src/h5diff/h5diff_common.c | 84 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump.c | 172 | ||||
-rw-r--r-- | tools/src/h5dump/h5dump_ddl.c | 4 | ||||
-rw-r--r-- | tools/src/h5format_convert/h5format_convert.c | 22 | ||||
-rw-r--r-- | tools/src/h5jam/h5jam.c | 16 | ||||
-rw-r--r-- | tools/src/h5jam/h5unjam.c | 16 | ||||
-rw-r--r-- | tools/src/h5perf/pio_perf.c | 72 | ||||
-rw-r--r-- | tools/src/h5perf/sio_perf.c | 92 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 132 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 58 | ||||
-rw-r--r-- | tools/src/misc/h5clear.c | 16 | ||||
-rw-r--r-- | tools/src/misc/h5mkgrp.c | 26 |
13 files changed, 379 insertions, 379 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 6f10fee..933e230 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -19,23 +19,23 @@ #define PROGRAMNAME "h5copy" /* command-line options: short and long-named parameters */ -static const char * s_opts = "d:f:hi:o:ps:vVE"; -static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'}, - {"flag", require_arg, 'f'}, - {"help", no_arg, 'h'}, - {"input", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"parents", no_arg, 'p'}, - {"source", require_arg, 's'}, - {"verbose", no_arg, 'v'}, - {"version", no_arg, 'V'}, - {"enable-error-stack", no_arg, 'E'}, - {NULL, 0, '\0'}}; -char * fname_src = NULL; -char * fname_dst = NULL; -char * oname_src = NULL; -char * oname_dst = NULL; -char * str_flag = NULL; +static const char * s_opts = "d:f:hi:o:ps:vVE"; +static struct long_options l_opts[] = {{"destination", require_arg, 'd'}, + {"flag", require_arg, 'f'}, + {"help", no_arg, 'h'}, + {"input", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"parents", no_arg, 'p'}, + {"source", require_arg, 's'}, + {"verbose", no_arg, 'v'}, + {"version", no_arg, 'V'}, + {"enable-error-stack", no_arg, 'E'}, + {NULL, 0, '\0'}}; +char * fname_src = NULL; +char * fname_dst = NULL; +char * oname_src = NULL; +char * oname_dst = NULL; +char * str_flag = NULL; /*------------------------------------------------------------------------- * Function: leave @@ -242,19 +242,19 @@ main(int argc, char *argv[]) } /* end if */ /* parse command line options */ - while ((opt = H5_get_option(argc, (const char *const *)argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, (const char *const *)argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'd': - oname_dst = HDstrdup(H5_optarg); + oname_dst = HDstrdup(opt_arg); break; case 'f': /* validate flag */ - if (parse_flag(H5_optarg, &flag) < 0) { + if (parse_flag(opt_arg, &flag) < 0) { usage(); leave(EXIT_FAILURE); } - str_flag = HDstrdup(H5_optarg); + str_flag = HDstrdup(opt_arg); break; case 'h': @@ -263,11 +263,11 @@ main(int argc, char *argv[]) break; case 'i': - fname_src = HDstrdup(H5_optarg); + fname_src = HDstrdup(opt_arg); break; case 'o': - fname_dst = HDstrdup(H5_optarg); + fname_dst = HDstrdup(opt_arg); break; case 'p': @@ -275,7 +275,7 @@ main(int argc, char *argv[]) break; case 's': - oname_src = HDstrdup(H5_optarg); + oname_src = HDstrdup(opt_arg); break; case 'V': 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; diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index dfab35d..1134ecb 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -77,51 +77,51 @@ struct handler_t { */ /* The following initialization makes use of C language concatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:"; -static struct h5_long_options l_opts[] = {{"attribute", require_arg, 'a'}, - {"binary", optional_arg, 'b'}, - {"count", require_arg, 'c'}, - {"dataset", require_arg, 'd'}, - {"escape", no_arg, 'e'}, - {"filedriver", require_arg, 'f'}, - {"group", require_arg, 'g'}, - {"help", no_arg, 'h'}, - {"object-ids", no_arg, 'i'}, - {"block", require_arg, 'k'}, - {"soft-link", require_arg, 'l'}, - {"format", require_arg, 'm'}, - {"contents", optional_arg, 'n'}, - {"output", optional_arg, 'o'}, - {"properties", no_arg, 'p'}, - {"sort_by", require_arg, 'q'}, - {"string", no_arg, 'r'}, - {"start", require_arg, 's'}, - {"datatype", require_arg, 't'}, - {"use-dtd", no_arg, 'u'}, - {"vds-view-first-missing", no_arg, 'v'}, - {"width", require_arg, 'w'}, - {"xml", no_arg, 'x'}, - {"noindex", no_arg, 'y'}, - {"sort_order", require_arg, 'z'}, - {"onlyattr", optional_arg, 'A'}, - {"superblock", no_arg, 'B'}, - {"boot-block", no_arg, 'B'}, - {"no-compact-subset", no_arg, 'C'}, - {"xml-dtd", require_arg, 'D'}, - {"enable-error-stack", optional_arg, 'E'}, - {"form", require_arg, 'F'}, - {"vds-gap-size", require_arg, 'G'}, - {"header", no_arg, 'H'}, - {"packed-bits", require_arg, 'M'}, - {"any_path", require_arg, 'N'}, - {"ddl", optional_arg, 'O'}, - {"region", no_arg, 'R'}, - {"stride", require_arg, 'S'}, - {"version", no_arg, 'V'}, - {"xml-ns", require_arg, 'X'}, - {"s3-cred", require_arg, '$'}, - {"hdfs-attrs", require_arg, '#'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "a:b*c:d:ef:g:hik:l:m:n*o*pq:rs:t:uvw:xyz:A*BCD:E*F:G:HM:N:O*RS:VX:"; +static struct long_options l_opts[] = {{"attribute", require_arg, 'a'}, + {"binary", optional_arg, 'b'}, + {"count", require_arg, 'c'}, + {"dataset", require_arg, 'd'}, + {"escape", no_arg, 'e'}, + {"filedriver", require_arg, 'f'}, + {"group", require_arg, 'g'}, + {"help", no_arg, 'h'}, + {"object-ids", no_arg, 'i'}, + {"block", require_arg, 'k'}, + {"soft-link", require_arg, 'l'}, + {"format", require_arg, 'm'}, + {"contents", optional_arg, 'n'}, + {"output", optional_arg, 'o'}, + {"properties", no_arg, 'p'}, + {"sort_by", require_arg, 'q'}, + {"string", no_arg, 'r'}, + {"start", require_arg, 's'}, + {"datatype", require_arg, 't'}, + {"use-dtd", no_arg, 'u'}, + {"vds-view-first-missing", no_arg, 'v'}, + {"width", require_arg, 'w'}, + {"xml", no_arg, 'x'}, + {"noindex", no_arg, 'y'}, + {"sort_order", require_arg, 'z'}, + {"onlyattr", optional_arg, 'A'}, + {"superblock", no_arg, 'B'}, + {"boot-block", no_arg, 'B'}, + {"no-compact-subset", no_arg, 'C'}, + {"xml-dtd", require_arg, 'D'}, + {"enable-error-stack", optional_arg, 'E'}, + {"form", require_arg, 'F'}, + {"vds-gap-size", require_arg, 'G'}, + {"header", no_arg, 'H'}, + {"packed-bits", require_arg, 'M'}, + {"any_path", require_arg, 'N'}, + {"ddl", optional_arg, 'O'}, + {"region", no_arg, 'R'}, + {"stride", require_arg, 'S'}, + {"version", no_arg, 'V'}, + {"xml-ns", require_arg, 'X'}, + {"s3-cred", require_arg, '$'}, + {"hdfs-attrs", require_arg, '#'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: leave @@ -821,7 +821,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) { parse_start: switch ((char)opt) { case 'R': @@ -835,8 +835,8 @@ parse_start: case 'n': dump_opts.display_fi = TRUE; last_was_dset = FALSE; - if (H5_optarg != NULL) - h5trav_set_verbose(HDatoi(H5_optarg)); + if (opt_arg != NULL) + h5trav_set_verbose(HDatoi(opt_arg)); break; case 'p': dump_opts.display_dcpl = TRUE; @@ -853,8 +853,8 @@ parse_start: last_was_dset = FALSE; break; case 'A': - if (H5_optarg != NULL) { - if (0 == HDatoi(H5_optarg)) + if (opt_arg != NULL) { + if (0 == HDatoi(opt_arg)) dump_opts.include_attrs = FALSE; } else { @@ -878,7 +878,7 @@ parse_start: goto done; break; case 'w': { - int sh5tools_nCols = HDatoi(H5_optarg); + int sh5tools_nCols = HDatoi(opt_arg); if (sh5tools_nCols <= 0) h5tools_nCols = 65535; @@ -892,7 +892,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_paths; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); break; } @@ -904,7 +904,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_attributes; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); break; } @@ -916,7 +916,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_datasets; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); hand[i].subset_info = parse_subset_params(hand[i].obj); last_dset = &hand[i]; break; @@ -925,7 +925,7 @@ parse_start: last_was_dset = TRUE; break; case 'f': - driver_name_g = H5_optarg; + driver_name_g = opt_arg; break; case 'g': dump_opts.display_all = 0; @@ -933,7 +933,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_groups; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); break; } @@ -945,7 +945,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_links; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); break; } @@ -957,7 +957,7 @@ parse_start: for (i = 0; i < argc; i++) if (!hand[i].func) { hand[i].func = handle_datatypes; - hand[i].obj = HDstrdup(H5_optarg); + hand[i].obj = HDstrdup(opt_arg); break; } @@ -965,7 +965,7 @@ parse_start: break; case 'O': - if (h5tools_set_output_file(H5_optarg, 0) < 0) { + if (h5tools_set_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -973,20 +973,20 @@ parse_start: case 'o': if (bin_output) { - if (h5tools_set_data_output_file(H5_optarg, 1) < 0) { + if (h5tools_set_data_output_file(opt_arg, 1) < 0) { usage(h5tools_getprogname()); goto error; } } else { if (dump_opts.display_attr_data && !dump_opts.display_data) { - if (h5tools_set_attr_output_file(H5_optarg, 0) < 0) { + if (h5tools_set_attr_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } } if (dump_opts.display_data || dump_opts.display_all) { - if (h5tools_set_data_output_file(H5_optarg, 0) < 0) { + if (h5tools_set_data_output_file(opt_arg, 0) < 0) { usage(h5tools_getprogname()); goto error; } @@ -995,12 +995,12 @@ parse_start: dump_opts.usingdasho = TRUE; last_was_dset = FALSE; - outfname_g = H5_optarg; + outfname_g = opt_arg; break; case 'b': - if (H5_optarg != NULL) { - if ((bin_form = set_binary_form(H5_optarg)) < 0) { + if (opt_arg != NULL) { + if ((bin_form = set_binary_form(opt_arg)) < 0) { /* failed to set binary form */ usage(h5tools_getprogname()); goto error; @@ -1019,7 +1019,7 @@ parse_start: break; case 'q': - if ((sort_by = set_sort_by(H5_optarg)) < 0) { + if ((sort_by = set_sort_by(opt_arg)) < 0) { /* failed to set "sort by" form */ usage(h5tools_getprogname()); goto error; @@ -1027,7 +1027,7 @@ parse_start: break; case 'z': - if ((sort_order = set_sort_order(H5_optarg)) < 0) { + if ((sort_order = set_sort_order(opt_arg)) < 0) { /* failed to set "sort order" form */ usage(h5tools_getprogname()); goto error; @@ -1039,7 +1039,7 @@ parse_start: error_msg("option \"-%c\" can only be used after --dataset option\n", opt); goto error; } - if (parse_mask_list(H5_optarg) != SUCCEED) { + if (parse_mask_list(opt_arg) != SUCCEED) { usage(h5tools_getprogname()); goto error; } @@ -1049,7 +1049,7 @@ parse_start: dump_opts.display_vds_first = TRUE; break; case 'G': - dump_opts.vds_gap_size = HDatoi(H5_optarg); + dump_opts.vds_gap_size = HDatoi(opt_arg); if (dump_opts.vds_gap_size < 0) { usage(h5tools_getprogname()); goto error; @@ -1076,13 +1076,13 @@ parse_start: case 'D': /* specify alternative XML DTD or schema */ /* To Do: check format of this value? */ - xml_dtd_uri_g = H5_optarg; + xml_dtd_uri_g = opt_arg; h5tools_nCols = 0; break; case 'm': /* specify alternative floating point printing format */ - fp_format = H5_optarg; + fp_format = opt_arg; h5tools_nCols = 0; break; @@ -1093,10 +1093,10 @@ parse_start: usage(h5tools_getprogname()); goto error; } - if (HDstrcmp(H5_optarg, ":") == 0) + if (HDstrcmp(opt_arg, ":") == 0) xmlnsprefix = ""; else - xmlnsprefix = H5_optarg; + xmlnsprefix = opt_arg; h5tools_nCols = 0; break; /** end XML parameters **/ @@ -1142,33 +1142,33 @@ parse_start: HDfree(s->start.data); s->start.data = NULL; } - parse_hsize_list(H5_optarg, &s->start); + parse_hsize_list(opt_arg, &s->start); break; case 'S': if (s->stride.data) { HDfree(s->stride.data); s->stride.data = NULL; } - parse_hsize_list(H5_optarg, &s->stride); + parse_hsize_list(opt_arg, &s->stride); break; case 'c': if (s->count.data) { HDfree(s->count.data); s->count.data = NULL; } - parse_hsize_list(H5_optarg, &s->count); + parse_hsize_list(opt_arg, &s->count); break; case 'k': if (s->block.data) { HDfree(s->block.data); s->block.data = NULL; } - parse_hsize_list(H5_optarg, &s->block); + parse_hsize_list(opt_arg, &s->block); break; default: goto end_collect; } - } while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF); + } while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF); end_collect: last_was_dset = FALSE; @@ -1181,8 +1181,8 @@ end_collect: /** end subsetting parameters **/ case 'E': - if (H5_optarg != NULL) - enable_error_stack = HDatoi(H5_optarg); + if (opt_arg != NULL) + enable_error_stack = HDatoi(opt_arg); else enable_error_stack = 1; break; @@ -1198,7 +1198,7 @@ end_collect: case '$': #ifdef H5_HAVE_ROS3_VFD - if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa_g) < 0) { + if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa_g) < 0) { error_msg("failed to parse S3 VFD credential info\n"); usage(h5tools_getprogname()); free_handler(hand, argc); @@ -1215,7 +1215,7 @@ end_collect: case '#': #ifdef H5_HAVE_LIBHDFS - if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa_g) < 0) { + if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa_g) < 0) { error_msg("failed to parse HDFS VFD configuration info\n"); usage(h5tools_getprogname()); free_handler(hand, argc); @@ -1239,7 +1239,7 @@ end_collect: parse_end: /* check for file name to be processed */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; @@ -1331,7 +1331,7 @@ main(int argc, char *argv[]) } } - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -1376,8 +1376,8 @@ main(int argc, char *argv[]) } } /* driver name defined */ - while (H5_optind < argc) { - fname = HDstrdup(argv[H5_optind++]); + while (opt_ind < argc) { + fname = HDstrdup(argv[opt_ind++]); fid = h5tools_fopen(fname, H5F_ACC_RDONLY, fapl_id, (fapl_id == H5P_DEFAULT) ? FALSE : TRUE, NULL, 0); diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 8d5a4a8..3a9a939 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1264,7 +1264,7 @@ dump_fcontents(hid_t fid) { PRINTSTREAM(rawoutstream, "%s %s\n", FILE_CONTENTS, BEGIN); - /* special case of unamed types in root group */ + /* special case of unnamed types in root group */ if (unamedtype) { unsigned u; @@ -1933,7 +1933,7 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED *data, int pe, char name[128]; if (!type_table->objs[idx].recorded) { - /* unamed datatype */ + /* unnamed datatype */ HDsprintf(name, "/#" H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); if (!HDstrcmp(name, real_name)) diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index 479d6d4..508ea65 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -38,11 +38,11 @@ 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 h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'}, - {"verbose", no_arg, 'v'}, {"dname", require_arg, 'd'}, - {"noop", no_arg, 'n'}, {"enable-error-stack", no_arg, 'E'}, - {NULL, 0, '\0'}}; +static const char * s_opts = "hVvd:n"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"version", no_arg, 'V'}, + {"verbose", no_arg, 'v'}, {"dname", require_arg, 'd'}, + {"noop", no_arg, 'n'}, {"enable-error-stack", no_arg, 'E'}, + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -106,7 +106,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()); @@ -123,11 +123,11 @@ parse_command_line(int argc, const char *const *argv) break; case 'd': /* -d dname */ - if (H5_optarg != NULL && *H5_optarg) - dname_g = HDstrdup(H5_optarg); + if (opt_arg != NULL && *opt_arg) + dname_g = HDstrdup(opt_arg); if (dname_g == NULL) { h5tools_setstatus(EXIT_FAILURE); - error_msg("No dataset name\n", H5_optarg); + error_msg("No dataset name\n", opt_arg); usage(h5tools_getprogname()); goto error; } @@ -150,14 +150,14 @@ parse_command_line(int argc, const char *const *argv) } /* switch */ } /* while */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto error; } - fname_g = HDstrdup(argv[H5_optind]); + fname_g = HDstrdup(argv[opt_ind]); return 0; diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index c3dfa8e..35e61c5 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -34,10 +34,10 @@ char *ub_file = NULL; * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "hi:u:o:c:V"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, - {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, - {"clobber", no_arg, 'c'}, {NULL, 0, '\0'}}; +static const char * s_opts = "hi:u:o:c:V"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, + {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, + {"clobber", no_arg, 'c'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -109,16 +109,16 @@ parse_command_line(int argc, const char *const *argv) int opt = FALSE; /* 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 'o': - output_file = HDstrdup(H5_optarg); + output_file = HDstrdup(opt_arg); break; case 'i': - input_file = HDstrdup(H5_optarg); + input_file = HDstrdup(opt_arg); break; case 'u': - ub_file = HDstrdup(H5_optarg); + ub_file = HDstrdup(opt_arg); break; case 'c': do_clobber = TRUE; diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index 38f0a0c..001e48f 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -35,10 +35,10 @@ char *ub_file = NULL; * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "hu:i:o:d:V"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, - {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, - {"delete", no_arg, 'd'}, {NULL, 0, '\0'}}; +static const char * s_opts = "hu:i:o:d:V"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"i", require_arg, 'i'}, + {"u", require_arg, 'u'}, {"o", require_arg, 'o'}, + {"delete", no_arg, 'd'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -97,23 +97,23 @@ parse_command_line(int argc, const char *const *argv) int opt = FALSE; /* 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 'o': - output_file = HDstrdup(H5_optarg); + output_file = HDstrdup(opt_arg); if (output_file) h5tools_set_data_output_file(output_file, 1); break; case 'i': - input_file = HDstrdup(H5_optarg); + input_file = HDstrdup(opt_arg); if (input_file) h5tools_set_input_file(input_file, 1); break; ; case 'u': - ub_file = HDstrdup(H5_optarg); + ub_file = HDstrdup(opt_arg); if (ub_file) h5tools_set_output_file(ub_file, 1); else diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 560512c..01165bb 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -129,31 +129,31 @@ static const char *s_opts = "a:A:B:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #else static const char *s_opts = "a:A:bB:cCd:D:e:F:ghi:Imno:p:P:stT:wx:X:"; #endif /* 1 */ -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"api", require_arg, 'A'}, +static struct long_options l_opts[] = {{"align", require_arg, 'a'}, + {"api", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"geometry", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"output", require_arg, 'o'}, - {"threshold", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"geometry", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"output", require_arg, 'o'}, + {"threshold", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -1305,13 +1305,13 @@ parse_command_line(int argc, const char *const *argv) cl_opts->h5_write_only = FALSE; /* Do both read and write by default */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - 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 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); + cl_opts->h5_alignment = parse_size_directive(opt_arg); break; case 'A': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1351,7 +1351,7 @@ parse_command_line(int argc, const char *const *argv) break; #endif /* 0 */ case 'B': - cl_opts->blk_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->blk_size = (size_t)parse_size_directive(opt_arg); break; case 'c': /* Turn on chunked HDF5 dataset creation */ @@ -1361,10 +1361,10 @@ parse_command_line(int argc, const char *const *argv) cl_opts->collective = 1; break; case 'd': - cl_opts->num_dsets = atoi(H5_optarg); + cl_opts->num_dsets = atoi(opt_arg); break; case 'D': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -1421,40 +1421,40 @@ parse_command_line(int argc, const char *const *argv) break; case 'e': - cl_opts->num_bpp = parse_size_directive(H5_optarg); + cl_opts->num_bpp = parse_size_directive(opt_arg); break; case 'F': - cl_opts->num_files = HDatoi(H5_optarg); + cl_opts->num_files = HDatoi(opt_arg); break; case 'g': cl_opts->dim2d = 1; break; case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'I': cl_opts->interleaved = 1; break; case 'o': - cl_opts->output_file = H5_optarg; + cl_opts->output_file = opt_arg; break; case 'p': - cl_opts->min_num_procs = HDatoi(H5_optarg); + cl_opts->min_num_procs = HDatoi(opt_arg); break; case 'P': - cl_opts->max_num_procs = HDatoi(H5_optarg); + cl_opts->max_num_procs = HDatoi(opt_arg); break; case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); + cl_opts->h5_threshold = parse_size_directive(opt_arg); break; case 'w': cl_opts->h5_write_only = TRUE; break; case 'x': - cl_opts->min_xfer_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->min_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'X': - cl_opts->max_xfer_size = (size_t)parse_size_directive(H5_optarg); + cl_opts->max_xfer_size = (size_t)parse_size_directive(opt_arg); break; case 'h': case '?': diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 625f313..c979e7a 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -97,35 +97,35 @@ static const char *progname = "h5perf_serial"; * It seems that only the options that accept additional information * such as dataset size (-e) require the colon next to it. */ -static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; -static struct h5_long_options l_opts[] = {{"align", require_arg, 'a'}, - {"api", require_arg, 'A'}, +static const char * s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; +static struct long_options l_opts[] = {{"align", require_arg, 'a'}, + {"api", require_arg, 'A'}, #if 0 /* a sighting of the elusive binary option */ { "binary", no_arg, 'b' }, #endif /* 0 */ - {"block-size", require_arg, 'B'}, - {"chunk", no_arg, 'c'}, - {"collective", no_arg, 'C'}, - {"debug", require_arg, 'D'}, - {"file-driver", require_arg, 'v'}, - {"geometry", no_arg, 'g'}, - {"help", no_arg, 'h'}, - {"interleaved", require_arg, 'I'}, - {"max-num-processes", require_arg, 'P'}, - {"min-num-processes", require_arg, 'p'}, - {"max-xfer-size", require_arg, 'X'}, - {"min-xfer-size", require_arg, 'x'}, - {"num-bytes", require_arg, 'e'}, - {"num-dsets", require_arg, 'd'}, - {"num-files", require_arg, 'F'}, - {"num-iterations", require_arg, 'i'}, - {"order", require_arg, 'r'}, - {"output", require_arg, 'o'}, - {"extendable", no_arg, 't'}, - {"threshold", require_arg, 'T'}, - {"write-only", require_arg, 'w'}, - {NULL, 0, '\0'}}; + {"block-size", require_arg, 'B'}, + {"chunk", no_arg, 'c'}, + {"collective", no_arg, 'C'}, + {"debug", require_arg, 'D'}, + {"file-driver", require_arg, 'v'}, + {"geometry", no_arg, 'g'}, + {"help", no_arg, 'h'}, + {"interleaved", require_arg, 'I'}, + {"max-num-processes", require_arg, 'P'}, + {"min-num-processes", require_arg, 'p'}, + {"max-xfer-size", require_arg, 'X'}, + {"min-xfer-size", require_arg, 'x'}, + {"num-bytes", require_arg, 'e'}, + {"num-dsets", require_arg, 'd'}, + {"num-files", require_arg, 'F'}, + {"num-iterations", require_arg, 'i'}, + {"order", require_arg, 'r'}, + {"output", require_arg, 'o'}, + {"extendable", no_arg, 't'}, + {"threshold", require_arg, 'T'}, + {"write-only", require_arg, 'w'}, + {NULL, 0, '\0'}}; struct options { long io_types; /* bitmask of which I/O types to test */ @@ -857,19 +857,19 @@ parse_command_line(int argc, const char *const *argv) cl_opts->h5_extendable = FALSE; /* Use extendable dataset */ cl_opts->verify = FALSE; /* No Verify data correctness by default */ - 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 'a': - cl_opts->h5_alignment = parse_size_directive(H5_optarg); + cl_opts->h5_alignment = parse_size_directive(opt_arg); break; case 'G': - cl_opts->page_size = parse_size_directive(H5_optarg); + cl_opts->page_size = parse_size_directive(opt_arg); break; case 'b': - cl_opts->page_buffer_size = parse_size_directive(H5_optarg); + cl_opts->page_buffer_size = parse_size_directive(opt_arg); break; case 'A': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -907,7 +907,7 @@ parse_command_line(int argc, const char *const *argv) /* Turn on chunked HDF5 dataset creation */ cl_opts->h5_use_chunks = 1; { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -934,7 +934,7 @@ parse_command_line(int argc, const char *const *argv) break; case 'D': { - const char *end = H5_optarg; + const char *end = opt_arg; while (end && *end != '\0') { char buf[10]; @@ -990,7 +990,7 @@ parse_command_line(int argc, const char *const *argv) break; case 'e': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -1017,38 +1017,38 @@ parse_command_line(int argc, const char *const *argv) break; case 'i': - cl_opts->num_iters = HDatoi(H5_optarg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'o': - cl_opts->output_file = H5_optarg; + cl_opts->output_file = opt_arg; break; case 'T': - cl_opts->h5_threshold = parse_size_directive(H5_optarg); + cl_opts->h5_threshold = parse_size_directive(opt_arg); break; case 'v': - if (!HDstrcasecmp(H5_optarg, "sec2")) { + if (!HDstrcasecmp(opt_arg, "sec2")) { cl_opts->vfd = sec2; } - else if (!HDstrcasecmp(H5_optarg, "stdio")) { + else if (!HDstrcasecmp(opt_arg, "stdio")) { cl_opts->vfd = stdio; } - else if (!HDstrcasecmp(H5_optarg, "core")) { + else if (!HDstrcasecmp(opt_arg, "core")) { cl_opts->vfd = core; } - else if (!HDstrcasecmp(H5_optarg, "split")) { + else if (!HDstrcasecmp(opt_arg, "split")) { cl_opts->vfd = split; } - else if (!HDstrcasecmp(H5_optarg, "multi")) { + else if (!HDstrcasecmp(opt_arg, "multi")) { cl_opts->vfd = multi; } - else if (!HDstrcasecmp(H5_optarg, "family")) { + else if (!HDstrcasecmp(opt_arg, "family")) { cl_opts->vfd = family; } - else if (!HDstrcasecmp(H5_optarg, "direct")) { + else if (!HDstrcasecmp(opt_arg, "direct")) { cl_opts->vfd = direct; } else { - HDfprintf(stderr, "sio_perf: invalid --api option %s\n", H5_optarg); + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", opt_arg); HDexit(EXIT_FAILURE); } break; @@ -1059,7 +1059,7 @@ parse_command_line(int argc, const char *const *argv) cl_opts->h5_extendable = TRUE; break; case 'x': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { @@ -1086,7 +1086,7 @@ parse_command_line(int argc, const char *const *argv) break; case 'r': { - const char *end = H5_optarg; + const char *end = opt_arg; int j = 0; while (end && *end != '\0') { 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"); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index bb0f0a0..d36c348 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -171,23 +171,23 @@ struct handler_t { static const char *s_opts = "Aa:Ddm:EFfhGgl:sSTO:Vw:H:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, - {"filemetadata", no_arg, 'F'}, - {"groupmetadata", no_arg, 'G'}, - {"links", require_arg, 'l'}, - {"dsetmetadata", no_arg, 'D'}, - {"dims", require_arg, 'm'}, - {"dtypemetadata", no_arg, 'T'}, - {"object", require_arg, 'O'}, - {"version", no_arg, 'V'}, - {"attribute", no_arg, 'A'}, - {"enable-error-stack", no_arg, 'E'}, - {"numattrs", require_arg, 'a'}, - {"freespace", no_arg, 's'}, - {"summary", no_arg, 'S'}, - {"s3-cred", require_arg, 'w'}, - {"hdfs-attrs", require_arg, 'H'}, - {NULL, 0, '\0'}}; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, + {"filemetadata", no_arg, 'F'}, + {"groupmetadata", no_arg, 'G'}, + {"links", require_arg, 'l'}, + {"dsetmetadata", no_arg, 'D'}, + {"dims", require_arg, 'm'}, + {"dtypemetadata", no_arg, 'T'}, + {"object", require_arg, 'O'}, + {"version", no_arg, 'V'}, + {"attribute", no_arg, 'A'}, + {"enable-error-stack", no_arg, 'E'}, + {"numattrs", require_arg, 'a'}, + {"freespace", no_arg, 's'}, + {"summary", no_arg, 'S'}, + {"s3-cred", require_arg, 'w'}, + {"hdfs-attrs", require_arg, 'H'}, + {NULL, 0, '\0'}}; static void leave(int ret) @@ -831,7 +831,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re struct handler_t *hand = 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) { case 'h': usage(h5tools_getprogname()); @@ -870,8 +870,8 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re break; case 'l': - if (H5_optarg) { - sgroups_threshold = HDatoi(H5_optarg); + if (opt_arg) { + sgroups_threshold = HDatoi(opt_arg); if (sgroups_threshold < 1) { error_msg("Invalid threshold for small groups\n"); goto error; @@ -893,8 +893,8 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re break; case 'm': - if (H5_optarg) { - sdsets_threshold = HDatoi(H5_optarg); + if (opt_arg) { + sdsets_threshold = HDatoi(opt_arg); if (sdsets_threshold < 1) { error_msg("Invalid threshold for small datasets\n"); goto error; @@ -916,8 +916,8 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re break; case 'a': - if (H5_optarg) { - sattrs_threshold = HDatoi(H5_optarg); + if (opt_arg) { + sattrs_threshold = HDatoi(opt_arg); if (sattrs_threshold < 1) { error_msg("Invalid threshold for small # of attributes\n"); goto error; @@ -957,7 +957,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re /* Store object names */ for (u = 0; u < hand->obj_count; u++) - if (NULL == (hand->obj[u] = HDstrdup(H5_optarg))) { + if (NULL == (hand->obj[u] = HDstrdup(opt_arg))) { error_msg("unable to allocate memory for object name\n"); goto error; } /* end if */ @@ -965,7 +965,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re case 'w': #ifdef H5_HAVE_ROS3_VFD - if (h5tools_parse_ros3_fapl_tuple(H5_optarg, ',', &ros3_fa) < 0) { + if (h5tools_parse_ros3_fapl_tuple(opt_arg, ',', &ros3_fa) < 0) { error_msg("failed to parse S3 VFD credential info\n"); goto error; } @@ -979,7 +979,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re case 'H': #ifdef H5_HAVE_LIBHDFS - if (h5tools_parse_hdfs_fapl_tuple(H5_optarg, ',', &hdfs_fa) < 0) { + if (h5tools_parse_hdfs_fapl_tuple(opt_arg, ',', &hdfs_fa) < 0) { error_msg("failed to parse HDFS VFD configuration info\n"); goto error; } @@ -998,7 +998,7 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re } /* 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()); goto error; @@ -1722,7 +1722,7 @@ main(int argc, char *argv[]) } } - fname = argv[H5_optind]; + fname = argv[opt_ind]; /* Check for filename given */ if (fname) { 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; |