Displaying 7 results from an estimated 7 matches for "lua_pushstring".
2012 Sep 19
1
[PATCH 1/1] lua: Cleaned up the dmi table structure in Lua.c32 and added all missing DMI subtables
...44
--- a/com32/lua/src/cpu.c
+++ b/com32/lua/src/cpu.c
@@ -9,13 +9,13 @@
#include"lualib.h"
#include"cpuid.h"
-static void add_string_item(lua_State *L, const char *item, const char
*value_str) {
+void add_string_item(lua_State *L, const char *item, const char
*value_str) {
lua_pushstring(L,item);
lua_pushstring(L,value_str);
lua_settable(L,-3);
}
-static void add_int_item(lua_State *L, const char *item, int value_int) {
+void add_int_item(lua_State *L, const char *item, int value_int) {
lua_pushstring(L,item);
lua_pushnumber(L,value_int);
lua_settable(L,-3);
diff --git...
2011 Oct 04
1
Added DHCPINFO Tables to the lua.c32 Implementation - syslinux-4.04
...te File field in BOOTP
message */
+
+void
+ip_address_list(lua_State *L, uint8_t* value, uint8_t len, uint8_t option )
+{
+ static char op_name[64];
+ static char op_value[255];
+ int loop;
+
+ loop = len/4;
+
+ if ( loop == 1) {
+ sprintf(op_name, "%u", option);
+ lua_pushstring(L, op_name);
+ sprintf(op_value, "%u.%u.%u.%u", value[0], value[1], value[2],
value[3]);
+ lua_pushstring(L, op_value);
+ lua_settable(L,-3);
+ } else {
+ for (int done = 0; done < loop; done++){
+ sprintf(op_name, "%u.%d", option, done+1);
+ lua_pushstri...
2013 Oct 03
0
Automatic boot menu?
...y, it returns nil
+** and a string describing the error
+*/
+static int get_dir (lua_State *L) {
+ char *path;
+ /* Passing (NULL, 0) is not guaranteed to work. Use a temp buffer and size instead. */
+ char buf[PATH_MAX];
+ if ((path = getcwd(buf, PATH_MAX)) == NULL) {
+ lua_pushnil(L);
+ lua_pushstring(L, strerror(errno));
+ return 2;
+ }
+ else {
+ lua_pushstring(L, path);
+ return 1;
+ }
+}
+
+
+/*
+** Directory iterator
+*/
+static int dir_iter (lua_State *L) {
+ struct dirent *entry;
+ dir_data *d = (dir_data *)luaL_checkudata (L, 1, DIR_METATABLE);
+ luaL_arg...
2013 Aug 30
2
Automatic boot menu?
"H. Peter Anvin" <hpa at zytor.com> writes:
> On 08/29/2013 04:14 AM, Ferenc Wagner wrote:
>
>> "H. Peter Anvin" <hpa at zytor.com> writes:
>>
>>> On 08/22/2013 10:20 AM, Ferenc Wagner wrote:
>>>
>>>> Now that Syslinux has ls.c32 and lua.c32, it should be possible to build
>>>> a customizable boot menu in
2014 Nov 28
2
[PATCH] Add ldisk.c32 Lua module
...lt;disk/mbrs.h>
+#include <disk/msdos.h>
+#include <disk/partition.h>
+#include <disk/swsusp.h>
+#include <disk/read.h>
+
+#include "lua.h"
+#include "lauxlib.h"
+#include "lualib.h"
+
+#define SET_TABLE_STRING_INT(state, key, value) do {\
+ lua_pushstring((state), (key));\
+ lua_pushinteger((state), (value));\
+ lua_settable((state), -3);\
+} while(0);
+
+#define SET_TABLE_STRING_STRING(state, key, value) do {\
+ lua_pushstring((state), (key));\
+ lua_pushstring((state), (const char*) (value));\
+ lua_settable((state), -3);\
+} while(0);
+
+sta...
2013 Oct 15
23
[PATCH 00/21] Upgrade to Lua 5.2.2, add filesystem module and get_key binding
Hi,
This series targets automatic boot menu generation, but most of it
is the Lua upgrade, because I got tired reading deprecated API docs.
It's mostly a straightforward forward port of the earlier Syslinux
specific changes to Lua 5.1, except that:
* I chose the add a stub getenv() implementation to the COM32 API
instead of #ifdefing out all the references in Lua, and
* I kept oslib
2018 Jan 22
2
[PATCH] lua, perl: Use thread-safe strerror_r instead of strerror (RHBZ#1536763).
...*L)
lua_gettable (L, 1);
msg = luaL_checkstring (L, -1);
- if (code)
- lua_pushfstring (L, \"%%s: %%s\", msg, strerror (code));
+ if (code) {
+ ignore_value (strerror_r (code, err, sizeof err));
+ lua_pushfstring (L, \"%%s: %%s\", msg, err);
+ }
else
lua_pushstring (L, msg);
@@ -640,11 +647,12 @@ get_string_list (lua_State *L, int index)
const size_t len = lua_objlen (L, index);
size_t i;
char **strs;
+ char err[128];
strs = malloc ((len+1) * sizeof (char *));
if (strs == NULL) {
- luaL_error (L, \"get_string_list: malloc failed: %...