Skip to content

Commit

Permalink
1.8 Move error-stack text to top of usage display #1564 (#1569)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnHDF authored Apr 14, 2022
1 parent 9fdf954 commit 5e1eee2
Show file tree
Hide file tree
Showing 28 changed files with 134 additions and 80 deletions.
17 changes: 11 additions & 6 deletions tools/h5copy/h5copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define PROGRAMNAME "h5copy"

/* command-line options: short and long-named parameters */
static const char * s_opts = "d:f:hi:o:ps:vVE";
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'},
Expand All @@ -29,7 +29,7 @@ static struct long_options l_opts[] = {{"destination", require_arg, 'd'},
{"source", require_arg, 's'},
{"verbose", no_arg, 'v'},
{"version", no_arg, 'V'},
{"enable-error-stack", no_arg, 'E'},
{"enable-error-stack", optional_arg, 'E'},
{NULL, 0, '\0'}};
char * fname_src = NULL;
char * fname_dst = NULL;
Expand Down Expand Up @@ -93,15 +93,17 @@ usage(void)
PRINTVALSTREAM(rawoutstream, " -o, --output output file name\n");
PRINTVALSTREAM(rawoutstream, " -s, --source source object name\n");
PRINTVALSTREAM(rawoutstream, " -d, --destination destination object name\n");
PRINTVALSTREAM(rawoutstream, " ERROR\n");
PRINTVALSTREAM(rawoutstream,
" --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream,
" Optional value 2 also prints file open errors.\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help Print a usage message and exit\n");
PRINTVALSTREAM(rawoutstream,
" -p, --parents No error if existing, make parent groups as needed\n");
PRINTVALSTREAM(rawoutstream, " -v, --verbose Print information about OBJECTS and OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
PRINTVALSTREAM(rawoutstream,
" Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " -f, --flag Flag type\n\n");
PRINTVALSTREAM(rawoutstream, " Flag type is one of the following strings:\n\n");
PRINTVALSTREAM(rawoutstream, " shallow Copy only immediate members for groups\n\n");
Expand Down Expand Up @@ -288,7 +290,10 @@ main(int argc, char *argv[])
break;

case 'E':
enable_error_stack = 1;
if (opt_arg != NULL)
enable_error_stack = HDatoi(opt_arg);
else
enable_error_stack = 1;
break;

default:
Expand Down
18 changes: 11 additions & 7 deletions tools/h5diff/h5diff_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand All @@ -41,7 +41,7 @@ static struct long_options l_opts[] = {{"help", no_arg, 'h'},
{"no-dangling-links", no_arg, 'x'},
{"exclude-path", require_arg, 'E'},
{"exclude-attribute", require_arg, 'A'},
{"enable-error-stack", no_arg, 'S'},
{"enable-error-stack", optional_arg, 'S'},
{NULL, 0, '\0'}};

/*-------------------------------------------------------------------------
Expand Down Expand Up @@ -288,7 +288,10 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
break;

case 'S':
enable_error_stack = 1;
if (opt_arg != NULL)
enable_error_stack = HDatoi(opt_arg);
else
enable_error_stack = 1;
break;

case 'E':
Expand Down Expand Up @@ -576,6 +579,10 @@ usage(void)
PRINTVALSTREAM(rawoutstream, " [obj1] Name of an HDF5 object, in absolute path\n");
PRINTVALSTREAM(rawoutstream, " [obj2] Name of an HDF5 object, in absolute path\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " ERROR\n");
PRINTVALSTREAM(rawoutstream,
" --enable-error-stack Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " Optional value 2 also prints file open errors.\n");
PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
PRINTVALSTREAM(rawoutstream, " -h, --help\n");
PRINTVALSTREAM(rawoutstream, " Print a usage message and exit.\n");
Expand All @@ -598,9 +605,6 @@ usage(void)
PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
PRINTVALSTREAM(rawoutstream,
" Prints messages from the HDF5 error stack as they occur.\n");
PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
PRINTVALSTREAM(rawoutstream,
" Follow symbolic links (soft links and external links and compare the)\n");
Expand Down Expand Up @@ -722,7 +726,7 @@ usage(void)
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
PRINTVALSTREAM(rawoutstream,
" Default mode: print the number of differences found and where they occured\n");
" Default mode: print the number of differences found and where they occurred\n");
PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
PRINTVALSTREAM(rawoutstream, " -v Verbose mode: print the above plus a list of objects and warnings\n");
PRINTVALSTREAM(rawoutstream, " -q Quiet mode: do not print output\n");
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -22,8 +25,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -105,7 +106,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_600.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -22,8 +25,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -105,7 +106,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_603.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_606.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_612.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_615.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_621.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_622.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_623.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
7 changes: 4 additions & 3 deletions tools/h5diff/testfiles/h5diff_624.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
[obj1] Name of an HDF5 object, in absolute path
[obj2] Name of an HDF5 object, in absolute path

ERROR
--enable-error-stack Prints messages from the HDF5 error stack as they occur.
Optional value 2 also prints file open errors.
OPTIONS
-h, --help
Print a usage message and exit.
Expand All @@ -23,8 +26,6 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
Prints messages from the HDF5 error stack as they occur.
--follow-symlinks
Follow symbolic links (soft links and external links and compare the)
links' target objects.
Expand Down Expand Up @@ -106,7 +107,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
This option can be used repeatedly to exclude multiple paths.

Modes of output:
Default mode: print the number of differences found and where they occured
Default mode: print the number of differences found and where they occurred
-r Report mode: print the above plus the differences
-v Verbose mode: print the above plus a list of objects and warnings
-q Quiet mode: do not print output
Expand Down
Loading

0 comments on commit 5e1eee2

Please sign in to comment.