mirror of
https://github.com/janet-lang/janet
synced 2025-01-08 06:30:28 +00:00
Move <fcntl.h> header to general imports
This commit is contained in:
parent
91bb34c3bf
commit
268ff666d2
@ -32,6 +32,7 @@
|
|||||||
#ifdef JANET_EV
|
#ifdef JANET_EV
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -44,7 +45,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
@ -3293,7 +3293,7 @@ static JanetFile *get_file_for_stream(JanetStream *stream) {
|
|||||||
}
|
}
|
||||||
if (index == 0) return NULL;
|
if (index == 0) return NULL;
|
||||||
/* duplicate handle when converting stream to file */
|
/* duplicate handle when converting stream to file */
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
int htype = 0;
|
int htype = 0;
|
||||||
if (fmt[0] == 'r' && fmt[1] == '+') {
|
if (fmt[0] == 'r' && fmt[1] == '+') {
|
||||||
htype = _O_RDWR;
|
htype = _O_RDWR;
|
||||||
@ -3312,7 +3312,7 @@ static JanetFile *get_file_for_stream(JanetStream *stream) {
|
|||||||
/* _close(fd); */
|
/* _close(fd); */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int newHandle = dup(stream->handle);
|
int newHandle = dup(stream->handle);
|
||||||
if (newHandle < 0) return NULL;
|
if (newHandle < 0) return NULL;
|
||||||
FILE *f = fdopen(newHandle, fmt);
|
FILE *f = fdopen(newHandle, fmt);
|
||||||
@ -3320,7 +3320,7 @@ static JanetFile *get_file_for_stream(JanetStream *stream) {
|
|||||||
close(newHandle);
|
close(newHandle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return janet_makejfile(f, flags);
|
return janet_makejfile(f, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user