Compare commits
2 Commits
release-v4
...
release-v4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a96023ced1 | ||
|
|
1908d9bbbb |
25
src/shell.c
25
src/shell.c
@@ -3,10 +3,6 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
|
||||||
#else
|
|
||||||
#include "../external/linenoise/linenoise.h"
|
|
||||||
#endif
|
|
||||||
#include "./lexer/lexer.h"
|
#include "./lexer/lexer.h"
|
||||||
#include "./runtime/call/call.h"
|
#include "./runtime/call/call.h"
|
||||||
#include "./runtime/objects/functions/functions.h"
|
#include "./runtime/objects/functions/functions.h"
|
||||||
@@ -22,6 +18,27 @@
|
|||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
FILE *fmemopen(void *buf, size_t size, const char *mode) {
|
||||||
|
if (strchr(mode, 'r') == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE *tmp = tmpfile();
|
||||||
|
if (!tmp) return NULL;
|
||||||
|
|
||||||
|
if (fwrite(buf, 1, size, tmp) != size) {
|
||||||
|
fclose(tmp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
rewind(tmp);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#include "../external/linenoise/linenoise.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
volatile sig_atomic_t interrupted = 0;
|
volatile sig_atomic_t interrupted = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user