summaryrefslogtreecommitdiffstats
path: root/Utilities/cmtar/handle.c
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-30 19:22:46 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-12-30 19:22:46 (GMT)
commit6d0f0e0acb95c23a476510726bf7c5fe6fb840bf (patch)
tree0bf1ae222c7564868e7115f5fa5285dec947c908 /Utilities/cmtar/handle.c
parent01ac4158ed47f82b0d7ee7015d1cc38943d86eee (diff)
downloadCMake-6d0f0e0acb95c23a476510726bf7c5fe6fb840bf.zip
CMake-6d0f0e0acb95c23a476510726bf7c5fe6fb840bf.tar.gz
CMake-6d0f0e0acb95c23a476510726bf7c5fe6fb840bf.tar.bz2
COMP: Fix support for gzip on non-32 bit platforms
Diffstat (limited to 'Utilities/cmtar/handle.c')
-rw-r--r--Utilities/cmtar/handle.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/Utilities/cmtar/handle.c b/Utilities/cmtar/handle.c
index 3bf4c28..6770b2b 100644
--- a/Utilities/cmtar/handle.c
+++ b/Utilities/cmtar/handle.c
@@ -34,23 +34,29 @@
const char libtar_version[] = PACKAGE_VERSION;
-#define libtar_symbol(name, ret, args, callargs) \
- static ret libtar_##name args \
- { \
- return name callargs; \
- }
-
-#if defined(__BORLANDC__)
-libtar_symbol(open, int, (const char* pathname, int flags, mode_t mode), (pathname, flags, mode));
-libtar_symbol(close, int, (int fd), (fd));
-libtar_symbol(read, ssize_t, (int fd, void* buf, size_t count), (fd, buf, count));
-libtar_symbol(write, ssize_t, (int fd, void* buf, size_t count), (fd, buf, count));
+static int libtar_open(void* call_data, const char* pathname, int flags, mode_t mode)
+{
+ (void)call_data;
+ return open(pathname, flags, mode);
+}
-static tartype_t default_type = { libtar_open, libtar_close, libtar_read, libtar_write };
-#else
-static tartype_t default_type = { open, close, read, write };
-#endif
+static int libtar_close(void* call_data, int fd)
+{
+ (void)call_data;
+ return close(fd);
+}
+static ssize_t libtar_read(void* call_data, int fd, void* buf, size_t count)
+{
+ (void)call_data;
+ return read(fd, buf, count);
+}
+static ssize_t libtar_write(void* call_data, int fd, const void* buf, size_t count)
+{
+ (void)call_data;
+ return write(fd, buf, count);
+}
+static tartype_t default_type = { libtar_open, libtar_close, libtar_read, libtar_write, 0 };
static int
tar_init(TAR **t, char *pathname, tartype_t *type,
@@ -102,7 +108,7 @@ tar_open(TAR **t, char *pathname, tartype_t *type,
oflags |= O_BINARY;
#endif
- (*t)->fd = (*((*t)->type->openfunc))(pathname, oflags, mode);
+ (*t)->fd = (*((*t)->type->openfunc))((*t)->type->call_data, pathname, oflags, mode);
if ((*t)->fd == -1)
{
free(*t);
@@ -138,7 +144,7 @@ tar_close(TAR *t)
{
int i;
- i = (*(t->type->closefunc))(t->fd);
+ i = (*(t->type->closefunc))(t->type->call_data, t->fd);
if (t->h != NULL)
libtar_hash_free(t->h, ((t->oflags & O_ACCMODE) == O_RDONLY