>>>>> "Henning" == Henning Makholm <[EMAIL PROTECTED]> writes:

    Henning> Which, however, will not stop the code from dying
    Henning> horribly if $LANG does not contain an underscore (see
    Henning> /usr/share/locale/locale.alias), or if it contains an
    Henning> underscore that comes so late that there is no room for
    Henning> the LONG_TEXT_FILE string.

    Henning> (It does prevent executing arbitrary code taken from the
    Henning> environment variable _instead_ of dying horribly).

Not tested, other solutions also possible, but my point is developing
solutions shouldn't be hard:

--- cut ---
        FILE * fd=NULL;

        if(getenv("LANG"))
        {
                memset(lang,'\0',sizeof(lang));
                strncpy(getenv("LANG"),lang,sizeof(lang)-1);
                ptr=strchr(lang,"_");
                if (ptr) *ptr='\0';

                memset(buffer,'\0',sizeof(buffer));
                
snprintf(buffer,sizeof(buffer)-1,"txt/%s_%s",getenv("LANG"),LONG_TXT_FILE);
--- cut ---

-- 
Brian May <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to