Add Haiku support

This commit is contained in:
Leorize 2017-12-17 17:50:52 +07:00
parent 139c99a73a
commit 978a8b4086
No known key found for this signature in database
GPG key ID: 175AFCA919C10CC8
2 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,5 @@
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
# include <sys/types.h> # include <sys/types.h>
#endif #endif
@ -9,7 +9,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
# include <fcntl.h> # include <fcntl.h>
# include <poll.h> # include <poll.h>
# include <termios.h> # include <termios.h>
@ -33,7 +33,7 @@ disable_echo(void)
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) # if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
{ {
struct termios p; struct termios p;
@ -60,7 +60,7 @@ enable_echo(void)
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
# if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) # if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
{ {
struct termios p; struct termios p;

View file

@ -1,5 +1,5 @@
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
# include <sys/types.h> # include <sys/types.h>
# include <sys/stat.h> # include <sys/stat.h>
# include <fcntl.h> # include <fcntl.h>
@ -184,7 +184,7 @@ file_basename(const char *file)
FILE * FILE *
fopen_create_useronly(const char *file) fopen_create_useronly(const char *file)
{ {
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
int fd; int fd;
if ((fd = open(file, O_CREAT | O_TRUNC | O_WRONLY, if ((fd = open(file, O_CREAT | O_TRUNC | O_WRONLY,
@ -212,7 +212,7 @@ basedir_create_useronly(const char *file)
} }
dir[basename - dir - 1] = 0; dir[basename - dir - 1] = 0;
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
if (*dir == 0 || mkdir(dir, 0700) == 0 || errno == EEXIST) { if (*dir == 0 || mkdir(dir, 0700) == 0 || errno == EEXIST) {
ret = 0; ret = 0;
} }