summaryrefslogtreecommitdiffstats
path: root/tools/h5jam/getub.c
diff options
context:
space:
mode:
authorXuan Bai <xuanbai@hdfgroup.org>2004-08-18 22:04:26 (GMT)
committerXuan Bai <xuanbai@hdfgroup.org>2004-08-18 22:04:26 (GMT)
commit74f96681ceca04d64a98526a2e91ef0493ee76b1 (patch)
treef9c6ba2aae28916083808520975833e472f8a57d /tools/h5jam/getub.c
parentee21dce85ce38fe7f718322b59288aabd3906e76 (diff)
downloadhdf5-74f96681ceca04d64a98526a2e91ef0493ee76b1.zip
hdf5-74f96681ceca04d64a98526a2e91ef0493ee76b1.tar.gz
hdf5-74f96681ceca04d64a98526a2e91ef0493ee76b1.tar.bz2
[svn-r9111] Purpose:
Update. Description: Make some minor change so that h5jam.c is compatible with Windows. Solution: 1. unistd.h is not available in windows system. Add a macro for this header file as: #ifdef H5_HAVE_UNISTD_H #include <unistd.h> #endif 2. Change open, read, write, lseek functions to HDopen, HDread, HDwrite, and HDlseek, as these HD functions are more comtatible with Windows system. 3. add #include H5private.h 4. remove #include <stdlib.h> Platforms tested: Windows 2000 Windows XP eirene (Note: I talked with Bob and Kent about these changes before check-in) Misc. update:
Diffstat (limited to 'tools/h5jam/getub.c')
-rw-r--r--tools/h5jam/getub.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index e2aec5c..58e9fe8 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -13,10 +13,13 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
-#include <stdlib.h>
#include <fcntl.h>
+
+#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#include "H5private.h"
#include "h5tools_utils.h"
void parse_command_line (int argc, const char *argv[]);
@@ -134,7 +137,7 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
- fd = open (filename, O_RDONLY);
+ fd = HDopen (filename, O_RDONLY, 0);
if (fd < 0)
{
error_msg (progname, "can't open file %s\n", filename);
@@ -148,7 +151,7 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
- res = read (fd, buf, (unsigned)size);
+ res = HDread (fd, buf, (unsigned)size);
if (res < size)
{
@@ -158,7 +161,7 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
- write (1, buf, (unsigned)size);
+ HDwrite (1, buf, (unsigned)size);
if (buf)
free (buf);