Changeset 3918


Ignore:
Timestamp:
Oct 24, 2014, 10:08:32 PM (11 years ago)
Author:
bird
Message:

trunk: fs.c,pathrewrite.c: Do a better job with trailing slashes on UNIXROOT env var, allow just a drive letter too. Straightened out a couple of style/doc issues in pathrewrite.c.

Location:
trunk/libc/src/kNIX/os2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/os2/fs-os2.c

    r3914 r3918  
    271271            && ((psz[0] >= 'A' && psz[0] <= 'Z') || (psz[0] >= 'a' && psz[0] <= 'z'))
    272272            && psz[1] == ':'
    273             && (psz[2] == '\\' || psz[2] == '/')
     273            && (psz[2] == '\\' || psz[2] == '/' || psz[2] == '\0')
    274274            )
    275275        {
     
    287287                __libc_gszUnixRoot[0] -= 'a' - 'A';
    288288
    289             size_t off = cch;
    290             while (off-- > 0)
    291                 if (__libc_gszUnixRoot[off] == '\\')
    292                     __libc_gszUnixRoot[off] = '/';
     289            if (cch == 2)
     290            {
     291                __libc_gszUnixRoot[cch++] = '/';
     292                __libc_gszUnixRoot[cch] = '\0';
     293            }
     294            else
     295            {
     296                size_t off = cch;
     297                while (off-- > 0)
     298                    if (__libc_gszUnixRoot[off] == '\\')
     299                        __libc_gszUnixRoot[off] = '/';
     300
     301                while (cch > 3 && __libc_gszUnixRoot[cch - 1] == '/')
     302                    __libc_gszUnixRoot[--cch] = '\0';
     303            }
    293304
    294305            /* Register the rewrite rule. */
  • trunk/libc/src/kNIX/os2/pathrewrite.c

    r3862 r3918  
    650650        while ((ch = *pszEnd) && ch != '/' && ch != '\\')
    651651            pszEnd++;
    652         cch    = pszEnd - psz;
     652        cch    = (unsigned)(pszEnd - psz);
    653653        if (cch > 255)
    654654        {
     
    697697                continue;
    698698            }
    699             else
    700             {
    701                 /*
     699
     700            /*
    702701                 * Complete match. We're done!
    703702                 */
     
    718717                }
    719718                /* not a match, the directory wasn't rewritten, quit searching. */
    720             }
    721719        }
    722720        /* no match, we're done. */
Note: See TracChangeset for help on using the changeset viewer.