summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-08-01 17:54:31 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-08-01 17:54:31 (GMT)
commitb8a8b54fda077ee6fccc084de18c14ae6e7b6bfe (patch)
treed5674c723d0bbb93725b78469129a7508362745d /tools/h5dump
parente78fbfd2a2c8e7586d9f18cfeadd2a04b336ef18 (diff)
downloadhdf5-b8a8b54fda077ee6fccc084de18c14ae6e7b6bfe.zip
hdf5-b8a8b54fda077ee6fccc084de18c14ae6e7b6bfe.tar.gz
hdf5-b8a8b54fda077ee6fccc084de18c14ae6e7b6bfe.tar.bz2
[svn-r23961] Bring revisions #23862 - 23953 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/h5dump.c176
1 files changed, 5 insertions, 171 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 9b304bd..36192e0 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -481,172 +481,6 @@ table_list_free(void)
} /* end table_list_free() */
/*-------------------------------------------------------------------------
- * Function: set_data_output_file
- *
- * Purpose: Open fname as the output file for dataset raw data.
- * Set rawdatastream as its file stream.
- *
- * Return: 0 -- succeeded
- * negative -- failed
- *
- * Programmer: Albert Cheng, 2000/09/30
- *
- * Modifications:
- * pvn June, 1, 2006. Add a switch for binary output
- *
- *-------------------------------------------------------------------------
- */
-static int
-set_data_output_file(const char *fname, int is_bin)
-{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawdatastream is changed only when succeeded */
-
- if (rawdatastream && rawdatastream != stdout) {
- if (HDfclose(rawdatastream))
- HDperror("closing rawdatastream");
- else
- rawdatastream = NULL;
- }
-
- /* First check if filename is string "NULL" */
- if (fname != NULL) {
- /* binary output */
- if (is_bin) {
- if ((f = HDfopen(fname, "wb")) != NULL) {
- rawdatastream = f;
- retvalue = SUCCEED;
- }
- }
- else {
- if ((f = HDfopen(fname, "w")) != NULL) {
- rawdatastream = f;
- retvalue = SUCCEED;
- }
- }
- }
- else {
- rawdatastream = NULL;
- retvalue = SUCCEED;
- }
-
- return retvalue;
-}
-
-/*-------------------------------------------------------------------------
- * Function: set_attr_output_file
- *
- * Purpose: Open fname as the output file for attribute raw data.
- * Set rawattrstream as its file stream.
- *
- * Return: 0 -- succeeded
- * negative -- failed
- *
- *-------------------------------------------------------------------------
- */
-static int
-set_attr_output_file(const char *fname, int is_bin)
-{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawattrstream is changed only when succeeded */
-
- if (rawattrstream && rawattrstream != stdout) {
- if (HDfclose(rawattrstream))
- HDperror("closing rawattrstream");
- else
- rawattrstream = NULL;
- }
-
- /* First check if filename is string "NULL" */
- if (fname != NULL) {
- if ((f = HDfopen(fname, "w")) != NULL) {
- rawattrstream = f;
- retvalue = SUCCEED;
- }
- }
- else {
- rawattrstream = NULL;
- retvalue = SUCCEED;
- }
-
- return retvalue;
-}
-
-/*-------------------------------------------------------------------------
- * Function: set_output_file
- *
- * Purpose: Open fname as the output file for raw output.
- * Set rawoutstream as its file stream.
- *
- * Return: 0 -- succeeded
- * negative -- failed
- *
- *-------------------------------------------------------------------------
- */
-static int
-set_output_file(const char *fname)
-{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawoutstream is changed only when succeeded */
-
- if (rawoutstream && rawoutstream != stdout) {
- if (HDfclose(rawoutstream))
- HDperror("closing rawoutstream");
- else
- rawoutstream = NULL;
- }
- /* First check if filename is string "NULL" */
- if (fname != NULL) {
- if ((f = HDfopen(fname, "w")) != NULL) {
- rawoutstream = f;
- retvalue = SUCCEED;
- }
- }
- else {
- rawoutstream = NULL;
- retvalue = SUCCEED;
- }
-
- return retvalue;
-}
-
-/*-------------------------------------------------------------------------
- * Function: set_error_file
- *
- * Purpose: Open fname as the error output file for dataset raw error.
- * Set rawerrorstream as its file stream.
- *
- * Return: 0 -- succeeded
- * negative -- failed
- *
- *-------------------------------------------------------------------------
- */
-static int
-set_error_file(const char *fname)
-{
- int retvalue = FAIL;
- FILE *f; /* temporary holding place for the stream pointer
- * so that rawerrorstream is changed only when succeeded */
-
- if (rawerrorstream && rawerrorstream != stderr) {
- if (HDfclose(rawerrorstream))
- HDperror("closing rawerrorstream");
- else
- rawerrorstream = NULL;
- }
-
- if ((f = HDfopen(fname, "w")) != NULL) {
- rawerrorstream = f;
- retvalue = SUCCEED;
- }
-
- return retvalue;
-}
-
-/*-------------------------------------------------------------------------
* Function: set_binary_form
*
* Purpose: set the binary form of output by translating from a string input
@@ -1186,7 +1020,7 @@ parse_start:
break;
case 'O':
- if (set_output_file(opt_arg) < 0) {
+ if (h5tools_set_output_file(opt_arg, 0) < 0) {
usage(h5tools_getprogname());
goto error;
}
@@ -1194,20 +1028,20 @@ parse_start:
case 'o':
if ( bin_output ) {
- if (set_data_output_file(opt_arg, 1) < 0) {
+ if (h5tools_set_data_output_file(opt_arg, 1) < 0) {
usage(h5tools_getprogname());
goto error;
}
}
else {
if(display_attr_data && !display_data) {
- if (set_attr_output_file(opt_arg, 0) < 0) {
+ if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
usage(h5tools_getprogname());
goto error;
}
}
if(display_data || display_all) {
- if (set_data_output_file(opt_arg, 0) < 0) {
+ if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
usage(h5tools_getprogname());
goto error;
}
@@ -1229,7 +1063,7 @@ parse_start:
}
bin_output = TRUE;
if (outfname!=NULL) {
- if (set_data_output_file(outfname, 1) < 0) {
+ if (h5tools_set_data_output_file(outfname, 1) < 0) {
/* failed to set output file */
usage(h5tools_getprogname());
goto error;