Merge branch 'netbsd' into 'master'
Improve NetBSD support See merge request gambas/gambas!37
This commit is contained in:
commit
ce37927180
18 changed files with 106 additions and 93 deletions
|
@ -102,22 +102,22 @@ void INPUT_drain()
|
|||
flushinp();
|
||||
}
|
||||
|
||||
static int INPUT_get_ncurses(int timeout)
|
||||
static int INPUT_get_ncurses(int time_out)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (timeout >= 0)
|
||||
timeout(timeout);
|
||||
if (time_out >= 0)
|
||||
timeout(time_out);
|
||||
ret = getch();
|
||||
if (ret == ERR) {
|
||||
/* Had a timeout, the manual doesn't define any errors to
|
||||
happen for wgetch() besides NULL pointer arguments. The
|
||||
only source of ERR is timeout expired. */
|
||||
if (timeout >= 0)
|
||||
if (time_out >= 0)
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (timeout >= 0)
|
||||
if (time_out >= 0)
|
||||
timeout(-1);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ gblib_LTLIBRARIES = gb.pdf.la
|
|||
|
||||
gb_pdf_la_LIBADD = @POPPLER_LIB@
|
||||
gb_pdf_la_LDFLAGS = -module @LD_FLAGS@ @POPPLER_LDFLAGS@
|
||||
gb_pdf_la_CXXFLAGS = $(AM_CXXFLAGS) -std=c++11
|
||||
gb_pdf_la_CPPFLAGS = @POPPLER_INC@
|
||||
|
||||
gb_pdf_la_SOURCES = main.h main.cpp \
|
||||
|
|
|
@ -97,7 +97,7 @@ GB_COMPONENT(
|
|||
dnl ---- We do not use libtool to load shared libraries anymore!
|
||||
|
||||
AC_DEFINE(DONT_USE_LTDL, 1, [Do not use libtool to load shared libraries])
|
||||
if test "$SYSTEM" != "OPENBSD" && test "$SYSTEM" != "FREEBSD"; then
|
||||
if test "$SYSTEM" != "OPENBSD" && test "$SYSTEM" != "FREEBSD" && test "$SYSTEM" != "NETBSD"; then
|
||||
DL_LIB="-ldl"
|
||||
else
|
||||
DL_LIB=""
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_GNU) || defined(OS_OPENBSD) || defined(OS_FREEBSD) || defined(OS_CYGWIN)
|
||||
#ifdef DONT_USE_LTDL
|
||||
#define lt_dlinit() (0)
|
||||
#define lt_dlhandle void *
|
||||
#define lt_dlopenext(_path) dlopen(_path, RTLD_LAZY)
|
||||
|
|
|
@ -2437,7 +2437,7 @@ bool GB_Serialize(const char *path, GB_VALUE *value)
|
|||
|
||||
CATCH_ERROR
|
||||
{
|
||||
STREAM_open(&stream, path, ST_CREATE);
|
||||
STREAM_open(&stream, path, STO_CREATE);
|
||||
STREAM_write_type(&stream, T_VARIANT, (VALUE *)value);
|
||||
STREAM_close(&stream);
|
||||
}
|
||||
|
@ -2450,7 +2450,7 @@ bool GB_UnSerialize(const char *path, GB_VALUE *value)
|
|||
|
||||
CATCH_ERROR
|
||||
{
|
||||
STREAM_open(&stream, path, ST_READ);
|
||||
STREAM_open(&stream, path, STO_READ);
|
||||
STREAM_read_type(&stream, T_VARIANT, (VALUE *)value);
|
||||
STREAM_close(&stream);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pty.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "gb_common.h"
|
||||
|
@ -95,10 +95,10 @@ static void watch_stream(CSTREAM *_object, int mode, bool on)
|
|||
STREAM *stream = &THIS_STREAM->stream;
|
||||
int fd = STREAM_handle(stream);
|
||||
|
||||
if (mode & ST_READ)
|
||||
if (mode & STO_READ)
|
||||
GB_Watch(fd, GB_WATCH_READ, (void *)(on ? callback_read : NULL), (intptr_t)THIS);
|
||||
|
||||
if (mode & ST_WRITE)
|
||||
if (mode & STO_WRITE)
|
||||
GB_Watch(fd, GB_WATCH_WRITE, (void *)(on ? callback_write : NULL), (intptr_t)THIS);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ CFILE *CFILE_create(STREAM *stream, int mode)
|
|||
*CSTREAM_stream(file) = *stream;
|
||||
//file->watch_fd = -1;
|
||||
|
||||
if (mode & ST_WATCH)
|
||||
if (mode & STO_WATCH)
|
||||
{
|
||||
watch_stream(&file->ob, mode, TRUE);
|
||||
OBJECT_attach((OBJECT *)file, OP ? (OBJECT *)OP : (OBJECT *)CP, "File");
|
||||
|
@ -142,9 +142,9 @@ static CFILE *create_default_stream(FILE *file, int mode)
|
|||
|
||||
void CFILE_init(void)
|
||||
{
|
||||
CFILE_in = create_default_stream(stdin, ST_READ);
|
||||
CFILE_out = create_default_stream(stdout, ST_WRITE);
|
||||
CFILE_err = create_default_stream(stderr, ST_WRITE);
|
||||
CFILE_in = create_default_stream(stdin, STO_READ);
|
||||
CFILE_out = create_default_stream(stdout, STO_WRITE);
|
||||
CFILE_err = create_default_stream(stderr, STO_WRITE);
|
||||
}
|
||||
|
||||
void CFILE_exit(void)
|
||||
|
@ -621,7 +621,7 @@ BEGIN_METHOD(File_Load, GB_STRING path)
|
|||
int rlen;
|
||||
char *str = NULL;
|
||||
|
||||
STREAM_open(&stream, STRING_conv_file_name(STRING(path), LENGTH(path)), ST_READ);
|
||||
STREAM_open(&stream, STRING_conv_file_name(STRING(path), LENGTH(path)), STO_READ);
|
||||
|
||||
ON_ERROR_1(error_CFILE_load_save, &stream)
|
||||
{
|
||||
|
@ -665,7 +665,7 @@ BEGIN_METHOD(File_Save, GB_STRING path; GB_STRING data)
|
|||
|
||||
STREAM stream;
|
||||
|
||||
STREAM_open(&stream, STRING_conv_file_name(STRING(path), LENGTH(path)), ST_CREATE);
|
||||
STREAM_open(&stream, STRING_conv_file_name(STRING(path), LENGTH(path)), STO_CREATE);
|
||||
|
||||
ON_ERROR_1(error_CFILE_load_save, &stream)
|
||||
{
|
||||
|
@ -858,9 +858,9 @@ BEGIN_METHOD(Stream_Watch, GB_INTEGER mode; GB_BOOLEAN on)
|
|||
int mode = VARG(mode);
|
||||
|
||||
if (mode == R_OK)
|
||||
mode = ST_READ;
|
||||
mode = STO_READ;
|
||||
else if (mode == W_OK)
|
||||
mode = ST_WRITE;
|
||||
mode = STO_WRITE;
|
||||
else
|
||||
{
|
||||
GB_Error("Unknown watch");
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef OS_FREEBSD
|
||||
#ifdef OS_BSD
|
||||
#undef HAVE_EXP10
|
||||
#endif
|
||||
|
||||
|
|
|
@ -168,19 +168,19 @@ void STREAM_open(STREAM *stream, const char *path, int mode)
|
|||
|
||||
stream->type = NULL;
|
||||
|
||||
if (mode & ST_PIPE)
|
||||
if (mode & STO_PIPE)
|
||||
sclass = &STREAM_pipe;
|
||||
else if (mode & ST_MEMORY)
|
||||
else if (mode & STO_MEMORY)
|
||||
sclass = &STREAM_memory;
|
||||
else if (mode & ST_STRING)
|
||||
else if (mode & STO_STRING)
|
||||
sclass = &STREAM_string;
|
||||
else if (mode & ST_LOCK)
|
||||
else if (mode & STO_LOCK)
|
||||
sclass = &STREAM_lock;
|
||||
else
|
||||
{
|
||||
// ".99" is used for opening a file descriptor in direct mode
|
||||
|
||||
if (FILE_is_relative(path) && !((mode & ST_DIRECT) && path[0] == '.' && isdigit(path[1])))
|
||||
if (FILE_is_relative(path) && !((mode & STO_DIRECT) && path[0] == '.' && isdigit(path[1])))
|
||||
{
|
||||
ARCHIVE *arch = NULL;
|
||||
const char *tpath = path;
|
||||
|
@ -198,7 +198,7 @@ void STREAM_open(STREAM *stream, const char *path, int mode)
|
|||
goto _OPEN;
|
||||
}*/
|
||||
|
||||
if ((mode & ST_ACCESS) != ST_READ || mode & ST_PIPE)
|
||||
if ((mode & STO_ACCESS) != STO_READ || mode & STO_PIPE)
|
||||
THROW(E_ACCESS);
|
||||
|
||||
if (!ARCHIVE_find_from_path(&arch, &tpath))
|
||||
|
@ -210,7 +210,7 @@ void STREAM_open(STREAM *stream, const char *path, int mode)
|
|||
path = tpath;
|
||||
}
|
||||
|
||||
if (mode & ST_DIRECT)
|
||||
if (mode & STO_DIRECT)
|
||||
sclass = &STREAM_direct;
|
||||
else
|
||||
sclass = &STREAM_buffer;
|
||||
|
@ -956,7 +956,7 @@ static STREAM *enter_temp_stream(STREAM *stream)
|
|||
_temp_level = 0;
|
||||
if (_temp_stream.type)
|
||||
STREAM_close(&_temp_stream);
|
||||
STREAM_open(&_temp_stream, NULL, ST_STRING | ST_WRITE);
|
||||
STREAM_open(&_temp_stream, NULL, STO_STRING | STO_WRITE);
|
||||
}
|
||||
|
||||
_temp_level++;
|
||||
|
@ -1549,7 +1549,7 @@ void STREAM_load(const char *path, char **buffer, int *rlen)
|
|||
STREAM stream;
|
||||
int64_t len;
|
||||
|
||||
STREAM_open(&stream, path, ST_READ);
|
||||
STREAM_open(&stream, path, STO_READ);
|
||||
STREAM_lof(&stream, &len);
|
||||
|
||||
if (len >> 31)
|
||||
|
@ -1573,7 +1573,7 @@ bool STREAM_map(const char *path, char **paddr, int *plen)
|
|||
size_t len;
|
||||
bool ret = TRUE;
|
||||
|
||||
STREAM_open(&stream, path, ST_READ + ST_DIRECT);
|
||||
STREAM_open(&stream, path, STO_READ + STO_DIRECT);
|
||||
|
||||
if (stream.type == &STREAM_arch)
|
||||
{
|
||||
|
@ -1807,7 +1807,7 @@ void STREAM_begin(STREAM *stream)
|
|||
if (!stream->common.redirect)
|
||||
{
|
||||
ALLOC_ZERO(&stream->common.redirect, sizeof(STREAM));
|
||||
STREAM_open(stream->common.redirect, NULL, ST_STRING | ST_WRITE);
|
||||
STREAM_open(stream->common.redirect, NULL, STO_STRING | STO_WRITE);
|
||||
}
|
||||
|
||||
stream->common.redirected = TRUE;
|
||||
|
|
|
@ -145,19 +145,19 @@ typedef
|
|||
STREAM;
|
||||
|
||||
enum {
|
||||
ST_READ = (1 << 0),
|
||||
ST_WRITE = (1 << 1),
|
||||
ST_READ_WRITE = ST_READ + ST_WRITE,
|
||||
ST_MODE = 0x3,
|
||||
ST_APPEND = (1 << 2),
|
||||
ST_CREATE = (1 << 3),
|
||||
ST_ACCESS = 0xF,
|
||||
ST_DIRECT = (1 << 4),
|
||||
ST_LOCK = (1 << 5),
|
||||
ST_WATCH = (1 << 6),
|
||||
ST_PIPE = (1 << 7),
|
||||
ST_MEMORY = (1 << 8),
|
||||
ST_STRING = (1 << 9)
|
||||
STO_READ = (1 << 0),
|
||||
STO_WRITE = (1 << 1),
|
||||
STO_READ_WRITE = STO_READ + STO_WRITE,
|
||||
STO_MODE = 0x3,
|
||||
STO_APPEND = (1 << 2),
|
||||
STO_CREATE = (1 << 3),
|
||||
STO_ACCESS = 0xF,
|
||||
STO_DIRECT = (1 << 4),
|
||||
STO_LOCK = (1 << 5),
|
||||
STO_WATCH = (1 << 6),
|
||||
STO_PIPE = (1 << 7),
|
||||
STO_MEMORY = (1 << 8),
|
||||
STO_STRING = (1 << 9)
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -55,7 +55,7 @@ static int stream_open(STREAM *stream, const char *path, int mode)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if ((mode & ST_ACCESS) != ST_READ)
|
||||
if ((mode & STO_ACCESS) != STO_READ)
|
||||
{
|
||||
errno = EACCES;
|
||||
return TRUE;
|
||||
|
|
|
@ -49,11 +49,11 @@ static int stream_open(STREAM *stream, const char *path, int mode)
|
|||
struct stat info;
|
||||
int fd;
|
||||
|
||||
if (mode & ST_CREATE)
|
||||
if (mode & STO_CREATE)
|
||||
fmode = "w+";
|
||||
else if (mode & ST_APPEND)
|
||||
else if (mode & STO_APPEND)
|
||||
fmode = "a+";
|
||||
else if (mode & ST_WRITE)
|
||||
else if (mode & STO_WRITE)
|
||||
fmode = "r+";
|
||||
else
|
||||
fmode = "r";
|
||||
|
|
|
@ -49,24 +49,24 @@ static int stream_open(STREAM *stream, const char *path, int mode)
|
|||
int fmode, omode;
|
||||
VALUE val;
|
||||
|
||||
if (mode & ST_CREATE)
|
||||
if (mode & STO_CREATE)
|
||||
fmode = O_CREAT | O_TRUNC; // | O_EXCL;
|
||||
else if (mode & ST_APPEND)
|
||||
else if (mode & STO_APPEND)
|
||||
fmode = O_APPEND | O_CREAT;
|
||||
else
|
||||
fmode = 0;
|
||||
|
||||
switch (mode & ST_MODE)
|
||||
switch (mode & STO_MODE)
|
||||
{
|
||||
case ST_READ: fmode |= O_RDONLY; break;
|
||||
case ST_WRITE: fmode |= O_WRONLY; break;
|
||||
case ST_READ_WRITE: fmode |= O_RDWR; break;
|
||||
case STO_READ: fmode |= O_RDONLY; break;
|
||||
case STO_WRITE: fmode |= O_WRONLY; break;
|
||||
case STO_READ_WRITE: fmode |= O_RDWR; break;
|
||||
default: fmode |= O_RDONLY;
|
||||
}
|
||||
|
||||
if (path[0] == '.' && isdigit(path[1]))
|
||||
{
|
||||
if ((mode & ST_CREATE) || (mode & ST_APPEND))
|
||||
if ((mode & STO_CREATE) || (mode & STO_APPEND))
|
||||
THROW(E_ACCESS);
|
||||
|
||||
if (NUMBER_from_string(NB_READ_INTEGER, &path[1], strlen(path) - 1, &val) || val._integer.value < 0)
|
||||
|
@ -80,9 +80,9 @@ static int stream_open(STREAM *stream, const char *path, int mode)
|
|||
if (omode < 0)
|
||||
return TRUE;
|
||||
|
||||
if (((mode & ST_MODE) == ST_READ && (omode & O_ACCMODE) == O_WRONLY)
|
||||
|| ((mode & ST_MODE) == ST_WRITE && (omode & O_ACCMODE) == O_RDONLY)
|
||||
|| ((mode & ST_MODE) == ST_READ_WRITE && (omode & O_ACCMODE) != O_RDWR))
|
||||
if (((mode & STO_MODE) == STO_READ && (omode & O_ACCMODE) == O_WRONLY)
|
||||
|| ((mode & STO_MODE) == STO_WRITE && (omode & O_ACCMODE) == O_RDONLY)
|
||||
|| ((mode & STO_MODE) == STO_READ_WRITE && (omode & O_ACCMODE) != O_RDWR))
|
||||
THROW(E_ACCESS);
|
||||
|
||||
stream->direct.watch = TRUE;
|
||||
|
|
|
@ -72,7 +72,7 @@ static int stream_close(STREAM *stream)
|
|||
|
||||
static int stream_read(STREAM *stream, char *buffer, int len)
|
||||
{
|
||||
/*if ((stream->common.mode & ST_READ) == 0)
|
||||
/*if ((stream->common.mode & STO_READ) == 0)
|
||||
THROW(E_ACCESS);*/
|
||||
|
||||
CHECK_enter();
|
||||
|
@ -96,7 +96,7 @@ static int stream_read(STREAM *stream, char *buffer, int len)
|
|||
|
||||
static int stream_write(STREAM *stream, char *buffer, int len)
|
||||
{
|
||||
if ((stream->common.mode & ST_WRITE) == 0)
|
||||
if ((stream->common.mode & STO_WRITE) == 0)
|
||||
THROW(E_ACCESS);
|
||||
|
||||
CHECK_enter();
|
||||
|
|
|
@ -54,11 +54,11 @@ static int stream_open(STREAM *stream, const char *path, int mode)
|
|||
|
||||
fmode = 0;
|
||||
|
||||
switch (mode & ST_MODE)
|
||||
switch (mode & STO_MODE)
|
||||
{
|
||||
case ST_READ: fmode |= O_RDONLY; break;
|
||||
case ST_WRITE: fmode |= O_WRONLY; break;
|
||||
case ST_READ_WRITE: fmode |= O_RDWR; break;
|
||||
case STO_READ: fmode |= O_RDONLY; break;
|
||||
case STO_WRITE: fmode |= O_WRONLY; break;
|
||||
case STO_READ_WRITE: fmode |= O_RDWR; break;
|
||||
default: fmode |= O_RDONLY;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ static int stream_read(STREAM *stream, char *buffer, int len)
|
|||
|
||||
static int stream_write(STREAM *stream, char *buffer, int len)
|
||||
{
|
||||
if ((stream->common.mode & ST_WRITE) == 0)
|
||||
if ((stream->common.mode & STO_WRITE) == 0)
|
||||
THROW(E_ACCESS);
|
||||
|
||||
stream->string.buffer = STRING_add(stream->string.buffer, buffer, len);
|
||||
|
|
|
@ -213,9 +213,9 @@ void SUBR_open(ushort code)
|
|||
else
|
||||
THROW_TYPE(T_POINTER, PARAM->type);
|
||||
|
||||
STREAM_open(&stream, (char *)addr, mode | ST_MEMORY);
|
||||
STREAM_open(&stream, (char *)addr, mode | STO_MEMORY);
|
||||
}
|
||||
else if (mode & ST_STRING)
|
||||
else if (mode & STO_STRING)
|
||||
{
|
||||
char *str;
|
||||
|
||||
|
@ -225,7 +225,7 @@ void SUBR_open(ushort code)
|
|||
{
|
||||
str = SUBR_get_string(PARAM);
|
||||
|
||||
if (mode & ST_WRITE)
|
||||
if (mode & STO_WRITE)
|
||||
{
|
||||
stream.string.buffer = STRING_new(str, STRING_length(str));
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ void SUBR_lock(ushort code)
|
|||
|
||||
for(;;)
|
||||
{
|
||||
STREAM_open(&stream, path, ST_LOCK);
|
||||
STREAM_open(&stream, path, STO_LOCK);
|
||||
|
||||
if (!STREAM_lock_all(&stream) && FILE_exist(path))
|
||||
break;
|
||||
|
@ -1055,7 +1055,7 @@ void SUBR_lock(ushort code)
|
|||
THROW(E_LOCK);
|
||||
}
|
||||
|
||||
file = CFILE_create(&stream, ST_LOCK);
|
||||
file = CFILE_create(&stream, STO_LOCK);
|
||||
OBJECT_put(RETURN, file);
|
||||
SUBR_LEAVE();
|
||||
}
|
||||
|
|
|
@ -157,26 +157,30 @@ IMPLEMENT_TSP(ISTRIP, c_iflag)
|
|||
IMPLEMENT_TSP(INLCR, c_iflag)
|
||||
IMPLEMENT_TSP(IGNCR, c_iflag)
|
||||
IMPLEMENT_TSP(ICRNL, c_iflag)
|
||||
IMPLEMENT_TSP(IUCLC, c_iflag)
|
||||
IMPLEMENT_TSP(IXON, c_iflag)
|
||||
IMPLEMENT_TSP(IXANY, c_iflag)
|
||||
IMPLEMENT_TSP(IXOFF, c_iflag)
|
||||
#ifndef OS_BSD
|
||||
IMPLEMENT_TSP(IUCLC, c_iflag)
|
||||
IMPLEMENT_TSP(IUTF8, c_iflag)
|
||||
|
||||
IMPLEMENT_TSP(OPOST, c_oflag)
|
||||
IMPLEMENT_TSP(OLCUC, c_oflag)
|
||||
IMPLEMENT_TSP(OFILL, c_oflag)
|
||||
#endif
|
||||
IMPLEMENT_TSP(OPOST, c_oflag)
|
||||
IMPLEMENT_TSP(ONLCR, c_oflag)
|
||||
IMPLEMENT_TSP(OCRNL, c_oflag)
|
||||
IMPLEMENT_TSP(ONOCR, c_oflag)
|
||||
IMPLEMENT_TSP(ONLRET, c_oflag)
|
||||
IMPLEMENT_TSP(OFILL, c_oflag)
|
||||
|
||||
#ifndef OS_BSD
|
||||
IMPLEMENT_TSP_I(NLDLY, c_oflag)
|
||||
IMPLEMENT_TSP_I(CRDLY, c_oflag)
|
||||
IMPLEMENT_TSP_I(TABDLY, c_oflag)
|
||||
IMPLEMENT_TSP_I(BSDLY, c_oflag)
|
||||
IMPLEMENT_TSP_I(VTDLY, c_oflag)
|
||||
IMPLEMENT_TSP_I(FFDLY, c_oflag)
|
||||
#endif
|
||||
|
||||
IMPLEMENT_TSP_I(CSIZE, c_cflag)
|
||||
IMPLEMENT_TSP(CSTOPB, c_cflag)
|
||||
|
@ -200,9 +204,11 @@ IMPLEMENT_TSP(NOFLSH, c_lflag)
|
|||
IMPLEMENT_TSP(TOSTOP, c_lflag)
|
||||
IMPLEMENT_TSP(IEXTEN, c_lflag)
|
||||
|
||||
#ifndef OS_CYGWIN
|
||||
#ifdef OS_LINUX
|
||||
IMPLEMENT_TSP(CMSPAR, c_cflag)
|
||||
IMPLEMENT_TSP(XCASE, c_lflag)
|
||||
#endif
|
||||
#ifndef OS_CYGWIN
|
||||
IMPLEMENT_TSP(ECHOPRT, c_lflag)
|
||||
IMPLEMENT_TSP(PENDIN, c_lflag)
|
||||
#endif
|
||||
|
@ -327,15 +333,19 @@ GB_DESC TermDesc[] =
|
|||
__TC(TCIFLUSH), __TC(TCOFLUSH), __TC(TCIOFLUSH),
|
||||
|
||||
__TC(TCIOFF), __TC(TCION), __TC(TCOOFF), __TC(TCOON),
|
||||
|
||||
#ifndef OS_BSD
|
||||
__TC(NL0), __TC(NL1), __TC(CR0), __TC(CR1), __TC(CR2), __TC(CR3), __TC(TAB0), __TC(TAB1), __TC(TAB2), __TC(TAB3), __TC(XTABS), __TC(BS0), __TC(BS1), __TC(VT0), __TC(VT1), __TC(FF0), __TC(FF1),
|
||||
|
||||
#endif
|
||||
__TC(CS5), __TC(CS6), __TC(CS7), __TC(CS8),
|
||||
|
||||
GB_CONSTANT("VDISABLE", "i", _POSIX_VDISABLE),
|
||||
|
||||
__TC(B0), __TC(B50), __TC(B75), __TC(B110), __TC(B134), __TC(B150), __TC(B200), __TC(B300), __TC(B600), __TC(B1200), __TC(B1800), __TC(B2400), __TC(B4800), __TC(B9600), __TC(B19200), __TC(B38400), __TC(B57600), __TC(B115200), __TC(B230400), __TC(B460800), __TC(B500000), __TC(B576000), __TC(B921600), __TC(B1000000), __TC(B1152000), __TC(B1500000), __TC(B2000000), __TC(B2500000), __TC(B3000000),
|
||||
#ifndef OS_CYGWIN
|
||||
__TC(B0), __TC(B50), __TC(B75), __TC(B110), __TC(B134), __TC(B150), __TC(B200), __TC(B300), __TC(B600), __TC(B1200), __TC(B1800), __TC(B2400), __TC(B4800), __TC(B9600), __TC(B19200), __TC(B38400), __TC(B57600), __TC(B115200), __TC(B230400), __TC(B460800),
|
||||
|
||||
#ifndef OS_BSD
|
||||
__TC(B500000), __TC(B576000), __TC(B921600), __TC(B1000000), __TC(B1152000), __TC(B1500000), __TC(B2000000), __TC(B2500000), __TC(B3000000),
|
||||
#endif
|
||||
#ifdef OS_LINUX
|
||||
__TC(B3500000), __TC(B4000000),
|
||||
#endif
|
||||
|
||||
|
@ -359,26 +369,30 @@ GB_DESC TerminalSettingsDesc[] =
|
|||
__TSP(INLCR),
|
||||
__TSP(IGNCR),
|
||||
__TSP(ICRNL),
|
||||
__TSP(IUCLC),
|
||||
__TSP(IXON),
|
||||
__TSP(IXANY),
|
||||
__TSP(IXOFF),
|
||||
#ifndef OS_BSD
|
||||
__TSP(IUCLC),
|
||||
__TSP(IUTF8),
|
||||
|
||||
__TSP(OPOST),
|
||||
|
||||
__TSP(OLCUC),
|
||||
__TSP(OFILL),
|
||||
#endif
|
||||
__TSP(OPOST),
|
||||
__TSP(ONLCR),
|
||||
__TSP(OCRNL),
|
||||
__TSP(ONOCR),
|
||||
__TSP(ONLRET),
|
||||
__TSP(OFILL),
|
||||
|
||||
#ifndef OS_BSD
|
||||
__TSP_I(NLDLY),
|
||||
__TSP_I(CRDLY),
|
||||
__TSP_I(TABDLY),
|
||||
__TSP_I(BSDLY),
|
||||
__TSP_I(VTDLY),
|
||||
__TSP_I(FFDLY),
|
||||
#endif
|
||||
|
||||
__TSP_I(CSIZE),
|
||||
__TSP(CSTOPB),
|
||||
|
@ -402,9 +416,11 @@ GB_DESC TerminalSettingsDesc[] =
|
|||
__TSP(TOSTOP),
|
||||
__TSP(IEXTEN),
|
||||
|
||||
#ifndef OS_CYGWIN
|
||||
#ifdef OS_LINUX
|
||||
__TSP(CMSPAR),
|
||||
__TSP(XCASE),
|
||||
#endif
|
||||
#ifndef OS_CYGWIN
|
||||
__TSP(ECHOPRT),
|
||||
__TSP(PENDIN),
|
||||
#endif
|
||||
|
|
|
@ -39,11 +39,7 @@
|
|||
|
||||
#ifdef PROJECT_EXEC
|
||||
|
||||
#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
|
||||
#include <sys/mount.h>
|
||||
#else
|
||||
#include <sys/statfs.h>
|
||||
#endif
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
|
@ -1003,8 +999,8 @@ void FILE_copy(const char *src, const char *dst)
|
|||
|
||||
TRY
|
||||
{
|
||||
STREAM_open(&stream_src, src, ST_READ);
|
||||
STREAM_open(&stream_dst, dst, ST_CREATE);
|
||||
STREAM_open(&stream_src, src, STO_READ);
|
||||
STREAM_open(&stream_dst, dst, STO_CREATE);
|
||||
|
||||
STREAM_lof(&stream_src, &len);
|
||||
|
||||
|
@ -1082,12 +1078,12 @@ void FILE_link(const char *src, const char *dst)
|
|||
|
||||
int64_t FILE_free(const char *path)
|
||||
{
|
||||
struct statfs info;
|
||||
struct statvfs info;
|
||||
|
||||
if (FILE_is_relative(path))
|
||||
return 0;
|
||||
|
||||
statfs(path, &info);
|
||||
statvfs(path, &info);
|
||||
return (int64_t)(getuid() == 0 ? info.f_bfree : info.f_bavail) * info.f_bsize;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue