summaryrefslogtreecommitdiffstats
path: root/tools/h5copy
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-05-11 17:49:41 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-05-11 17:49:41 (GMT)
commit05d75af8b88cc13232eda2b1660c1bb9ae0bb831 (patch)
tree6f103b56a01c45a3b98bd914f4cccb996bbc931e /tools/h5copy
parent9e595dec197d2812b13c4b86cf3389549c54fbb5 (diff)
downloadhdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.zip
hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.gz
hdf5-05d75af8b88cc13232eda2b1660c1bb9ae0bb831.tar.bz2
[svn-r18757] Enable tools lib to be built as a dll on windows. Added two get/set functions for progname and d_status.
Also add windows import/export declarations to functions. Updated windows - H5pubconf.h for packed bits function Tested: Windows, linux
Diffstat (limited to 'tools/h5copy')
-rw-r--r--tools/h5copy/h5copy.c30
-rw-r--r--tools/h5copy/h5copygentest.c20
2 files changed, 29 insertions, 21 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 0ea8e16..20b28e1 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -19,8 +19,8 @@
#include <string.h>
#include <stdlib.h>
-const char *progname="h5copy";
-int d_status;
+/* Name of tool */
+#define PROGRAMNAME "h5copy"
/* command-line options: short and long-named parameters */
static const char *s_opts = "d:f:hi:o:ps:vV";
@@ -176,7 +176,7 @@ static int parse_flag(const char* str_flag, unsigned *flag)
}
else
{
- error_msg(progname, "Error in input flag\n");
+ error_msg(h5tools_getprogname(), "Error in input flag\n");
return -1;
}
@@ -216,7 +216,9 @@ main (int argc, const char *argv[])
int li_ret;
h5tool_link_info_t linkinfo;
- /* initialize h5tools lib */
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+/* initialize h5tools lib */
h5tools_init();
/* Check for no command line parameters */
@@ -266,7 +268,7 @@ main (int argc, const char *argv[])
break;
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
break;
@@ -286,28 +288,28 @@ main (int argc, const char *argv[])
if (fname_src==NULL)
{
- error_msg(progname, "Input file name missing\n");
+ error_msg(h5tools_getprogname(), "Input file name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (fname_dst==NULL)
{
- error_msg(progname, "Output file name missing\n");
+ error_msg(h5tools_getprogname(), "Output file name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (oname_src==NULL)
{
- error_msg(progname, "Source object name missing\n");
+ error_msg(h5tools_getprogname(), "Source object name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (oname_dst==NULL)
{
- error_msg(progname, "Destination object name missing\n");
+ error_msg(h5tools_getprogname(), "Destination object name missing\n");
usage();
leave(EXIT_FAILURE);
}
@@ -324,7 +326,7 @@ main (int argc, const char *argv[])
*-------------------------------------------------------------------------*/
if (fid_src==-1)
{
- error_msg(progname, "Could not open input file <%s>...Exiting\n", fname_src);
+ error_msg(h5tools_getprogname(), "Could not open input file <%s>...Exiting\n", fname_src);
if (fname_src)
free(fname_src);
leave(EXIT_FAILURE);
@@ -347,7 +349,7 @@ main (int argc, const char *argv[])
*-------------------------------------------------------------------------*/
if (fid_dst==-1)
{
- error_msg(progname, "Could not open output file <%s>...Exiting\n", fname_dst);
+ error_msg(h5tools_getprogname(), "Could not open output file <%s>...Exiting\n", fname_dst);
if (fname_src)
free(fname_src);
if (fname_dst)
@@ -388,7 +390,7 @@ main (int argc, const char *argv[])
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- error_msg(progname, "Could not create link creation property list\n");
+ error_msg(h5tools_getprogname(), "Could not create link creation property list\n");
goto error;
} /* end if */
@@ -396,13 +398,13 @@ main (int argc, const char *argv[])
if(parents) {
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
- error_msg(progname, "Could not set property for creating parent groups\n");
+ error_msg(h5tools_getprogname(), "Could not set property for creating parent groups\n");
goto error;
} /* end if */
/* Display some output if requested */
if(verbose)
- printf("%s: Creating parent groups\n", progname);
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
/*-------------------------------------------------------------------------
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index b6346de..f359a9b 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -21,6 +21,9 @@
#include "H5private.h"
#include "h5tools.h"
+/* Name of tool */
+#define PROGRAMNAME "h5copygentest"
+
/* HDF file names */
#define HDF_FILE1 "h5copytst.h5"
#define HDF_FILE2 "h5copy_ref.h5"
@@ -225,7 +228,7 @@ static void gent_compressed(hid_t loc_id)
/*-------------------------------------------------------------------------
* Function: gent_named_vl
*
- * Purpose: Generate a variable lenght named datatype for a dataset in
+ * Purpose: Generate a variable lenght named datatype for a dataset in
LOC_ID
*
*-------------------------------------------------------------------------
@@ -640,12 +643,12 @@ out:
/*-------------------------------------------------------------------------
* Function: Test_Obj_Copy
*
- * Purpose: Testing with various objects
+ * Purpose: Testing with various objects
*
*------------------------------------------------------------------------*/
static void Test_Obj_Copy()
{
- hid_t fid=0;
+ hid_t fid=0;
/* Create source file */
fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -678,14 +681,14 @@ static void Test_Ref_Copy()
{
hid_t fid=0;
herr_t status;
-
+
fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid < 0)
{
fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2);
goto out;
}
-
+
/* add object reference */
status = gen_obj_ref(fid);
if (status < 0)
@@ -845,7 +848,7 @@ static void Test_Extlink_Copy()
hid_t fid1=0;
hid_t fid2=0;
herr_t status;
-
+
fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (fid1 < 0)
{
@@ -859,7 +862,7 @@ static void Test_Extlink_Copy()
fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE);
goto out;
}
-
+
/* add links to source external link file */
status = gen_extlink_src(fid1);
if (status < 0)
@@ -888,6 +891,9 @@ out:
int main(void)
{
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
Test_Obj_Copy();
Test_Ref_Copy();
Test_Extlink_Copy();