external/lua: update to Lua 5.4.7
Update the version of Lua included with Callisto to Lua 5.4.7. Re-generate patches to apply cleanly on top of Lua 5.4.7 sources. Fixes: https://todo.sr.ht/~jeremy/callisto/8
This commit is contained in:
parent
045cb437ba
commit
cdae936548
33 changed files with 371 additions and 266 deletions
55
external/lua/patches/lua-5.4.7-iolib-istty.diff
vendored
Normal file
55
external/lua/patches/lua-5.4.7-iolib-istty.diff
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
--- liolib.c
|
||||
+++ liolib.c
|
||||
@@ -4,6 +4,12 @@
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
+/***
|
||||
+ * Input and output facilities.
|
||||
+ *
|
||||
+ * @module io
|
||||
+ */
|
||||
+
|
||||
#define liolib_c
|
||||
#define LUA_LIB
|
||||
|
||||
@@ -16,6 +22,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
@@ -732,6 +739,23 @@
|
||||
return luaL_fileresult(L, res == 0, NULL);
|
||||
}
|
||||
|
||||
+/***
|
||||
+ * Returns whether the stream points to a valid TTY device.
|
||||
+ *
|
||||
+ * @function file:istty
|
||||
+ * @usage
|
||||
+local f = io.open("/etc/fstab", 'r');
|
||||
+-- a regular file will never be a TTY device
|
||||
+assert(not f:istty())
|
||||
+-- stdin, stdout and stderr can often be TTYs
|
||||
+print(io.stdout:istty())
|
||||
+ */
|
||||
+static int f_istty (lua_State *L) {
|
||||
+ int fd = fileno(tofile(L));
|
||||
+ lua_pushboolean(L, isatty(fd));
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
static int io_flush (lua_State *L) {
|
||||
@@ -778,6 +802,7 @@
|
||||
{"seek", f_seek},
|
||||
{"close", f_close},
|
||||
{"setvbuf", f_setvbuf},
|
||||
+ {"istty", f_istty},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue