719 lines
24 KiB
Plaintext
719 lines
24 KiB
Plaintext
From 23fb926dded2e9e2ab72d8b8c0fab7274f2cc458 Mon Sep 17 00:00:00 2001
|
||
From: Sergei Reznikov <diver@gelios.net>
|
||
Date: Mon, 9 Apr 2018 17:43:54 +0300
|
||
Subject: Fix build on Haiku
|
||
|
||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
index 13b92c4..d4b481a 100644
|
||
--- a/CMakeLists.txt
|
||
+++ b/CMakeLists.txt
|
||
@@ -12,7 +12,7 @@ endif()
|
||
|
||
|
||
|
||
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -fPIC -Wno-unused-function -Wno-c++11-narrowing -D_FILE_OFFSET_BITS=64") # -fsanitize=address
|
||
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64 -Wno-attributes") # -fsanitize=address
|
||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64") # -fsanitize=address
|
||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O2")
|
||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O2")
|
||
diff --git a/WinPort/WinCompat.h b/WinPort/WinCompat.h
|
||
index 0b161a8..e69dede 100644
|
||
--- a/WinPort/WinCompat.h
|
||
+++ b/WinPort/WinCompat.h
|
||
@@ -67,8 +67,8 @@ typedef unsigned __int64 uint64_t;
|
||
#define _swab swab
|
||
#define _itoa itoa
|
||
|
||
-#define __cdecl
|
||
-#define __stdcall
|
||
+//#define __cdecl
|
||
+//#define __stdcall
|
||
#define _export
|
||
#define _cdecl
|
||
|
||
@@ -84,6 +84,8 @@ typedef unsigned __int64 uint64_t;
|
||
# include <sys/syslimits.h>
|
||
#elif __FreeBSD__
|
||
# include <sys/syslimits.h>
|
||
+#elif __HAIKU__
|
||
+# include <limits.h>
|
||
#else
|
||
# include <linux/limits.h>
|
||
#endif
|
||
@@ -167,7 +169,7 @@ static const void *_lfind(
|
||
const void *base,
|
||
unsigned int *num,
|
||
unsigned int width,
|
||
- int (__cdecl *compare)(const void *, const void *)
|
||
+ int *compare(const void *, const void *)
|
||
)
|
||
{
|
||
unsigned int i, n = *num;
|
||
diff --git a/WinPort/src/APIFSNotify.cpp b/WinPort/src/APIFSNotify.cpp
|
||
index 092439b..35e89ad 100644
|
||
--- a/WinPort/src/APIFSNotify.cpp
|
||
+++ b/WinPort/src/APIFSNotify.cpp
|
||
@@ -4,7 +4,7 @@
|
||
#include <chrono>
|
||
#include <thread>
|
||
#include <condition_variable>
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined (__HAIKU__)
|
||
#include <sys/inotify.h>
|
||
#endif
|
||
#include <pthread.h>
|
||
@@ -32,7 +32,7 @@ class WinPortFSNotify : public WinPortEvent
|
||
void AddWatch(const char *path)
|
||
{
|
||
int w = -1;
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined (__HAIKU__)
|
||
uint32_t mask = 0;
|
||
|
||
//TODO: be smarter with filtering
|
||
@@ -64,7 +64,7 @@ class WinPortFSNotify : public WinPortEvent
|
||
for (;;) {
|
||
struct dirent *de = readdir(dir);
|
||
if (!de) break;
|
||
- if (de->d_type == DT_DIR){
|
||
+/* if (de->d_type == DT_DIR){
|
||
if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
|
||
continue;
|
||
|
||
@@ -74,7 +74,7 @@ class WinPortFSNotify : public WinPortEvent
|
||
subpath+= de->d_name;
|
||
AddWatchRecursive(subpath, level + 1);
|
||
}
|
||
- }
|
||
+*/ }
|
||
closedir(dir);
|
||
}
|
||
|
||
@@ -86,7 +86,7 @@ class WinPortFSNotify : public WinPortEvent
|
||
|
||
void WatcherProc()
|
||
{
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined (__HAIKU__)
|
||
union {
|
||
struct inotify_event ie;
|
||
char space[ sizeof(struct inotify_event) + NAME_MAX + 10 ];
|
||
@@ -131,7 +131,7 @@ class WinPortFSNotify : public WinPortEvent
|
||
|
||
void StopWatching()
|
||
{
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined (__HAIKU__)
|
||
if (_fd!=-1) {
|
||
if (_watching) {
|
||
_watching = false;
|
||
@@ -155,7 +155,7 @@ public:
|
||
: WinPortEvent(true, false), _watcher(0),
|
||
_filter(dwNotifyFilter), _watching(false)
|
||
{
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined (__HAIKU__)
|
||
_fd = inotify_init1(IN_CLOEXEC | IN_NONBLOCK);
|
||
if (_fd==-1)
|
||
return;
|
||
diff --git a/WinPort/src/APIFiles.cpp b/WinPort/src/APIFiles.cpp
|
||
index 7f544ac..7ed25fb 100644
|
||
--- a/WinPort/src/APIFiles.cpp
|
||
+++ b/WinPort/src/APIFiles.cpp
|
||
@@ -164,7 +164,7 @@ extern "C"
|
||
|
||
#ifndef __linux__
|
||
if ((dwFlagsAndAttributes & (FILE_FLAG_WRITE_THROUGH|FILE_FLAG_NO_BUFFERING)) != 0) {
|
||
-#ifdef __FreeBSD__
|
||
+#if defined (__FreeBSD__) || (__HAIKU__)
|
||
fcntl(r, O_DIRECT, 1);
|
||
#else
|
||
fcntl(r, F_NOCACHE, 1);
|
||
@@ -601,7 +601,7 @@ extern "C"
|
||
if (!de)
|
||
return false;
|
||
|
||
- if ( PreMatchDType(de->d_type) && MatchName(de->d_name) ) {
|
||
+/* if ( PreMatchDType(de->d_type) && MatchName(de->d_name) ) {
|
||
mode_t hint_mode_type;
|
||
switch (de->d_type) {
|
||
case DT_DIR: hint_mode_type = S_IFDIR; break;
|
||
@@ -616,7 +616,7 @@ extern "C"
|
||
if (MatchAttributesAndFillWFD(hint_mode_type, de->d_name, lpFindFileData))
|
||
return true;
|
||
}
|
||
- }
|
||
+*/ }
|
||
#endif
|
||
}
|
||
|
||
@@ -689,7 +689,7 @@ extern "C"
|
||
#else
|
||
DIR *_d;
|
||
|
||
- bool PreMatchDType(unsigned char d_type)
|
||
+/* bool PreMatchDType(unsigned char d_type)
|
||
{
|
||
switch (d_type) {
|
||
case DT_DIR: return (_flags & FIND_FILE_FLAG_NO_DIRS) == 0;
|
||
@@ -701,6 +701,7 @@ extern "C"
|
||
|
||
}
|
||
}
|
||
+*/
|
||
#endif
|
||
struct {
|
||
std::string path;
|
||
diff --git a/WinPort/src/sudo/sudo_client_api.cpp b/WinPort/src/sudo/sudo_client_api.cpp
|
||
index 6199e06..b50edfe 100644
|
||
--- a/WinPort/src/sudo/sudo_client_api.cpp
|
||
+++ b/WinPort/src/sudo/sudo_client_api.cpp
|
||
@@ -17,7 +17,7 @@
|
||
#include "sudo_private.h"
|
||
#include "sudo.h"
|
||
|
||
-#if !defined(__APPLE__) and !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) and !defined(__FreeBSD__) and !defined(__HAIKU__)
|
||
# include <sys/ioctl.h>
|
||
# include <linux/fs.h>
|
||
#endif
|
||
@@ -382,7 +382,7 @@ template <class STAT_STRUCT>
|
||
return -1;
|
||
}
|
||
}
|
||
-#ifndef __FreeBSD__
|
||
+#if !defined (__FreeBSD__) && !defined (__HAIKU__)
|
||
extern "C" __attribute__ ((visibility("default"))) int sdc_statfs(const char *path, struct statfs *buf)
|
||
{
|
||
int saved_errno = errno;
|
||
@@ -752,8 +752,8 @@ extern "C" __attribute__ ((visibility("default"))) int sdc_utimes(const char *fi
|
||
extern "C" __attribute__ ((visibility("default"))) int sdc_futimes(int fd, const struct timeval tv[2])
|
||
{
|
||
int remote_fd = s_c2s_fd.Lookup(fd);
|
||
- if (remote_fd==-1)
|
||
- return futimes(fd, tv);
|
||
+// if (remote_fd==-1)
|
||
+// return futimes(fd, tv);
|
||
|
||
|
||
try {
|
||
@@ -881,10 +881,10 @@ extern "C" __attribute__ ((visibility("default"))) char *sdc_getcwd(char *buf, s
|
||
return getcwd(buf, size);
|
||
}
|
||
|
||
-
|
||
+/*
|
||
extern "C" __attribute__ ((visibility("default"))) ssize_t sdc_flistxattr(int fd, char *namebuf, size_t size)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if !defined (__FreeBSD__) && !defined (__HAIKU__)
|
||
return -1;
|
||
#else
|
||
int remote_fd = s_c2s_fd.Lookup(fd);
|
||
@@ -920,7 +920,7 @@ extern "C" __attribute__ ((visibility("default"))) ssize_t sdc_flistxattr(int fd
|
||
|
||
extern "C" __attribute__ ((visibility("default"))) ssize_t sdc_fgetxattr(int fd, const char *name,void *value, size_t size)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if !defined (__FreeBSD__) && !defined (__HAIKU__)
|
||
return -1;
|
||
#else
|
||
int remote_fd = s_c2s_fd.Lookup(fd);
|
||
@@ -957,7 +957,7 @@ extern "C" __attribute__ ((visibility("default"))) ssize_t sdc_fgetxattr(int fd,
|
||
|
||
extern "C" __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, const char *name, const void *value, size_t size, int flags)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if !defined (__FreeBSD__) && !defined (__HAIKU__)
|
||
return -1;
|
||
#else
|
||
int remote_fd = s_c2s_fd.Lookup(fd);
|
||
@@ -988,11 +988,11 @@ extern "C" __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, con
|
||
}
|
||
#endif
|
||
}
|
||
-
|
||
+*/
|
||
|
||
extern "C" __attribute__ ((visibility("default"))) int sdc_fs_flags_get(const char *path, int *flags)
|
||
{
|
||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||
//TODO
|
||
*flags = 0;
|
||
return 0;
|
||
@@ -1026,7 +1026,7 @@ extern "C" __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, con
|
||
|
||
extern "C" __attribute__ ((visibility("default"))) int sdc_fs_flags_set(const char *path, int flags)
|
||
{
|
||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||
//TODO
|
||
return 0;
|
||
#else
|
||
diff --git a/WinPort/src/sudo/sudo_dispatcher.cpp b/WinPort/src/sudo/sudo_dispatcher.cpp
|
||
index e9f0950..3899660 100644
|
||
--- a/WinPort/src/sudo/sudo_dispatcher.cpp
|
||
+++ b/WinPort/src/sudo/sudo_dispatcher.cpp
|
||
@@ -6,6 +6,7 @@
|
||
#include <fcntl.h>
|
||
#include <string.h>
|
||
#include <sys/stat.h>
|
||
+#ifndef __HAIKU__
|
||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
#include <sys/mount.h>
|
||
#else
|
||
@@ -13,10 +14,11 @@
|
||
#include <sys/ioctl.h>
|
||
#include <linux/fs.h>
|
||
#endif
|
||
+#endif
|
||
#include <sys/statvfs.h>
|
||
#include <sys/time.h>
|
||
#include <sys/types.h>
|
||
-#ifndef __FreeBSD__
|
||
+#if !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
# include <sys/xattr.h>
|
||
#endif
|
||
#include <set>
|
||
@@ -339,11 +341,11 @@ namespace Sudo
|
||
bt.RecvPOD(times[0]);
|
||
bt.RecvPOD(times[1]);
|
||
|
||
- off_t r = g_fds.Check(fd) ? futimes(fd, times) : -1;
|
||
+/* off_t r = g_fds.Check(fd) ? futimes(fd, times) : -1;
|
||
bt.SendInt(r);
|
||
if (r==-1)
|
||
bt.SendErrno();
|
||
- }
|
||
+*/ }
|
||
|
||
static void OnSudoDispatch_TwoPathes(int (*pfn)(const char *, const char *), BaseTransaction &bt)
|
||
{
|
||
@@ -389,7 +391,7 @@ namespace Sudo
|
||
|
||
static void OnSudoDispatch_FListXAttr(BaseTransaction &bt)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if defined (__FreeBSD__) || defined (__HAIKU__)
|
||
return;
|
||
#else
|
||
int fd;
|
||
@@ -413,7 +415,7 @@ namespace Sudo
|
||
|
||
static void OnSudoDispatch_FGetXAttr(BaseTransaction &bt)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if defined (__FreeBSD__) || defined (__HAIKU__)
|
||
return;
|
||
#else
|
||
int fd;
|
||
@@ -438,7 +440,7 @@ namespace Sudo
|
||
|
||
static void OnSudoDispatch_FSetXAttr(BaseTransaction &bt)
|
||
{
|
||
-#ifdef __FreeBSD__
|
||
+#if defined (__FreeBSD__) || defined (__HAIKU__)
|
||
return;
|
||
#else
|
||
int fd;
|
||
@@ -466,7 +468,7 @@ namespace Sudo
|
||
|
||
static void OnSudoDispatch_FSFlagsGet(BaseTransaction &bt)
|
||
{
|
||
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
std::string path;
|
||
bt.RecvStr(path);
|
||
int r = -1;
|
||
@@ -488,7 +490,7 @@ namespace Sudo
|
||
|
||
static void OnSudoDispatch_FSFlagsSet(BaseTransaction &bt)
|
||
{
|
||
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
std::string path;
|
||
bt.RecvStr(path);
|
||
int flags = bt.RecvInt();
|
||
@@ -539,7 +541,7 @@ namespace Sudo
|
||
OnSudoDispatch_Read(bt);
|
||
break;
|
||
|
||
- case SUDO_CMD_STATFS:
|
||
+/* case SUDO_CMD_STATFS:
|
||
OnSudoDispatch_StatCommon<struct statfs>(&statfs, bt);
|
||
break;
|
||
|
||
@@ -559,7 +561,7 @@ namespace Sudo
|
||
OnSudoDispatch_FStat(bt);
|
||
break;
|
||
|
||
- case SUDO_CMD_FTRUNCATE:
|
||
+*/ case SUDO_CMD_FTRUNCATE:
|
||
OnSudoFTruncate(bt);
|
||
break;
|
||
|
||
diff --git a/WinPort/sudo.h b/WinPort/sudo.h
|
||
index 5c3b247..7136688 100644
|
||
--- a/WinPort/sudo.h
|
||
+++ b/WinPort/sudo.h
|
||
@@ -3,7 +3,7 @@
|
||
#include <sys/statvfs.h>
|
||
#ifdef __APPLE__
|
||
#include <sys/mount.h>
|
||
-#elif !defined(__FreeBSD__)
|
||
+#elif !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
#include <sys/statfs.h>
|
||
#endif
|
||
#include <dirent.h>
|
||
@@ -67,9 +67,9 @@ extern "C" {
|
||
__attribute__ ((visibility("default"))) char *sdc_realpath(const char *path, char *resolved_path);
|
||
__attribute__ ((visibility("default"))) ssize_t sdc_readlink(const char *pathname, char *buf, size_t bufsiz);
|
||
__attribute__ ((visibility("default"))) char *sdc_getcwd(char *buf, size_t size);
|
||
- __attribute__ ((visibility("default"))) ssize_t sdc_flistxattr(int fd, char *namebuf, size_t size);
|
||
- __attribute__ ((visibility("default"))) ssize_t sdc_fgetxattr(int fd, const char *name,void *value, size_t size);
|
||
- __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
|
||
+// __attribute__ ((visibility("default"))) ssize_t sdc_flistxattr(int fd, char *namebuf, size_t size);
|
||
+// __attribute__ ((visibility("default"))) ssize_t sdc_fgetxattr(int fd, const char *name,void *value, size_t size);
|
||
+// __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
|
||
__attribute__ ((visibility("default"))) int sdc_fs_flags_get(const char *path, int *flags);
|
||
__attribute__ ((visibility("default"))) int sdc_fs_flags_set(const char *path, int flags);
|
||
#ifdef __cplusplus
|
||
diff --git a/far2l/CMakeLists.txt b/far2l/CMakeLists.txt
|
||
index d4c6e44..3f05f02 100644
|
||
--- a/far2l/CMakeLists.txt
|
||
+++ b/far2l/CMakeLists.txt
|
||
@@ -184,7 +184,7 @@ set_target_properties(far2l
|
||
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||
target_link_libraries(far2l ${WINPORT} c)
|
||
else()
|
||
- target_link_libraries(far2l ${WINPORT} dl)
|
||
+ target_link_libraries(far2l ${WINPORT})
|
||
endif()
|
||
|
||
add_custom_command(TARGET far2l POST_BUILD
|
||
diff --git a/far2l/bootstrap/scripts/vbuild.sh b/far2l/bootstrap/scripts/vbuild.sh
|
||
old mode 100644
|
||
new mode 100755
|
||
diff --git a/far2l/execute.cpp b/far2l/execute.cpp
|
||
index 421b4e4..343843f 100644
|
||
--- a/far2l/execute.cpp
|
||
+++ b/far2l/execute.cpp
|
||
@@ -64,7 +64,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
#include "console.hpp"
|
||
#include "constitle.hpp"
|
||
#include "vtshell.h"
|
||
-#include <wordexp.h>
|
||
+#if !defined(__HAIKU__)
|
||
+ #include <wordexp.h>
|
||
+#endif
|
||
+
|
||
#include <set>
|
||
#include <sys/wait.h>
|
||
#ifdef __FreeBSD__
|
||
diff --git a/far2l/execute_oscmd.cpp b/far2l/execute_oscmd.cpp
|
||
index 43581a7..4275b31 100644
|
||
--- a/far2l/execute_oscmd.cpp
|
||
+++ b/far2l/execute_oscmd.cpp
|
||
@@ -64,7 +64,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
#include "vtlog.h"
|
||
#include <vector>
|
||
#include <string>
|
||
-#include <wordexp.h>
|
||
+#if !defined(__HAIKU__)
|
||
+ #include <wordexp.h>
|
||
+#endif
|
||
+
|
||
|
||
// explode cmdline to argv[] array
|
||
//
|
||
@@ -82,7 +85,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
std::vector<std::string> ExplodeCmdLine(std::string cmd_line) {
|
||
std::vector<std::string> rc;
|
||
fprintf(stderr, "ExplodeCmdLine('%s'): ", cmd_line.c_str());
|
||
- wordexp_t we = {};
|
||
+/* wordexp_t we = {};
|
||
for (;;) {
|
||
int r = wordexp(cmd_line.c_str(), &we, 0);
|
||
if (r==0) {
|
||
@@ -103,7 +106,7 @@ std::vector<std::string> ExplodeCmdLine(std::string cmd_line) {
|
||
fprintf(stderr, "error %d\n", r);
|
||
break;
|
||
}
|
||
- return rc;
|
||
+*/ return rc;
|
||
};
|
||
|
||
|
||
diff --git a/far2l/farrtl.cpp b/far2l/farrtl.cpp
|
||
index 92fac2c..7f2d3f7 100644
|
||
--- a/far2l/farrtl.cpp
|
||
+++ b/far2l/farrtl.cpp
|
||
@@ -181,7 +181,7 @@ extern "C"
|
||
|
||
int64_t ftell64(FILE *fp)
|
||
{
|
||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||
return ftello(fp);
|
||
#elif defined(__GNUC__)
|
||
return ftello64(fp);
|
||
@@ -192,7 +192,7 @@ int64_t ftell64(FILE *fp)
|
||
|
||
int fseek64(FILE *fp, int64_t offset, int whence)
|
||
{
|
||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||
return fseeko(fp,offset,whence);
|
||
#elif defined(__GNUC__)
|
||
return fseeko64(fp,offset,whence);
|
||
diff --git a/far2l/farwinapi.cpp b/far2l/farwinapi.cpp
|
||
index debd02e..8ec9558 100644
|
||
--- a/far2l/farwinapi.cpp
|
||
+++ b/far2l/farwinapi.cpp
|
||
@@ -38,9 +38,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
#include <errno.h>
|
||
#include <sys/mount.h>
|
||
-#else
|
||
- #include <sys/statfs.h>
|
||
- #include <linux/fs.h>
|
||
+//#else
|
||
+// #include <sys/statfs.h>
|
||
+// #include <linux/fs.h>
|
||
#endif
|
||
#include "pathmix.hpp"
|
||
#include "mix.hpp"
|
||
@@ -309,7 +309,7 @@ FemaleBool File::QueryFileExtendedAttributes(FileExtendedAttributes &xattr)
|
||
int fd = WINPORT(GetFileDescriptor)(Handle);
|
||
if (fd == -1)
|
||
return FB_NO;
|
||
-
|
||
+/*
|
||
std::vector<char> buf(0x100);
|
||
for (;;) {
|
||
ssize_t r = sdc_flistxattr(fd, &buf[0], buf.size() - 1);
|
||
@@ -355,6 +355,7 @@ FemaleBool File::QueryFileExtendedAttributes(FileExtendedAttributes &xattr)
|
||
}
|
||
}
|
||
return any_failed ? ( any_ok ? FB_MAYBE : FB_NO) : FB_YES;
|
||
+*/
|
||
}
|
||
|
||
FemaleBool File::SetFileExtendedAttributes(const FileExtendedAttributes &xattr)
|
||
@@ -362,7 +363,7 @@ FemaleBool File::SetFileExtendedAttributes(const FileExtendedAttributes &xattr)
|
||
int fd = WINPORT(GetFileDescriptor)(Handle);
|
||
if (fd == -1)
|
||
return FB_NO;
|
||
-
|
||
+/*
|
||
bool any_ok = false, any_failed = false;
|
||
for (FileExtendedAttributes::const_iterator i = xattr.begin(); i != xattr.end(); ++i) {
|
||
int r;
|
||
@@ -377,6 +378,7 @@ FemaleBool File::SetFileExtendedAttributes(const FileExtendedAttributes &xattr)
|
||
any_ok = true;
|
||
}
|
||
return any_failed ? ( any_ok ? FB_MAYBE : FB_NO) : FB_YES;
|
||
+*/
|
||
}
|
||
|
||
bool File::Close()
|
||
@@ -598,6 +600,7 @@ BOOL apiGetVolumeInformation(
|
||
FARString *pFileSystemName
|
||
)
|
||
{
|
||
+/*
|
||
struct statvfs svfs = {};
|
||
const std::string &path = Wide2MB(lpwszRootPathName);
|
||
if (sdc_statvfs(path.c_str(), &svfs) != 0) {
|
||
@@ -632,7 +635,7 @@ BOOL apiGetVolumeInformation(
|
||
}
|
||
}
|
||
}
|
||
-
|
||
+*/
|
||
return TRUE;
|
||
}
|
||
|
||
@@ -856,7 +859,7 @@ IUnmakeWritablePtr apiMakeWritable(LPCWSTR lpFileName)
|
||
}
|
||
}
|
||
|
||
-#if defined(__APPLE__) or defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) or defined(__FreeBSD__) or defined(__HAIKU__)
|
||
//TODO: handle chattr +i
|
||
#else
|
||
if (!um->dir.empty() && sdc_fs_flags_get(um->dir.c_str(), &um->dir_flags) != -1
|
||
diff --git a/far2l/filefilter.cpp b/far2l/filefilter.cpp
|
||
index e39b5e2..c907199 100644
|
||
--- a/far2l/filefilter.cpp
|
||
+++ b/far2l/filefilter.cpp
|
||
@@ -974,8 +974,8 @@ int FileFilter::ParseAndAddMasks(wchar_t **ExtPtr,const wchar_t *FileName,DWORD
|
||
// сначала поиск...
|
||
unsigned int Cnt=ExtCount;
|
||
|
||
- if (_lfind(strMask.CPtr(),*ExtPtr,&Cnt,MAX_PATH*sizeof(wchar_t),ExtSort))
|
||
- return -1;
|
||
+// if (_lfind(strMask.CPtr(),*ExtPtr,&Cnt,MAX_PATH*sizeof(wchar_t),ExtSort))
|
||
+// return -1;
|
||
|
||
// ... а потом уже выделение памяти!
|
||
wchar_t *NewPtr;
|
||
diff --git a/far2l/infolist.cpp b/far2l/infolist.cpp
|
||
index 9d0f498..00bd80b 100644
|
||
--- a/far2l/infolist.cpp
|
||
+++ b/far2l/infolist.cpp
|
||
@@ -58,7 +58,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
//# include <sys/sysctl.h>
|
||
# include <mach/mach_host.h>
|
||
# include <mach/vm_statistics.h>
|
||
-#elif !defined(__FreeBSD__)
|
||
+#elif !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
# include <sys/sysinfo.h>
|
||
#endif
|
||
|
||
@@ -347,7 +347,7 @@ void InfoList::DisplayObject()
|
||
}
|
||
|
||
|
||
-#elif !defined(__FreeBSD__)
|
||
+#elif !defined(__FreeBSD__) && !defined(__HAIKU__)
|
||
struct sysinfo si = {};
|
||
if (sysinfo(&si) == 0)
|
||
{
|
||
diff --git a/far2l/main.cpp b/far2l/main.cpp
|
||
index d0d2640..e46a8a3 100644
|
||
--- a/far2l/main.cpp
|
||
+++ b/far2l/main.cpp
|
||
@@ -677,11 +677,13 @@ static void SetupStdHandles()
|
||
}
|
||
|
||
if ( reopened == 3 && out == DEVNULL && err == DEVNULL) {
|
||
+ #ifndef __HAIKU__
|
||
ioctl(0, TIOCNOTTY, NULL);
|
||
if (!freopen(DEVNULL, "r", stdin)) {
|
||
perror("freopen stdin");
|
||
}
|
||
signal(SIGHUP, SIG_IGN);
|
||
+ #endif
|
||
}
|
||
}
|
||
|
||
diff --git a/far2l/plugin.hpp b/far2l/plugin.hpp
|
||
index cf27113..cc85007 100644
|
||
--- a/far2l/plugin.hpp
|
||
+++ b/far2l/plugin.hpp
|
||
@@ -1821,7 +1821,7 @@ typedef int (WINAPIV *FARSTDSSCANF)(const wchar_t *Buffer, const wchar_t *Format
|
||
// </C&C++>
|
||
typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *));
|
||
typedef void (WINAPI *FARSTDQSORTEX)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *,void *userparam),void *userparam);
|
||
-typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *));
|
||
+typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (const void *, const void *));
|
||
typedef int (WINAPI *FARSTDGETFILEOWNER)(const wchar_t *Computer,const wchar_t *Name,wchar_t *Owner,int Size);
|
||
typedef int (WINAPI *FARSTDGETNUMBEROFLINKS)(const wchar_t *Name);
|
||
typedef int (WINAPI *FARSTDATOI)(const wchar_t *s);
|
||
diff --git a/far2l/pluginold.hpp b/far2l/pluginold.hpp
|
||
index 54f46f4..c064256 100644
|
||
--- a/far2l/pluginold.hpp
|
||
+++ b/far2l/pluginold.hpp
|
||
@@ -1442,9 +1442,9 @@ namespace oldfar
|
||
typedef int (WINAPIV *FARSTDSNPRINTF)(char *Buffer,size_t Sizebuf,const char *Format,...);
|
||
typedef int (WINAPIV *FARSTDSSCANF)(const char *Buffer, const char *Format,...);
|
||
// </C&C++>
|
||
- typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *));
|
||
- typedef void (WINAPI *FARSTDQSORTEX)(void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *,void *userparam),void *userparam);
|
||
- typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (__cdecl *fcmp)(const void *, const void *));
|
||
+ typedef void (WINAPI *FARSTDQSORT)(void *base, size_t nelem, size_t width, int (const void *, const void *));
|
||
+ typedef void (WINAPI *FARSTDQSORTEX)(void *base, size_t nelem, size_t width, int (const void *, const void *,void *userparam),void *userparam);
|
||
+ typedef void *(WINAPI *FARSTDBSEARCH)(const void *key, const void *base, size_t nelem, size_t width, int (const void *, const void *));
|
||
typedef int (WINAPI *FARSTDGETFILEOWNER)(const char *Computer,const char *Name,char *Owner);
|
||
typedef int (WINAPI *FARSTDGETNUMBEROFLINKS)(const char *Name);
|
||
typedef int (WINAPI *FARSTDATOI)(const char *s);
|
||
diff --git a/far2l/vtcompletor.cpp b/far2l/vtcompletor.cpp
|
||
index 2588ed3..b305e2e 100644
|
||
--- a/far2l/vtcompletor.cpp
|
||
+++ b/far2l/vtcompletor.cpp
|
||
@@ -5,8 +5,9 @@
|
||
#include <sys/stat.h>
|
||
#include <sys/select.h>
|
||
#include <sys/wait.h>
|
||
-#include <wordexp.h>
|
||
-
|
||
+#if !defined(__HAIKU__)
|
||
+ #include <wordexp.h>
|
||
+#endif
|
||
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <string.h>
|
||
diff --git a/farlng/CMakeLists.txt b/farlng/CMakeLists.txt
|
||
index f8dad9f..e829250 100644
|
||
--- a/farlng/CMakeLists.txt
|
||
+++ b/farlng/CMakeLists.txt
|
||
@@ -25,7 +25,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk2u-3.0-config")
|
||
target_link_libraries (farlng WinPort utils ${wxWidgets_LIBRARIES} c)
|
||
else()
|
||
- target_link_libraries (farlng WinPort utils ${wxWidgets_LIBRARIES} dl)
|
||
+ target_link_libraries (farlng WinPort utils ${wxWidgets_LIBRARIES})
|
||
endif()
|
||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||
target_link_libraries(farlng glib-2.0 -L/usr/local/lib)
|
||
diff --git a/multiarc/src/ArcMix.cpp b/multiarc/src/ArcMix.cpp
|
||
index 3dcc61a..cc931f8 100644
|
||
--- a/multiarc/src/ArcMix.cpp
|
||
+++ b/multiarc/src/ArcMix.cpp
|
||
@@ -4,7 +4,9 @@
|
||
#include <stdlib.h>
|
||
#include <string.h>
|
||
#include <unistd.h>
|
||
-#include <wordexp.h>
|
||
+#if !defined(__HAIKU__)
|
||
+ #include <wordexp.h>
|
||
+#endif
|
||
#include <sys/stat.h>
|
||
#include <windows.h>
|
||
#include <string>
|
||
diff --git a/multiarc/src/MultiArc.cpp b/multiarc/src/MultiArc.cpp
|
||
index c104f78..ae296a3 100644
|
||
--- a/multiarc/src/MultiArc.cpp
|
||
+++ b/multiarc/src/MultiArc.cpp
|
||
@@ -98,7 +98,7 @@ SHAREDSYMBOL HANDLE WINAPI _export OpenFilePlugin(const char *Name,const unsigne
|
||
return hPlugin;
|
||
}
|
||
|
||
-#if defined(__APPLE__) || defined(__FreeBSD__)
|
||
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
|
||
char *get_current_dir_name();
|
||
#endif
|
||
|
||
diff --git a/netbox/src/NetBox/CMakeLists.txt b/netbox/src/NetBox/CMakeLists.txt
|
||
index 7c9eb0f..b10592f 100644
|
||
--- a/netbox/src/NetBox/CMakeLists.txt
|
||
+++ b/netbox/src/NetBox/CMakeLists.txt
|
||
@@ -68,7 +68,7 @@ set(NETBOX_FLAGS_DEBUG "${NETBOX_FLAGS_DEBUG} /Gm- /Od /MTd /GS /RTC1")
|
||
elseif(CMAKE_COMPILER_IS_MINGW)
|
||
|
||
set(NETBOX_CFLAGS "${NETBOX_CFLAGS} ${NETBOX_C_FLAGS} -static -s -O2 -Wall -Wextra -pedantic -Wold-style-cast -Wconversion -Wsign-conversion -Winit-self -Wunreachable-code")
|
||
-set(NETBOX_WARNING_FLAGS "-Wno-attributes -Wno-write-strings -Wno-unknown-pragmas")
|
||
+set(NETBOX_WARNING_FLAGS "-Wno-attributes -Wno-unknown-pragmas")
|
||
set(NETBOX_CXX_FLAGS "${NETBOX_CFLAGS} -D_UNICODE -DUNICODE -std=c++11 -Weffc++ -Woverloaded-virtual -Wnon-virtual-dtor")
|
||
set(NETBOX_FLAGS_RELEASE "${NETBOX_FLAGS_RELEASE} ${NETBOX_CFLAGS}")
|
||
set(NETBOX_FLAGS_DEBUG "${NETBOX_FLAGS_DEBUG} ${NETBOX_CFLAGS}")
|
||
diff --git a/utils/src/utils.cpp b/utils/src/utils.cpp
|
||
index de2a9ec..01af2c5 100644
|
||
--- a/utils/src/utils.cpp
|
||
+++ b/utils/src/utils.cpp
|
||
@@ -274,7 +274,7 @@ ErrnoSaver::~ErrnoSaver()
|
||
//////////
|
||
int pipe_cloexec(int pipedes[2])
|
||
{
|
||
-#ifdef __APPLE__
|
||
+#if defined(__APPLE__) || (__HAIKU__)
|
||
int r = pipe(pipedes);
|
||
if (r==0) {
|
||
fcntl(pipedes[0], F_SETFD, FD_CLOEXEC);
|
||
--
|
||
2.16.2
|
||
|