|
Reuben Thomas wrote:
On Fri, 30 Jan 2004, Jay Carlson wrote:On Fri, 30 Jan 2004, Jay Carlson wrote:On Wed, 28 Jan 2004, Reuben Thomas wrote:This is the main objection to what I propose above. What can't you do conveniently with exec and glob?Oh right, I forgot: f = os.popen("mipsel-linux-objdump --syms --section="..section.. " --start-address="..hex(start).." "..objfilename) for l in f:lines() do _, _, etc = string.find(l, "^(%x%x%x%x%x%x%x%x) [^l] ...") ... end
What's wrong with pipe, fork and exec? (With a simplifying wrapper, obviously.)
To make things clearer, what I claim to want to write there is: f = myos.popen("mipsel-linux-objdump", "--syms", "--section="..section, "--start-address="..hex(start), objfilename)Right now, external libraries can't create file handles. So if I write an external popen(argv, env), I have to duplicate the infrastructure in liolib.c. The only way I can write myos.popen is in terms of the existing io functions, building a complicated command line for io.popen.
Hey, Lua maintainers: this could be a fix for it: liolib.c: int luaIO_filecreate(lua_State *L, FILE *f) { FILE **pf = newfile(L); *pf = f; return 1; }This also lets me easily write stuff like fdopen, which is not ANSI C, but widely supported, even outside POSIX.
Jay