VirtualBox

Changeset 601 in kBuild for trunk/src/gmake/kmkbuiltin/mkdir.c


Ignore:
Timestamp:
Nov 26, 2006 12:19:19 AM (18 years ago)
Author:
bird
Message:

o Added rmdir as builtin and external command.
o Made mkdir not modify the argument strings.
o Made mkdir deal properly with DOS slashes on OS/2 and Windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/kmkbuiltin/mkdir.c

    r557 r601  
    5858#else
    5959#include "mscfakes.h"
     60#include <malloc.h>
    6061#endif
    6162
     
    161162        char *p;
    162163
     164        const size_t len = strlen(path);
     165        p = alloca(len + 1);
     166        path = memcpy(p, path, len + 1);
     167
     168#if defined(_MSC_VER) || defined(__EMX__)
     169        p = strchr(path, '\\');
     170        while (p) {
     171                *p++ = '/';
     172                p = strchr(p, '\\');
     173        }
     174#endif
     175
    163176        p = path;
    164177        oumask = 0;
    165178        retval = 0;
    166179#if defined(_MSC_VER) || defined(__EMX__)
    167         if (    (    (p[0] >= 'A' && p[0] <= 'Z')
    168                  ||  (p[0] >= 'a' && p[0] <= 'z'))
    169             && p[1] == ':')
    170             p += 2;
    171         else if (   (p[0] == '/' || p[0] == '\\')
    172                  && (p[1] == '/' || p[1] == '\\')
    173                  && (p[2] != '/' && p[2] != '\\'))
    174         {
    175             char *p2;
    176             p += 2;
    177             p2 = strpbrk(p, "\\/");
    178             if (p2)
    179                 p = p2 + 1;
    180         }
     180        if (    (    (p[0] >= 'A' && p[0] <= 'Z')
     181                 ||  (p[0] >= 'a' && p[0] <= 'z'))
     182            && p[1] == ':')
     183                p += 2;
     184        else if (   p[0] == '/'
     185                 && p[1] == '/'
     186                 && p[2] != '/')
     187        {
     188                char *p2;
     189                p += 2;
     190                p2 = strchr(p, '/');
     191                if (p2)
     192                        p = p2 + 1;
     193        }
    181194#endif
    182195        if (p[0] == '/')                /* Skip leading '/'. */
Note: See TracChangeset for help on using the changeset viewer.

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