summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-02-04 14:20:25 (GMT)
committerGitHub <noreply@github.com>2021-02-04 14:20:25 (GMT)
commit8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d (patch)
treeb4882b25a68ac0d80a32252dfad5b905e9bcc5fd /tools
parent674e1f02a3ac37cf3d57df1aee902b7af44f398e (diff)
downloadhdf5-8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d.zip
hdf5-8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d.tar.gz
hdf5-8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d.tar.bz2
1 10 merges from develop (#298)
* HDFFV-10865 - merge from dev, HDFArray perf fix. * Remove duplicate setting * Whitespace changes after clang format * Undo version 11 clang format changes * Merge CMake changes from develop * test testing script merge from develop * Update supported platforms
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools_utils.c48
-rw-r--r--tools/src/h5diff/h5diff_common.c30
-rw-r--r--tools/src/h5dump/h5dump.c132
-rw-r--r--tools/src/h5repack/h5repack.c2
-rw-r--r--tools/src/h5repack/h5repack_main.c1
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt1
6 files changed, 108 insertions, 106 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 8f8d372..c8442e2 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -194,44 +194,50 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
if (sp == 1 && argv[opt_ind][0] == '-' && argv[opt_ind][1] == '-') {
/* long command line option */
- const char *arg = &argv[opt_ind][2];
- int i;
+ int i;
+ const char ch = '=';
+ char * arg = &argv[opt_ind][2];
+ size_t arg_len = 0;
+
+ opt_arg = strchr(&argv[opt_ind][2], ch);
+ arg_len = HDstrlen(&argv[opt_ind][2]);
+ if (opt_arg) {
+ arg_len -= HDstrlen(opt_arg);
+ opt_arg++; /* skip the equal sign */
+ }
+ arg[arg_len] = 0;
for (i = 0; l_opts && l_opts[i].name; i++) {
size_t len = HDstrlen(l_opts[i].name);
- if (HDstrncmp(arg, l_opts[i].name, len) == 0) {
+ if (HDstrcmp(arg, l_opts[i].name) == 0) {
/* we've found a matching long command line flag */
opt_opt = l_opts[i].shortval;
if (l_opts[i].has_arg != no_arg) {
- if (arg[len] == '=') {
- opt_arg = &arg[len + 1];
- }
- else if (l_opts[i].has_arg != optional_arg) {
- if (opt_ind < (argc - 1))
- if (argv[opt_ind + 1][0] != '-')
- opt_arg = argv[++opt_ind];
- }
- else if (l_opts[i].has_arg == require_arg) {
- if (opt_err)
- HDfprintf(rawerrorstream, "%s: option required for \"--%s\" flag\n", argv[0],
- arg);
-
- opt_opt = '?';
+ if (opt_arg == NULL) {
+ if (l_opts[i].has_arg != optional_arg) {
+ if (opt_ind < (argc - 1))
+ if (argv[opt_ind + 1][0] != '-')
+ opt_arg = argv[++opt_ind];
+ }
+ else if (l_opts[i].has_arg == require_arg) {
+ if (opt_err)
+ HDfprintf(rawerrorstream, "%s: option required for \"--%s\" flag\n", argv[0],
+ arg);
+
+ opt_opt = '?';
+ }
}
- else
- opt_arg = NULL;
}
else {
- if (arg[len] == '=') {
+ if (opt_arg) {
if (opt_err)
HDfprintf(rawerrorstream, "%s: no option required for \"%s\" flag\n", argv[0],
arg);
opt_opt = '?';
}
- opt_arg = NULL;
}
break;
}
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 49ba14c..008c035 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -25,7 +25,7 @@ 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 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'},
@@ -247,33 +247,27 @@ parse_command_line(int argc, const char *argv[], const char **fname1, const char
case 'v':
opts->mode_verbose = 1;
- /* This for loop is for handling style like
- * -v, -v1, --verbose, --verbose=1.
- */
for (i = 1; i < argc; i++) {
/*
- * short opt
+ * special check for short opt
*/
- if (!strcmp(argv[i], "-v")) { /* no arg */
- opt_ind--;
+ if (!strcmp(argv[i], "-v")) {
+ if (opt_arg != NULL)
+ opt_ind--;
opts->mode_verbose_level = 0;
break;
}
else if (!strncmp(argv[i], "-v", (size_t)2)) {
+ if (opt_arg != NULL)
+ opt_ind--;
opts->mode_verbose_level = atoi(&argv[i][2]);
break;
}
-
- /*
- * long opt
- */
- if (!strcmp(argv[i], "--verbose")) { /* no arg */
- opts->mode_verbose_level = 0;
- break;
- }
- else if (!strncmp(argv[i], "--verbose", (size_t)9) && argv[i][9] == '=') {
- opts->mode_verbose_level = atoi(&argv[i][10]);
- break;
+ else {
+ if (opt_arg != NULL)
+ opts->mode_verbose_level = HDatoi(opt_arg);
+ else
+ opts->mode_verbose_level = 0;
}
}
break;
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 9328490..f8d929e 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -77,39 +77,8 @@ struct handler_t {
*/
/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char * s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:vG:";
-static struct long_options l_opts[] = {{"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {"contents", optional_arg, 'n'},
- {"properties", no_arg, 'p'},
- {"superblock", no_arg, 'B'},
- {"boot-block", no_arg, 'B'},
- {"boot-bloc", no_arg, 'B'},
- {"boot-blo", no_arg, 'B'},
- {"boot-bl", no_arg, 'B'},
- {"boot-b", no_arg, 'B'},
- {"boot", no_arg, 'B'},
- {"boo", no_arg, 'B'},
- {"bo", no_arg, 'B'},
- {"header", no_arg, 'H'},
- {"heade", no_arg, 'H'},
- {"head", no_arg, 'H'},
- {"hea", no_arg, 'H'},
- {"object-ids", no_arg, 'i'},
- {"object-id", no_arg, 'i'},
- {"object-i", no_arg, 'i'},
- {"object", no_arg, 'i'},
- {"objec", no_arg, 'i'},
- {"obje", no_arg, 'i'},
- {"obj", no_arg, 'i'},
- {"ob", no_arg, 'i'},
- {"version", no_arg, 'V'},
- {"versio", no_arg, 'V'},
- {"versi", no_arg, 'V'},
- {"vers", no_arg, 'V'},
- {"ver", no_arg, 'V'},
- {"ve", no_arg, 'V'},
- {"attribute", require_arg, 'a'},
+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'},
{"attribut", require_arg, 'a'},
{"attribu", require_arg, 'a'},
{"attrib", require_arg, 'a'},
@@ -117,10 +86,7 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'},
{"attr", require_arg, 'a'},
{"att", require_arg, 'a'},
{"at", require_arg, 'a'},
- {"block", require_arg, 'k'},
- {"bloc", require_arg, 'k'},
- {"blo", require_arg, 'k'},
- {"bl", require_arg, 'k'},
+ {"binary", optional_arg, 'b'},
{"count", require_arg, 'c'},
{"coun", require_arg, 'c'},
{"cou", require_arg, 'c'},
@@ -128,10 +94,7 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'},
{"dataset", require_arg, 'd'},
{"datase", require_arg, 'd'},
{"datas", require_arg, 'd'},
- {"datatype", require_arg, 't'},
- {"datatyp", require_arg, 't'},
- {"dataty", require_arg, 't'},
- {"datat", require_arg, 't'},
+ {"escape", no_arg, 'e'},
{"filedriver", require_arg, 'f'},
{"filedrive", require_arg, 'f'},
{"filedriv", require_arg, 'f'},
@@ -145,24 +108,44 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'},
{"grou", require_arg, 'g'},
{"gro", require_arg, 'g'},
{"gr", require_arg, 'g'},
- {"output", optional_arg, 'o'},
- {"outpu", optional_arg, 'o'},
- {"outp", optional_arg, 'o'},
- {"out", optional_arg, 'o'},
- {"ou", optional_arg, 'o'},
+ {"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {"object-ids", no_arg, 'i'},
+ {"object-id", no_arg, 'i'},
+ {"object-i", no_arg, 'i'},
+ {"object", no_arg, 'i'},
+ {"objec", no_arg, 'i'},
+ {"obje", no_arg, 'i'},
+ {"obj", no_arg, 'i'},
+ {"ob", no_arg, 'i'},
+ {"block", require_arg, 'k'},
+ {"bloc", require_arg, 'k'},
+ {"blo", require_arg, 'k'},
+ {"bl", require_arg, 'k'},
{"soft-link", require_arg, 'l'},
{"soft-lin", require_arg, 'l'},
{"soft-li", require_arg, 'l'},
{"soft-l", require_arg, 'l'},
{"soft", require_arg, 'l'},
{"sof", require_arg, 'l'},
+ {"format", require_arg, 'm'},
+ {"contents", optional_arg, 'n'},
+ {"output", optional_arg, 'o'},
+ {"outpu", optional_arg, 'o'},
+ {"outp", optional_arg, 'o'},
+ {"out", optional_arg, 'o'},
+ {"ou", optional_arg, 'o'},
+ {"properties", no_arg, 'p'},
+ {"sort_by", require_arg, 'q'},
+ {"string", no_arg, 'r'},
+ {"strin", no_arg, 'r'},
{"start", require_arg, 's'},
{"star", require_arg, 's'},
{"sta", require_arg, 's'},
- {"stride", require_arg, 'S'},
- {"strid", require_arg, 'S'},
- {"string", no_arg, 'r'},
- {"strin", no_arg, 'r'},
+ {"datatype", require_arg, 't'},
+ {"datatyp", require_arg, 't'},
+ {"dataty", require_arg, 't'},
+ {"datat", require_arg, 't'},
{"use-dtd", no_arg, 'u'},
{"use-dt", no_arg, 'u'},
{"use-d", no_arg, 'u'},
@@ -170,33 +153,50 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'},
{"use", no_arg, 'u'},
{"us", no_arg, 'u'},
{"u", no_arg, 'u'},
+ {"vds-view-first-missing", no_arg, 'v'},
{"width", require_arg, 'w'},
{"widt", require_arg, 'w'},
{"wid", require_arg, 'w'},
{"wi", require_arg, 'w'},
- {"xml-dtd", require_arg, 'D'},
- {"xml-dt", require_arg, 'D'},
- {"xml-d", require_arg, 'D'},
- {"xml-ns", require_arg, 'X'},
- {"xml-n", require_arg, 'X'},
{"xml", no_arg, 'x'},
{"xm", no_arg, 'x'},
- {"onlyattr", optional_arg, 'A'},
- {"escape", no_arg, 'e'},
{"noindex", no_arg, 'y'},
- {"binary", optional_arg, 'b'},
- {"form", require_arg, 'F'},
- {"sort_by", require_arg, 'q'},
{"sort_order", require_arg, 'z'},
- {"format", require_arg, 'm'},
- {"region", no_arg, 'R'},
+ {"onlyattr", optional_arg, 'A'},
+ {"superblock", no_arg, 'B'},
+ {"boot-block", no_arg, 'B'},
+ {"boot-bloc", no_arg, 'B'},
+ {"boot-blo", no_arg, 'B'},
+ {"boot-bl", no_arg, 'B'},
+ {"boot-b", no_arg, 'B'},
+ {"boot", no_arg, 'B'},
+ {"boo", no_arg, 'B'},
+ {"bo", no_arg, 'B'},
+ {"no-compact-subset", no_arg, 'C'},
+ {"xml-dtd", require_arg, 'D'},
+ {"xml-dt", require_arg, 'D'},
+ {"xml-d", require_arg, 'D'},
{"enable-error-stack", optional_arg, 'E'},
+ {"form", require_arg, 'F'},
+ {"vds-gap-size", require_arg, 'G'},
+ {"header", no_arg, 'H'},
+ {"heade", no_arg, 'H'},
+ {"head", no_arg, 'H'},
+ {"hea", no_arg, 'H'},
{"packed-bits", require_arg, 'M'},
- {"no-compact-subset", no_arg, 'C'},
- {"ddl", optional_arg, 'O'},
{"any_path", require_arg, 'N'},
- {"vds-view-first-missing", no_arg, 'v'},
- {"vds-gap-size", require_arg, 'G'},
+ {"ddl", optional_arg, 'O'},
+ {"region", no_arg, 'R'},
+ {"stride", require_arg, 'S'},
+ {"strid", require_arg, 'S'},
+ {"version", no_arg, 'V'},
+ {"versio", no_arg, 'V'},
+ {"versi", no_arg, 'V'},
+ {"vers", no_arg, 'V'},
+ {"ver", no_arg, 'V'},
+ {"ve", no_arg, 'V'},
+ {"xml-ns", require_arg, 'X'},
+ {"xml-n", require_arg, 'X'},
{"s3-cred", require_arg, '$'},
{"hdfs-attrs", require_arg, '#'},
{NULL, 0, '\0'}};
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 82b5601..422b265 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -708,7 +708,7 @@ check_options(pack_opt_t *options)
}
if (options->ublock_filename == NULL && options->ublock_size != 0)
- H5TOOLS_GOTO_ERROR((-1), "file name missing for user block", options->ublock_filename);
+ H5TOOLS_GOTO_ERROR((-1), "file name missing for user block");
/*------------------------------------------------------------------------
* Verify alignment options; threshold is zero default but alignment not
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 3a82963..1c0a3e1 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -236,6 +236,7 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream,
" Required values: filter_number, filter_flag, cd_value_count, value1\n");
PRINTVALSTREAM(rawoutstream, " Optional values: value2 to valueN\n");
+ PRINTVALSTREAM(rawoutstream, " filter_flag: 1 is OPTIONAL or 0 is MANDATORY\n");
PRINTVALSTREAM(rawoutstream, " NONE (no parameter)\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " LAYT - is a string with the format:\n");
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index a184ae8..ddd8c42 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -122,6 +122,7 @@ usage: h5repack [OPTIONS] file1 file2
UD=<filter_number,filter_flag,cd_value_count,value1[,value2,...,valueN]>
Required values: filter_number, filter_flag, cd_value_count, value1
Optional values: value2 to valueN
+ filter_flag: 1 is OPTIONAL or 0 is MANDATORY
NONE (no parameter)
LAYT - is a string with the format: