Hi, Arthur and Taco
On 5/22/08, Arthur Reutenauer
No; instead of (uname(&uts)) it should be (uname(&uts) < 0) .
Well, no: if the function fails on Linux and returns, say, 1, this test wouldn't catch it. But Taco knows what to do, and the discussion is getting even more off-topic :-)
No, It wont. In Linux/FreeBSD/Mac OS X, -1 will return if it failed. I am pretty sure about that because I read the manual pages of these operating systems yesterday. Again, see the Open Group Specification, (all the Unix and Unix like operating system should follow the Open Group Specification or otherwise it cannot be called Unix or Unix like. There is no need for us to pay attention to the non-Unix(like) systems apart from Windows.): http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/utsname.h.html The return value section: A NON-NEGATIVE VALUE shall be returned. Otherwise -1 should be returned and set errono to indicate an error. so we should better write our program like this: if (uname(&uts)<0) { /*or we can also say if uname(&uts)==-1*/ puts("uname() failed"); } Here Taco, as I said yesterday, there is no need to leave a #ifdef for the solaris operating system. Just remove all the jungles and remain only one #ifdef for Windows system, and leave the rest time to spend a good weekend:)
Because I do not want to alter the lua return values, that means I will have to interpret the contents of the returned structure a bit.
I think it is better to only return a table while calling the Lua function. The table contains key=value pairs for {sysname=,nodename=,release=, version=,machine=}. For Windows, you just fill these names by hand instead(easy, isn't it?). Keep the problem small and simple, as well as flexible, and leave everything toplevel for higher programs like ConTeXt. LuaTeX is going public in months, so before that every major API change is OK to the developers. After public, changing APIs will make other developers unhappy. Yue Wang