From f361830cb2a8aae21c5c6629064b8325ed9ded57 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Mon, 30 Dec 2019 20:24:40 -0500 Subject: [PATCH] Update feature test macro in line.c --- src/core/io.c | 6 +++--- src/mainclient/line.c | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/io.c b/src/core/io.c index d3c38c76..2f164ae8 100644 --- a/src/core/io.c +++ b/src/core/io.c @@ -142,8 +142,8 @@ static Janet cfun_io_temp(int32_t argc, Janet *argv) { janet_fixarity(argc, 0); FILE *tmp = tmpfile(); if (!tmp) - janet_panicf("unable to create temporary file - %s", strerror(errno)); - return janet_makefile(tmp, JANET_FILE_WRITE|JANET_FILE_READ|JANET_FILE_BINARY); + janet_panicf("unable to create temporary file - %s", strerror(errno)); + return janet_makefile(tmp, JANET_FILE_WRITE | JANET_FILE_READ | JANET_FILE_BINARY); } static Janet cfun_io_fopen(int32_t argc, Janet *argv) { @@ -577,7 +577,7 @@ static const JanetReg io_cfuns[] = { JDOC("(eprinf fmt & xs)\n\n" "Like eprintf but with no trailing newline.") }, - { + { "file/temp", cfun_io_temp, JDOC("(file/temp)\n\n" "Open an anonymous temporary file that is removed on close." diff --git a/src/mainclient/line.c b/src/mainclient/line.c index e6b27816..e0cf252b 100644 --- a/src/mainclient/line.c +++ b/src/mainclient/line.c @@ -20,6 +20,10 @@ * IN THE SOFTWARE. */ +#if !defined(_POSIX_C_SOURCE) +#define _POSIX_C_SOURCE 200112L +#endif + #ifndef JANET_AMALG #include "line.h" #endif