On 16 March 2010 08:01, Élie Roux <[email protected]> wrote:
>
> I just thought about something: in a script we need to detect if,
> under windows, luatex is run under cygwin or not (cygwin and
> non-cygwin are the same binary for me). Currently we do something like

I'm not sure if I understand you correctly.  I've just checked cygwin
binaries and they are are different from the win32 ones we ship.  Do
you mean that the cygwin binaries can be run in two modes: under
cygwin and under native windows? That would be strange, but then again
I don't know enough about cygwin to tell.

> local system = io.popen("uname -s"):read("*l")
> if system then
>    if system:match("^CYGWIN") then
>        system = 'cygwin'
>    end
> end
>
> but having os.type == 'cygwin' as a condition would be cleaner... The
> thing is the check must be done at runtime, and I don't know anything
> about the Windows API nor compilation under cygwin/mingw...
>
> Tomek, would you know how to patch LuaTeX to do that?

Would Taco's suggestion with os.uname() work for you?

>From what I see patching luatex should be straightforward, the relevant file 
>is:

  trunk\source\texk\web2c\luatexdir\lua\loslibext.c

which have defines:

  OS_PLATTYPE => os.type
  OS_PLATNAME => os.name

All I need to know is what symbol to test to distinguish between
windows and cygwin and how cygwin should identify itself (os.type =
'unix', os.name = 'cygwin'?). Note that os.type only gives the three
basic types: 'msdos', 'windows' and 'unix', it is os.name that
diffrentiates further. Note also that this is a compile time decision,
i.e. the same binary will always identify itself in the same way
(similarly with os.uname). I'm not sure if this is what you want,
though.

Cheers,

Tomek
_______________________________________________
dev-luatex mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to