lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


 >> > wrote:
 >>  >> http://lua-users.org/wiki/AlternativeGetOpt
 >>  >> doesn't look good too.
 >> 
 >> > looks clean to me.  what's bad with this?
 >> 
 >> 1) This code is not versioned. I'd prefer to use code
 >>    registered somewhere as a separate project, e.g. luaforge.
 >>    I'd like to package getopt for pkgsrc (www.pkgsrc.org)

> Put it in a version control system, then >:)
No, thanks :-) This is not my code.
I just thought that such a basic module is already implemented
and widely accepted by LUA community.

 >> This code doesn't do what I need and is not compatible with SUS/POSIX.

> Where does POSIX define command line option parsing?

http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
http://www.opengroup.org/onlinepubs/009695399/functions/getopt.html

> Have you considered just writing a little C code to bind the C
> library's getopt?
It trivial to implement getopt_long in LUA. I did it for AWK some time
ago, ~150 lines of code. Also the problem with C code is that
getopt_long(3) is not available on Solaris/HP-UX and some
others. getopt_long(3) is not portable.

-- 
Best regards, Aleksey Cheusov.