COMP: Several borland fixes
This commit is contained in:
parent
d715d52a11
commit
18d31fd97c
|
@ -290,7 +290,6 @@ SET(libtar_SRC
|
||||||
output.c
|
output.c
|
||||||
util.c
|
util.c
|
||||||
wrapper.c
|
wrapper.c
|
||||||
filesystem.c filesystem.h
|
|
||||||
internal.h
|
internal.h
|
||||||
${LIBTAR_BINARY_DIR}/libtar/config.h
|
${LIBTAR_BINARY_DIR}/libtar/config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
|
@ -304,6 +303,11 @@ SET(libtar_SRC
|
||||||
# compat/strmode.c
|
# compat/strmode.c
|
||||||
# compat/strsep.c
|
# compat/strsep.c
|
||||||
)
|
)
|
||||||
|
IF(NOT UNIX)
|
||||||
|
SET(libtar_SRC
|
||||||
|
${libtar_SRC}
|
||||||
|
filesystem.c filesystem.h)
|
||||||
|
ENDIF(NOT UNIX)
|
||||||
|
|
||||||
IF(NOT HAVE_STRLCPY)
|
IF(NOT HAVE_STRLCPY)
|
||||||
SET(libtar_SRC ${libtar_SRC} compat/strlcpy.c)
|
SET(libtar_SRC ${libtar_SRC} compat/strlcpy.c)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
# include <libtar/compat.h>
|
# include <libtar/compat.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
|
@ -45,7 +45,7 @@ typedef struct tar_dev tar_dev_t;
|
||||||
struct tar_ino
|
struct tar_ino
|
||||||
{
|
{
|
||||||
ino_t ti_ino;
|
ino_t ti_ino;
|
||||||
char ti_name[MAXPATHLEN];
|
char ti_name[TAR_MAXPATHLEN];
|
||||||
};
|
};
|
||||||
typedef struct tar_ino tar_ino_t;
|
typedef struct tar_ino tar_ino_t;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ tar_append_file(TAR *t, char *realname, char *savename)
|
||||||
libtar_hashptr_t hp;
|
libtar_hashptr_t hp;
|
||||||
tar_dev_t *td = NULL;
|
tar_dev_t *td = NULL;
|
||||||
tar_ino_t *ti = NULL;
|
tar_ino_t *ti = NULL;
|
||||||
char path[MAXPATHLEN];
|
char path[TAR_MAXPATHLEN];
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("==> tar_append_file(TAR=0x%lx (\"%s\"), realname=\"%s\", "
|
printf("==> tar_append_file(TAR=0x%lx (\"%s\"), realname=\"%s\", "
|
||||||
|
@ -162,8 +162,8 @@ tar_append_file(TAR *t, char *realname, char *savename)
|
||||||
#endif
|
#endif
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
return -1;
|
return -1;
|
||||||
if (i >= MAXPATHLEN)
|
if (i >= TAR_MAXPATHLEN)
|
||||||
i = MAXPATHLEN - 1;
|
i = TAR_MAXPATHLEN - 1;
|
||||||
path[i] = '\0';
|
path[i] = '\0';
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf(" tar_append_file(): encoding symlink \"%s\" -> "
|
printf(" tar_append_file(): encoding symlink \"%s\" -> "
|
||||||
|
|
|
@ -33,14 +33,14 @@ static char rcsid[] = "$OpenBSD: basename.c,v 1.4 1999/05/30 17:10:30 espie Exp
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
//#include <sys/param.h>
|
|
||||||
#include <libtar/compat.h>
|
#include <libtar/compat.h>
|
||||||
|
#include <libtarint/internal.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
openbsd_basename(path)
|
openbsd_basename(path)
|
||||||
const char *path;
|
const char *path;
|
||||||
{
|
{
|
||||||
static char bname[MAXPATHLEN];
|
static char bname[TAR_MAXPATHLEN];
|
||||||
register const char *endp, *startp;
|
register const char *endp, *startp;
|
||||||
|
|
||||||
/* Empty or NULL string gets treated as "." */
|
/* Empty or NULL string gets treated as "." */
|
||||||
|
|
|
@ -312,3 +312,12 @@ char *strsep(register char **, register const char *);
|
||||||
#endif
|
#endif
|
||||||
#define S_ISFIFO(m) (((m)&S_IFFIFO)==S_IFFIFO)
|
#define S_ISFIFO(m) (((m)&S_IFFIFO)==S_IFFIFO)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PATH_MAX)
|
||||||
|
# define TAR_MAXPATHLEN PATH_MAX
|
||||||
|
#elif defined(MAXPATHLEN)
|
||||||
|
# define TAR_MAXPATHLEN MAXPATHLEN
|
||||||
|
#else
|
||||||
|
# define TAR_MAXPATHLEN 16384
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -33,14 +33,14 @@ static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
//#include <sys/param.h>
|
|
||||||
#include <libtar/compat.h>
|
#include <libtar/compat.h>
|
||||||
|
#include <libtarint/internal.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
openbsd_dirname(path)
|
openbsd_dirname(path)
|
||||||
const char *path;
|
const char *path;
|
||||||
{
|
{
|
||||||
static char bname[MAXPATHLEN];
|
static char bname[TAR_MAXPATHLEN];
|
||||||
register const char *endp;
|
register const char *endp;
|
||||||
|
|
||||||
/* Empty or NULL string gets treated as "." */
|
/* Empty or NULL string gets treated as "." */
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include <sys/param.h>
|
|
||||||
#else
|
|
||||||
# include <libtar/compat.h>
|
# include <libtar/compat.h>
|
||||||
|
#else
|
||||||
|
# include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
char *
|
char *
|
||||||
th_get_pathname(TAR *t)
|
th_get_pathname(TAR *t)
|
||||||
{
|
{
|
||||||
char filename[MAXPATHLEN];
|
char filename[TAR_MAXPATHLEN];
|
||||||
|
|
||||||
if (t->th_buf.gnu_longname)
|
if (t->th_buf.gnu_longname)
|
||||||
return t->th_buf.gnu_longname;
|
return t->th_buf.gnu_longname;
|
||||||
|
|
|
@ -17,14 +17,20 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# include <sys/utime.h>
|
# include <sys/utime.h>
|
||||||
|
# else
|
||||||
|
# include <utime.h>
|
||||||
|
# endif
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#else
|
#else
|
||||||
# include <utime.h>
|
# include <utime.h>
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STDC_HEADERS
|
#ifdef STDC_HEADERS
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
@ -41,8 +47,8 @@
|
||||||
|
|
||||||
struct linkname
|
struct linkname
|
||||||
{
|
{
|
||||||
char ln_save[MAXPATHLEN];
|
char ln_save[TAR_MAXPATHLEN];
|
||||||
char ln_real[MAXPATHLEN];
|
char ln_real[TAR_MAXPATHLEN];
|
||||||
};
|
};
|
||||||
typedef struct linkname linkname_t;
|
typedef struct linkname linkname_t;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
// First microsoft compilers
|
// First microsoft compilers
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -61,7 +60,7 @@ kwDirEntry * kwReadDir(kwDirectory * dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
entry = (kwDirEntry*)malloc(sizeof(kwDirEntry));
|
entry = (kwDirEntry*)malloc(sizeof(kwDirEntry));
|
||||||
strncpy(entry->d_name,dir->Entry.name,MAXPATHLEN-1);
|
strncpy(entry->d_name,dir->Entry.name,TAR_MAXPATHLEN-1);
|
||||||
if(_findnext(dir->SrchHandle, &dir->Entry) == -1)
|
if(_findnext(dir->SrchHandle, &dir->Entry) == -1)
|
||||||
{
|
{
|
||||||
dir->EOD=1;
|
dir->EOD=1;
|
||||||
|
@ -79,4 +78,3 @@ int kwCloseDir(kwDirectory * dir)
|
||||||
if(r==-1) return 0;
|
if(r==-1) return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifndef _FILESYSTEM_H_
|
#ifndef _FILESYSTEM_H_
|
||||||
#define _FILESYSTEM_H_
|
#define _FILESYSTEM_H_
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <libtarint/internal.h>
|
||||||
|
|
||||||
struct _KWDIR
|
struct _KWDIR
|
||||||
{
|
{
|
||||||
|
@ -15,12 +15,9 @@ struct _KWDIR
|
||||||
int EOD; //end of directory
|
int EOD; //end of directory
|
||||||
|
|
||||||
};
|
};
|
||||||
#ifndef MAXPATHLEN
|
|
||||||
#define MAXPATHLEN _MAX_PATH
|
|
||||||
#endif
|
|
||||||
typedef struct _KWDIRENTRY
|
typedef struct _KWDIRENTRY
|
||||||
{
|
{
|
||||||
char d_name[MAXPATHLEN];
|
char d_name[TAR_MAXPATHLEN];
|
||||||
}kwDirEntry;
|
}kwDirEntry;
|
||||||
|
|
||||||
typedef struct _KWDIR kwDirectory;
|
typedef struct _KWDIR kwDirectory;
|
||||||
|
@ -31,5 +28,3 @@ int kwCloseDir(kwDirectory * dir);
|
||||||
|
|
||||||
#endif //MSC
|
#endif //MSC
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -34,7 +34,22 @@
|
||||||
|
|
||||||
const char libtar_version[] = PACKAGE_VERSION;
|
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 tartype_t default_type = { libtar_open, libtar_close, libtar_read, libtar_write };
|
||||||
|
#else
|
||||||
static tartype_t default_type = { open, close, read, write };
|
static tartype_t default_type = { open, close, read, write };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -14,4 +14,3 @@
|
||||||
#include <libtar/compat.h>
|
#include <libtar/compat.h>
|
||||||
|
|
||||||
#include <libtar/libtar.h>
|
#include <libtar/libtar.h>
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ create(char *tarfile, char *rootdir, libtar_list_t *l)
|
||||||
{
|
{
|
||||||
TAR *t;
|
TAR *t;
|
||||||
char *pathname;
|
char *pathname;
|
||||||
char buf[MAXPATHLEN];
|
char buf[TAR_MAXPATHLEN];
|
||||||
libtar_listptr_t lp;
|
libtar_listptr_t lp;
|
||||||
|
|
||||||
if (tar_open(&t, tarfile,
|
if (tar_open(&t, tarfile,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
int
|
int
|
||||||
path_hashfunc(char *key, int numbuckets)
|
path_hashfunc(char *key, int numbuckets)
|
||||||
{
|
{
|
||||||
char buf[MAXPATHLEN];
|
char buf[TAR_MAXPATHLEN];
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
strcpy(buf, key);
|
strcpy(buf, key);
|
||||||
|
@ -82,7 +82,7 @@ ino_hash(ino_t *inode)
|
||||||
int
|
int
|
||||||
mkdirhier(char *path)
|
mkdirhier(char *path)
|
||||||
{
|
{
|
||||||
char src[MAXPATHLEN], dst[MAXPATHLEN] = "";
|
char src[TAR_MAXPATHLEN], dst[TAR_MAXPATHLEN] = "";
|
||||||
char *dirp, *nextp = src;
|
char *dirp, *nextp = src;
|
||||||
int retval = 1;
|
int retval = 1;
|
||||||
|
|
||||||
|
@ -103,10 +103,10 @@ mkdirhier(char *path)
|
||||||
if (dst[0] != '\0')
|
if (dst[0] != '\0')
|
||||||
strcat(dst, "/");
|
strcat(dst, "/");
|
||||||
strcat(dst, dirp);
|
strcat(dst, dirp);
|
||||||
#ifndef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
if (mkdir(dst, 0777) == -1)
|
|
||||||
#else
|
|
||||||
if (mkdir(dst) == -1)
|
if (mkdir(dst) == -1)
|
||||||
|
#else
|
||||||
|
if (mkdir(dst, 0777) == -1)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <libtar/compat.h>
|
#include <libtar/compat.h>
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
#include <libtarint/filesystem.h>
|
#include <libtarint/filesystem.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -35,7 +35,7 @@ int
|
||||||
tar_extract_glob(TAR *t, char *globname, char *prefix)
|
tar_extract_glob(TAR *t, char *globname, char *prefix)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
char buf[MAXPATHLEN];
|
char buf[TAR_MAXPATHLEN];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while ((i = th_read(t)) == 0)
|
while ((i = th_read(t)) == 0)
|
||||||
|
@ -65,7 +65,7 @@ int
|
||||||
tar_extract_all(TAR *t, char *prefix)
|
tar_extract_all(TAR *t, char *prefix)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
char buf[MAXPATHLEN];
|
char buf[TAR_MAXPATHLEN];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -100,9 +100,9 @@ tar_extract_all(TAR *t, char *prefix)
|
||||||
int
|
int
|
||||||
tar_append_tree(TAR *t, char *realdir, char *savedir)
|
tar_append_tree(TAR *t, char *realdir, char *savedir)
|
||||||
{
|
{
|
||||||
char realpath[MAXPATHLEN];
|
char realpath[TAR_MAXPATHLEN];
|
||||||
char savepath[MAXPATHLEN];
|
char savepath[TAR_MAXPATHLEN];
|
||||||
#ifndef _MSC_VER
|
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||||
struct dirent *dent;
|
struct dirent *dent;
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
#else
|
#else
|
||||||
|
@ -123,7 +123,7 @@ tar_append_tree(TAR *t, char *realdir, char *savedir)
|
||||||
puts(" tar_append_tree(): done with tar_append_file()...");
|
puts(" tar_append_tree(): done with tar_append_file()...");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
dp = kwOpenDir(realdir);
|
dp = kwOpenDir(realdir);
|
||||||
#else
|
#else
|
||||||
dp = opendir(realdir);
|
dp = opendir(realdir);
|
||||||
|
@ -135,7 +135,7 @@ tar_append_tree(TAR *t, char *realdir, char *savedir)
|
||||||
return 0;
|
return 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
while ((dent = kwReadDir(dp)) != NULL)
|
while ((dent = kwReadDir(dp)) != NULL)
|
||||||
#else
|
#else
|
||||||
while ((dent = readdir(dp)) != NULL)
|
while ((dent = readdir(dp)) != NULL)
|
||||||
|
@ -145,10 +145,10 @@ tar_append_tree(TAR *t, char *realdir, char *savedir)
|
||||||
strcmp(dent->d_name, "..") == 0)
|
strcmp(dent->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snprintf(realpath, MAXPATHLEN, "%s/%s", realdir,
|
snprintf(realpath, TAR_MAXPATHLEN, "%s/%s", realdir,
|
||||||
dent->d_name);
|
dent->d_name);
|
||||||
if (savedir)
|
if (savedir)
|
||||||
snprintf(savepath, MAXPATHLEN, "%s/%s", savedir,
|
snprintf(savepath, TAR_MAXPATHLEN, "%s/%s", savedir,
|
||||||
dent->d_name);
|
dent->d_name);
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -171,7 +171,7 @@ tar_append_tree(TAR *t, char *realdir, char *savedir)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
kwCloseDir(dp);
|
kwCloseDir(dp);
|
||||||
#else
|
#else
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
|
|
Loading…
Reference in New Issue