diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-10-31 18:03:17 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2008-10-31 18:03:17 (GMT) |
commit | 215fcf771f73987d7bc306238c6e32cdc54bf35a (patch) | |
tree | db5df1c3d2ba6228961dad00e7af423c96cb4ba8 /tools/h5dump | |
parent | 27d42dfae539b401a2fc06d99df93cef83b8923f (diff) | |
download | hdf5-215fcf771f73987d7bc306238c6e32cdc54bf35a.zip hdf5-215fcf771f73987d7bc306238c6e32cdc54bf35a.tar.gz hdf5-215fcf771f73987d7bc306238c6e32cdc54bf35a.tar.bz2 |
[svn-r16011] 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) { |