VirtualBox

Changeset 2637 in kBuild


Ignore:
Timestamp:
Sep 9, 2012 1:46:16 AM (13 years ago)
Author:
bird
Message:

kash: Simplified that 'Path' hack on Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/var.c

    r2552 r2637  
    6969#endif
    7070
    71 #if defined(_MSC_VER) || defined(_WIN32)
    72     /* On Windows the PATH variable is called "Path". */
    73 # define PC_MIXED_PATH_VAR_NAME
    74 #endif
    75 
    7671
    7772
     
    364359        int nlen;
    365360
     361fprintf(stderr, "debug: setvareq '%s'\n", s);
     362#if defined(_MSC_VER) || defined(_WIN32)
     363        /* On Windows PATH is often spelled 'Path', correct this here.  */
     364        if (   s[0] == 'P'
     365            && s[1] == 'a'
     366            && s[2] == 't'
     367            && s[3] == 'h'
     368            && (s[4] == '\0' || s[4] == '=') ) {
     369                s[1] = 'A';
     370                s[2] = 'T';
     371                s[3] = 'H';
     372fprintf(stderr, "debug: setvareq '%s' FIXED\n", s);
     373        }
     374#endif
     375
    366376        if (aflag(psh))
    367377                flags |= VEXPORT;
     
    400410        if (flags & VNOSET)
    401411                return;
    402 
    403 #ifdef PC_MIXED_PATH_VAR_NAME
    404     if (   nlen == 4
    405         && (s[0] == 'p' || s[0] == 'P')
    406         && (s[1] == 'a' || s[1] == 'A')
    407         && (s[2] == 't' || s[2] == 'T')
    408         && (s[3] == 'h' || s[3] == 'H') ) {
    409         s[0] = 'P';
    410         s[1] = 'A';
    411         s[2] = 'T';
    412         s[3] = 'H';
    413     }
    414 #endif
    415412
    416413        vp = ckmalloc(psh, sizeof (*vp));
     
    928925        len = (int)(p - name);
    929926
    930 #ifdef PC_MIXED_PATH_VAR_NAME
    931     /* On Windows the PATH variable is called "Path". */
    932     if (   len == 4
    933         && (name[0] == 'p' || name[0] == 'P')
    934         && (name[1] == 'a' || name[1] == 'A')
    935         && (name[2] == 't' || name[2] == 'T')
    936         && (name[3] == 'h' || name[3] == 'H') )
    937     {
    938         name = "PATH";
    939                 hashval = (unsigned char)'P';
    940                 hashval = hashval * 2 + (unsigned char)'A';
    941                 hashval = hashval * 2 + (unsigned char)'T';
    942                 hashval = hashval * 2 + (unsigned char)'H';
    943     }
    944 #endif
    945 
    946927        if (lenp)
    947928                *lenp = len;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette