[syslinux] Lua.c32 - user input / scripting

e h ehouston3 at yahoo.com
Tue May 17 05:21:36 PDT 2011



>>>>> On 05/11/2011 06:15 AM, e h wrote:
>>>>>  I think the issue may be in "/lua/src/liolib.c" I saw a 
>> lot of commented out
>>>>>  io_read and other read related functions.  I'm guessing they 
>> weren't working
>>>>  properly.
>> 
>>>> Reads should work... that's really odd.
>> 
>  >>-hpa
> 
> Unless, I'm doing something wrong... I have a usb key formatted with 
> syslinux-4.04. 
> 
> a section of my syslinux.cfg:
> 
> LABEL Lenovo_Lua
>     MENU LABEL Lenovo Lua Script
>     KERNEL LUA.C32
>       APPEND /lua/test/table.lua
> 
> LABEL LUA
>       MENU LABEL  Lua
>     COM32 LUA.C32
> -----------------------------------------
> Whether I load just the LUA.C32 interpreter or if I load it with a script 
> ("table.lua") or my own ("lenovo.lua") the read portions of 
> the scripts error out.
> 
> ---start of Table.lua:- /lua/test/table.lua -------
> 
> -- make table, grouping all data for the same item
> -- input is 2 columns (item, data)
> 
> local A
> while 1 do
>  local l=io.read()
>  if l==nil then break end
>  local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$')
>  if a~=A then A=a io.write("\n",a,":") end
>  io.write(" ",b)
> end
> io.write("\n")
> ---------end of  table.lua file ------
> 
> -----start of Lenovo.lua -  /lenovo/lenovo.lua ----
> print("Enter the 4-digit Machine Type :")
> mt=io.read()
> print ("you Entered "..mt)
> 
> ------end of file ------
> 
> When run inside my vm with the Lua interpreter installed i get the following 
> output:
> ---start of output----
> Please Enter the 4-digit Machine Type:
> 4848
> You Entered 4848
> ---end of output----
> 
> When run with the usb key using the Lua.c32 module i get the following output:
> ---start of output----
> Enter the 4-digit machine type :
> LUA.C32: /lenovo/lenovo.lua:2: attempt to call field 'read' (a nil 
> value)
> stack traceback:
> /lenovo/lenovo.lua:2: in main chunk
> [C]: ?
> boot:
> ---- end of output-----
> --- table.lua output using lua.c32 on usbkey----
> lua.c32: /lua/test/table.lua:6: attempt to call field 'read' (a nil 
> value)
> stack traceback:
> /lua/test/table.lua:6: in main chunk
> [C]: ?
> boot:
> ---end of table.lua output---
> 
> 
> Thanks for the responses,
> ps..forgive me if the posting format is wrong, trying...
> EH
>

I noticed that once I removed the "#ifndef syslinux/ #endif" blocks the "liolib.c" code compiled with warnings regarding several of the functions (fscanf, ungetc, clearerr, etc..)  These appear to be normally located in "stdio.h"  I compared the "stdio.h" in my /usr/.../include directory to the one in the /com32/.../include directory.  These functions aren't defined in the stdio in the /com32 directory.  I did see some functions that looked similar?  I may just be able to modify "liolib.c" to reference the actual functions in the /com32/.../include/stdio.h


Regards,

EH





More information about the Syslinux mailing list