On 20 Aug 1999 22:58:50 +0900, [EMAIL PROTECTED] wrote:

>"Arnd Hanses" <[EMAIL PROTECTED]> wrote:
>
>> For this purpose I wrote an experimental os2init() routine, that I
>> would like to move eventually to emxOS2Compat.C. Those routines (for
>> now) are used only once in main.C, so they could become 'static' (no
>> more name-space pollution), if conditionally '#include'd there.
>> (other systems might test with configure and use similar hacks). They
>> set the global flag, whether to use BOURNE or CMD shell syntax:
>
>I don't see the purpose of the code at all.
>
>>       inline extern
>> void os2_init(int &argc, char **argv) {
>>       char *sh = getenv("EMXSHELL");
>>       _nls_init();                            /* only paranoia */
>
>As clearly mentioned in emx library reference you have cited, you
>don't have to call _nls_init() yourself.

/* only paranoia */ ;)

The automatic check was introduced in a more or less recent emx fix.
There are supposedly still emx libraries installed where the init() is
necessary. Moreover it won't hurt and shows the reader of the code how
the nls support works... Making the code transparent even for non-emx
programmers was my main intention here.

>
>>       _wildcard(&argc, &argv); /* if you don't use 'sh' for globbing
>> */
>>       if (!(sh))      {
>>               sh = getenv("COMSPEC");
>>               if (!(sh)) sh = "cmd.exe"; /* shouldn't happen */
>>       }
>>       sh = (char*)_nls_strlwr((unsigned char*)_getname(sh));
>>       if ( !(strcmp(sh, "cmd.exe")) || !(strcmp(sh, "4os2.exe")) )
>>               os2Detach=true;
>> }
>
>Why do we have to put this here???  The name of the shell is necessary
>only when you are going to run child from the shell. 

Yes. 

>So it is best
>to be leaved where it belongs.

This is a question of taste and coding style: Now LyX checks every time
when a child is run. A global flag saves those checks.

Instead of hiding OS-specific initialization, as much as possible
should be done one time only at a central place. Imagine LyX suppport
of a larger number of non-POSIX systems (WIN, BEOS, OS2-no-emx, Apple,
etc.): 
Instead of chasing through the code for dozends or hundreds of
different places with POSIX-dependencies a porter should be able to
configure or enhance a centralized OS-support hook. 

One might call this OS-toolkit independence. Just an idea, you might
call it haretic, but guess it is possible and not too difficult to
implement.

Regards,

        Arnd Hanses

Reply via email to