summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-02-04 20:15:59 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-02-04 20:15:59 (GMT)
commitc3e149d06fe79fab3b5e48d4d9198cacea42ed53 (patch)
tree85d991d39d538e4a5adf41b7f93a571f612e0b95 /tools/h5dump
parentc0b2724d4db12e75ef5e297900b088f1839886cd (diff)
downloadhdf5-c3e149d06fe79fab3b5e48d4d9198cacea42ed53.zip
hdf5-c3e149d06fe79fab3b5e48d4d9198cacea42ed53.tar.gz
hdf5-c3e149d06fe79fab3b5e48d4d9198cacea42ed53.tar.bz2
[svn-r23226] HDFFV-8285: suppress-ddl option: Changed file options to allow for filename F to be optional.
Tested: local linux
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeLists.txt12
-rw-r--r--tools/h5dump/h5dump.c48
-rw-r--r--tools/h5dump/testh5dump.sh.in10
3 files changed, 37 insertions, 33 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 1d0012e..286d09f 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -1262,12 +1262,14 @@ IF (BUILD_TESTING)
ADD_HELP_TEST(help 0 -h)
# test data output redirection
- ADD_H5_TEST (tnoddl 0 --enable-error-stack --ddl=NULL -y packedbits.h5)
- ADD_H5_TEST (tnodata 0 --enable-error-stack --output=NULL packedbits.h5)
- ADD_H5_TEST (tnoattrddl 0 --enable-error-stack --ddl=NULL -y tattr.h5)
- ADD_H5_TEST (tnoattrdata 0 --enable-error-stack -A --output=NULL tattr.h5)
+ #ADD_H5_TEST (tnoddl 0 --enable-error-stack -O -y packedbits.h5)
+ ADD_H5_TEST (tnoddl 0 --enable-error-stack --ddl -y packedbits.h5)
+ #ADD_H5_TEST (tnodata 0 --enable-error-stack -o packedbits.h5)
+ ADD_H5_TEST (tnodata 0 --enable-error-stack --output packedbits.h5)
+ ADD_H5_TEST (tnoattrddl 0 --enable-error-stack -O -y tattr.h5)
+ ADD_H5_TEST (tnoattrdata 0 --enable-error-stack -A -o tattr.h5)
ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o)
- ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack --ddl=NULL -y -o)
+ ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack -O -y -o)
ADD_TEST (
NAME H5DUMP-clear-twithddlfile-export
COMMAND ${CMAKE_COMMAND}
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 0d667df..d89202c 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -71,7 +71,7 @@ struct handler_t {
*/
/* The following initialization makes use of C language cancatenating */
/* "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:Aq:z:m:RECM:O:";
+static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:Aq:z:m:RECM:O*";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
@@ -139,11 +139,11 @@ static struct long_options l_opts[] = {
{ "grou", require_arg, 'g' },
{ "gro", require_arg, 'g' },
{ "gr", require_arg, 'g' },
- { "output", require_arg, 'o' },
- { "outpu", require_arg, 'o' },
- { "outp", require_arg, 'o' },
- { "out", require_arg, 'o' },
- { "ou", require_arg, 'o' },
+ { "output", optional_arg, 'o' },
+ { "outpu", optional_arg, 'o' },
+ { "outp", optional_arg, 'o' },
+ { "out", optional_arg, 'o' },
+ { "ou", optional_arg, 'o' },
{ "soft-link", require_arg, 'l' },
{ "soft-lin", require_arg, 'l' },
{ "soft-li", require_arg, 'l' },
@@ -187,7 +187,7 @@ static struct long_options l_opts[] = {
{ "enable-error-stack", no_arg, 'E' },
{ "packed-bits", require_arg, 'M' },
{ "no-compact-subset", no_arg, 'C' },
- { "ddl", require_arg, 'O' },
+ { "ddl", optional_arg, 'O' },
{ NULL, 0, '\0' }
};
@@ -283,7 +283,7 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, " --no-compact-subset Disable compact form of subsetting and allow the use\n");
PRINTVALSTREAM(rawoutstream, " of \"[\" in dataset names.\n");
PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n");
- PRINTVALSTREAM(rawoutstream, " Use NULL as filename to suppress ddl display\n");
+ PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n");
PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the following options with a dataset\n");
PRINTVALSTREAM(rawoutstream, " attribute. Subsetting is done by selecting a hyperslab from the data.\n");
@@ -515,11 +515,7 @@ set_data_output_file(const char *fname, int is_bin)
}
/* First check if filename is string "NULL" */
- if (HDstrcmp(fname, "NULL") == 0) {
- rawdatastream = NULL;
- retvalue = SUCCEED;
- }
- else {
+ if (fname != NULL) {
/* binary output */
if (is_bin) {
if ((f = HDfopen(fname, "wb")) != NULL) {
@@ -534,6 +530,10 @@ set_data_output_file(const char *fname, int is_bin)
}
}
}
+ else {
+ rawdatastream = NULL;
+ retvalue = SUCCEED;
+ }
return retvalue;
}
@@ -564,16 +564,16 @@ set_attr_output_file(const char *fname, int is_bin)
}
/* First check if filename is string "NULL" */
- if (HDstrcmp(fname, "NULL") == 0) {
- rawattrstream = NULL;
- retvalue = SUCCEED;
- }
- else {
+ if (fname != NULL) {
if ((f = HDfopen(fname, "w")) != NULL) {
rawattrstream = f;
retvalue = SUCCEED;
}
}
+ else {
+ rawattrstream = NULL;
+ retvalue = SUCCEED;
+ }
return retvalue;
}
@@ -603,12 +603,14 @@ set_output_file(const char *fname)
rawoutstream = NULL;
}
/* First check if filename is string "NULL" */
- if (HDstrcmp(fname, "NULL") == 0) {
- rawoutstream = NULL;
- retvalue = SUCCEED;
+ if (fname != NULL) {
+ if ((f = HDfopen(fname, "w")) != NULL) {
+ rawoutstream = f;
+ retvalue = SUCCEED;
+ }
}
- else if ((f = HDfopen(fname, "w")) != NULL) {
- rawoutstream = f;
+ else {
+ rawoutstream = NULL;
retvalue = SUCCEED;
}
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 57c7d96..238eee9 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -799,12 +799,12 @@ COPY_TESTFILES_TO_TESTDIR
#TOOLTEST h5dump-help.txt -h
# test data output redirection
-TOOLTEST tnoddl.ddl --enable-error-stack --ddl=NULL -y packedbits.h5
-TOOLTEST tnodata.ddl --enable-error-stack --output=NULL packedbits.h5
-TOOLTEST tnoattrddl.ddl --enable-error-stack --ddl=NULL -y tattr.h5
-TOOLTEST tnoattrdata.ddl --enable-error-stack -A --output=NULL tattr.h5
+TOOLTEST tnoddl.ddl --enable-error-stack --ddl -y packedbits.h5
+TOOLTEST tnodata.ddl --enable-error-stack --output packedbits.h5
+TOOLTEST tnoattrddl.ddl --enable-error-stack -O -y tattr.h5
+TOOLTEST tnoattrdata.ddl --enable-error-stack -A -o tattr.h5
TOOLTEST2 trawdatafile.exp --enable-error-stack -y -o trawdatafile.txt packedbits.h5
-TOOLTEST2 tnoddlfile.exp --enable-error-stack --ddl=NULL -y -o tnoddlfile.txt packedbits.h5
+TOOLTEST2 tnoddlfile.exp --enable-error-stack -O -y -o tnoddlfile.txt packedbits.h5
TOOLTEST2A twithddlfile.exp twithddl.exp --enable-error-stack --ddl=twithddl.txt -y -o twithddlfile.txt packedbits.h5
# test for maximum display datasets