summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--tools/h5dump/CMakeLists.txt12
-rw-r--r--tools/h5dump/h5dump.c48
-rw-r--r--tools/h5dump/testh5dump.sh.in10
-rw-r--r--tools/lib/h5tools.c1
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/testfiles/h5dump-help.txt2
-rw-r--r--tools/testfiles/tnofilename-with-packed-bits.ddl2
-rw-r--r--tools/testfiles/tpbitsIncomplete.ddl2
-rw-r--r--tools/testfiles/tpbitsLengthExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsLengthPositive.ddl2
-rw-r--r--tools/testfiles/tpbitsMaxExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsOffsetExceeded.ddl2
-rw-r--r--tools/testfiles/tpbitsOffsetNegative.ddl2
13 files changed, 48 insertions, 41 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
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 0d9bc15..5f4227c 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -153,6 +153,7 @@ h5tools_close(void)
H5E_auto2_t tools_func;
void *tools_edata;
if (h5tools_init_g) {
+ /* special case where only data is output to stdout */
if((rawoutstream == NULL) && rawdatastream && (rawdatastream == stdout))
HDfprintf(rawdatastream, "\n");
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index d45eab2..d7c5adb 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -277,6 +277,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_opt = '?';
}
+ else
+ opt_arg = NULL;
}
else {
if (arg[len] == '=') {
diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt
index 12629c9..40510a4 100644
--- a/tools/testfiles/h5dump-help.txt
+++ b/tools/testfiles/h5dump-help.txt
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl
index e8b733c..440e3d9 100644
--- a/tools/testfiles/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/tnofilename-with-packed-bits.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl
index 0af7386..758b6b4 100644
--- a/tools/testfiles/tpbitsIncomplete.ddl
+++ b/tools/testfiles/tpbitsIncomplete.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl
index bf1ced8..a85ba49 100644
--- a/tools/testfiles/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/tpbitsLengthExceeded.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl
index 4aa79bd..d5a1c88 100644
--- a/tools/testfiles/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/tpbitsLengthPositive.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl
index 89a767c..e24245c 100644
--- a/tools/testfiles/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/tpbitsMaxExceeded.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl
index 2f89be6..8f58c47 100644
--- a/tools/testfiles/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/tpbitsOffsetExceeded.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl
index e3bca0c..6df8cce 100644
--- a/tools/testfiles/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/tpbitsOffsetNegative.ddl
@@ -47,7 +47,7 @@ usage: h5dump [OPTIONS] files
--no-compact-subset Disable compact form of subsetting and allow the use
of "[" in dataset names.
-O F, --ddl=F Output ddl text into file F
- Use NULL as filename to suppress ddl display
+ Do not use filename F to suppress ddl display
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.