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