diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2002-10-16 05:31:00 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2002-10-16 05:31:00 (GMT) |
commit | 3ec37aad96a3dbc490497a5bdde889822651e4bd (patch) | |
tree | 71d12a6bd34c8216ab575414a3f397ddd5e05844 /tools/h5dump | |
parent | 7e105d1066908b91f047b46c33e00cec73fa52f6 (diff) | |
download | hdf5-3ec37aad96a3dbc490497a5bdde889822651e4bd.zip hdf5-3ec37aad96a3dbc490497a5bdde889822651e4bd.tar.gz hdf5-3ec37aad96a3dbc490497a5bdde889822651e4bd.tar.bz2 |
[svn-r6007] Purpose:
Improvement
Description:
Moved the code parsing for missing file name in the parse_command_line
routine.
Added a test checking if the tool fails as expected when no file name is
given.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}? YES
Misc. update:
Update MANIFEST if you add or remove any file. YES, added nofilename.ddl
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/h5dump.c | 16 | ||||
-rwxr-xr-x | tools/h5dump/testh5dump.sh | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 972d998..d751d25 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2420,11 +2420,6 @@ parse_command_line(int argc, const char *argv[]) struct handler_t *hand, *last_dset = NULL; int i, opt, last_was_dset = FALSE; - if (argc < 2) { - usage(progname); - exit(EXIT_FAILURE); - } - /* this will be plenty big enough to hold the info */ hand = calloc((size_t)argc, sizeof(struct handler_t)); @@ -2612,6 +2607,12 @@ end_collect: } parse_end: + /* check for file name to be processed */ + if (argc <= opt_ind) { + error_msg(progname, "missing file name\n"); + usage(progname); + exit(EXIT_FAILURE); + } return hand; } @@ -2694,11 +2695,6 @@ main(int argc, const char *argv[]) struct handler_t *hand; int i; - if (argc < 2) { - usage(progname); - exit(EXIT_FAILURE); - } - dump_header_format = &standardformat; dump_function_table = &ddl_function_table; diff --git a/tools/h5dump/testh5dump.sh b/tools/h5dump/testh5dump.sh index e3275fd..fe7f1a1 100755 --- a/tools/h5dump/testh5dump.sh +++ b/tools/h5dump/testh5dump.sh @@ -173,6 +173,10 @@ TOOLTEST tall-5s.ddl -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5 TOOLTEST tdset-3s.ddl -d "/dset1[1,1;;;]" tdset.h5 TOOLTEST tdset2-1s.ddl -d "/dset1[;3,2;4,4;1,4]" tdset2.h5 +# test failure handling +# Missing file name +TOOLTEST nofilename.ddl + # test XML TOOLTEST tall.h5.xml --xml tall.h5 TOOLTEST tattr.h5.xml --xml tattr.h5 |