diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-10-31 18:22:19 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-10-31 18:22:19 (GMT) |
commit | c2a65d0a2b843ac16bfce571efda3403a3f3e65f (patch) | |
tree | 47b1ad367c51d8491c99cdbb0a5a38e60638a2ec /tools/h5dump | |
parent | 528a7dd3b8ac56d61d0f82e9e90fe4ed361eebc6 (diff) | |
download | hdf5-c2a65d0a2b843ac16bfce571efda3403a3f3e65f.zip hdf5-c2a65d0a2b843ac16bfce571efda3403a3f3e65f.tar.gz hdf5-c2a65d0a2b843ac16bfce571efda3403a3f3e65f.tar.bz2 |
[svn-r16012] Bug fix
When -b was requested and no -o (file name) binary output was made to stdout
Had a check after command line parsing to verify if -o is present, otherwise exit
Tested: windows, linux
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index fe653fb..19a26b4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -78,6 +78,8 @@ static char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ static const h5dump_header_t *dump_header_format; static const char *fp_format = NULL; +const char *outfname=NULL; + /* things to display or which are set via command line parameters */ @@ -3852,10 +3854,6 @@ parse_command_line(int argc, const char *argv[]) struct handler_t *hand, *last_dset = NULL; int i, opt, last_was_dset = FALSE; - /* some logic to handle both -o and -b order */ - const char *outfname=NULL; - bin_form = -1; - /* no arguments */ if (argc == 1) { usage(progname); @@ -3979,7 +3977,7 @@ parse_start: case 'o': - if (bin_form > 0 ) + if ( bin_output ) { if (set_output_file(opt_arg, 1) < 0){ usage(progname); @@ -4265,6 +4263,12 @@ main(int argc, const char *argv[]) h5tools_init(); hand = parse_command_line(argc, argv); + if ( bin_output && outfname == NULL ) + { + error_msg(progname, "binary output requires a file name, use -o <filename>\n"); + leave(EXIT_FAILURE); + } + /* Check for conflicting options */ if (doxml) { if (!display_all) { |