diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-12-04 22:26:41 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-12-04 22:26:41 (GMT) |
commit | 3a32cec96923cf057aad00274b4a8ab7ad82a82f (patch) | |
tree | 304527c04dbad8b51ce2bccda1a434f424bf1a9a /Utilities | |
parent | de8ffcaef492e23af57ed5489dd8a21fdd7ad5d8 (diff) | |
download | CMake-3a32cec96923cf057aad00274b4a8ab7ad82a82f.zip CMake-3a32cec96923cf057aad00274b4a8ab7ad82a82f.tar.gz CMake-3a32cec96923cf057aad00274b4a8ab7ad82a82f.tar.bz2 |
ENH: merge in changes for beos support
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmcurl/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Utilities/cmtar/encode.c | 2 | ||||
-rw-r--r-- | Utilities/cmtar/extract.c | 20 | ||||
-rw-r--r-- | Utilities/cmtar/libtar.c | 9 | ||||
-rw-r--r-- | Utilities/cmtar/util.c | 7 | ||||
-rw-r--r-- | Utilities/cmxmlrpc/xmlrpc_curl_transport.c | 5 |
6 files changed, 43 insertions, 7 deletions
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 52717cc..3fcf926 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -135,6 +135,13 @@ CHECK_LIBRARY_EXISTS_CONCAT("ucb" gethostname HAVE_LIBUCB) CHECK_LIBRARY_EXISTS_CONCAT("socket" connect HAVE_LIBSOCKET) CHECK_LIBRARY_EXISTS("c" gethostbyname "" NOT_NEED_LIBNSL) +# Yellowtab Zeta needs different libraries than BeOS 5. +IF(BEOS) + SET(NOT_NEED_LIBNSL 1) + CHECK_LIBRARY_EXISTS_CONCAT("bind" gethostbyname HAVE_LIBBIND) + CHECK_LIBRARY_EXISTS_CONCAT("bnetapi" closesocket HAVE_LIBBNETAPI) +ENDIF(BEOS) + IF(NOT NOT_NEED_LIBNSL) CHECK_LIBRARY_EXISTS_CONCAT("nsl" gethostbyname HAVE_LIBNSL) ENDIF(NOT NOT_NEED_LIBNSL) diff --git a/Utilities/cmtar/encode.c b/Utilities/cmtar/encode.c index 3c8cb6a..1c75954 100644 --- a/Utilities/cmtar/encode.c +++ b/Utilities/cmtar/encode.c @@ -197,12 +197,14 @@ void th_set_mode(TAR *t, mode_t fmode) { #ifndef WIN32 +#ifndef __BEOS__ if (S_ISSOCK(fmode)) { fmode &= ~S_IFSOCK; fmode |= S_IFIFO; } #endif +#endif /* Looks like on windows the st_mode is longer than 8 characters. */ int_to_oct(fmode & 07777777, (t)->th_buf.mode, 8); } diff --git a/Utilities/cmtar/extract.c b/Utilities/cmtar/extract.c index cb1fab3..925f621 100644 --- a/Utilities/cmtar/extract.c +++ b/Utilities/cmtar/extract.c @@ -116,7 +116,7 @@ tar_set_file_perms(TAR *t, char *realname) return -1; } /* change permissions */ - if (!TH_ISSYM(t) && chmod(filename, mode) == -1) + if (!TH_ISSYM(t) && chmod(filename, mode & 07777) == -1) { #ifdef DEBUG perror("chmod()"); @@ -718,6 +718,7 @@ tar_extract_dir(TAR *t, char *realname) char *filename; char buf[T_BLOCKSIZE]; char *pathname = 0; + size_t len = 0; if (!TH_ISDIR(t)) { @@ -750,14 +751,23 @@ tar_extract_dir(TAR *t, char *realname) return -1; } + /* Strip trailing '/'...it confuses some Unixes (and BeOS)... */ + strncpy(buf, filename, sizeof(buf)-1); + buf[sizeof(buf)-1] = 0; + len = strlen(buf); + if ((len > 0) && (buf[len-1] == '/')) + { + buf[len-1] = '\0'; + } + #ifdef DEBUG printf(" ==> extracting: %s (mode %04o, directory)\n", filename, mode); #endif #ifdef WIN32 - if (mkdir(filename) == -1) + if (mkdir(buf) == -1) #else - if (mkdir(filename, mode) == -1) + if (mkdir(buf, mode & 07777) == -1) #endif { #ifdef __BORLANDC__ @@ -772,7 +782,7 @@ tar_extract_dir(TAR *t, char *realname) #endif if (errno == EEXIST) { - if (chmod(filename, mode) == -1) + if (chmod(filename, mode & 07777) == -1) { #ifdef DEBUG perror("chmod()"); @@ -860,7 +870,7 @@ tar_extract_fifo(TAR *t, char *realname) printf(" ==> extracting: %s (fifo)\n", filename); #endif #ifndef WIN32 - if (mkfifo(filename, mode) == -1) + if (mkfifo(filename, mode & 07777) == -1) #else (void)mode; #endif diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c index 362c105..b19d043 100644 --- a/Utilities/cmtar/libtar.c +++ b/Utilities/cmtar/libtar.c @@ -99,8 +99,13 @@ static int libtar_gzopen(void* call_data, const char *pathname, return -1; } -#if !defined(_WIN32) || defined(__CYGWIN__) - if ((oflags & O_CREAT) && fchmod(fd, mode)) +#if defined(__BEOS__) && !defined(__ZETA__) // no fchmod on BeOS...do pathname instead. + if ((oflags & O_CREAT) && chmod(pathname, mode & 07777)) + { + return -1; + } +#elif !defined(_WIN32) || defined(__CYGWIN__) + if ((oflags & O_CREAT) && fchmod(fd, mode & 07777)) { return -1; } diff --git a/Utilities/cmtar/util.c b/Utilities/cmtar/util.c index 94cf544..550fb93 100644 --- a/Utilities/cmtar/util.c +++ b/Utilities/cmtar/util.c @@ -100,6 +100,13 @@ mkdirhier(char *path) if (*dirp == '\0') continue; + /* + * Don't try to build current or parent dir. It doesn't make sense anyhow, + * but it also returns EINVAL instead of EEXIST on BeOS! + */ + if ((strcmp(dirp, ".") == 0) || (strcmp(dirp, "..") == 0)) + continue; + if (dst[0] != '\0') strcat(dst, "/"); strcat(dst, dirp); diff --git a/Utilities/cmxmlrpc/xmlrpc_curl_transport.c b/Utilities/cmxmlrpc/xmlrpc_curl_transport.c index 15477ce..ad90874 100644 --- a/Utilities/cmxmlrpc/xmlrpc_curl_transport.c +++ b/Utilities/cmxmlrpc/xmlrpc_curl_transport.c @@ -10,6 +10,11 @@ #include "xmlrpc_config.h" +#if defined(__BEOS__) +/* Some helpful system header has char==bool, then bool.h does int==bool. */ +#define HAVE_BOOL 1 +#endif + #include "bool.h" #include "mallocvar.h" #include "linklist.h" |