Commit 60b3db6b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

cmd: Use _wsplitpath() from msvcrt.

parent c3fac6e3
...@@ -301,58 +301,6 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) ...@@ -301,58 +301,6 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
return buf; return buf;
} }
/* WCMD_splitpath - copied from winefile as no obvious way to use it otherwise */
void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext)
{
const WCHAR* end; /* end of processed string */
const WCHAR* p; /* search pointer */
const WCHAR* s; /* copy pointer */
/* extract drive name */
if (path[0] && path[1]==':') {
if (drv) {
*drv++ = *path++;
*drv++ = *path++;
*drv = '\0';
}
} else if (drv)
*drv = '\0';
end = path + lstrlenW(path);
/* search for begin of file extension */
for(p=end; p>path && *--p!='\\' && *p!='/'; )
if (*p == '.') {
end = p;
break;
}
if (ext)
for(s=end; (*ext=*s++); )
ext++;
/* search for end of directory name */
for(p=end; p>path; )
if (*--p=='\\' || *p=='/') {
p++;
break;
}
if (name) {
for(s=p; s<end; )
*name++ = *s++;
*name = '\0';
}
if (dir) {
for(s=path; s<p; )
*dir++ = *s++;
*dir = '\0';
}
}
/**************************************************************************** /****************************************************************************
* WCMD_HandleTildaModifiers * WCMD_HandleTildaModifiers
* *
...@@ -627,7 +575,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute) ...@@ -627,7 +575,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
BOOL addSpace = (finaloutput[0] != 0x00); BOOL addSpace = (finaloutput[0] != 0x00);
/* Split into components */ /* Split into components */
WCMD_splitpath(fullfilename, drive, dir, fname, ext); _wsplitpath(fullfilename, drive, dir, fname, ext);
/* 5. Handle 'd' : Drive Letter */ /* 5. Handle 'd' : Drive Letter */
if (wmemchr(firstModifier, 'd', modifierLen) != NULL) { if (wmemchr(firstModifier, 'd', modifierLen) != NULL) {
......
...@@ -1217,7 +1217,7 @@ static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted) ...@@ -1217,7 +1217,7 @@ static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted)
/* Convert path into actual directory spec */ /* Convert path into actual directory spec */
GetFullPathNameW(filename, ARRAY_SIZE(fpath), fpath, NULL); GetFullPathNameW(filename, ARRAY_SIZE(fpath), fpath, NULL);
WCMD_splitpath(fpath, drive, dir, fname, ext); _wsplitpath(fpath, drive, dir, fname, ext);
/* Only prompt for * and *.*, not *a, a*, *.a* etc */ /* Only prompt for * and *.*, not *a, a*, *.a* etc */
if ((lstrcmpW(fname, starW) == 0) && if ((lstrcmpW(fname, starW) == 0) &&
...@@ -1352,7 +1352,7 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) { ...@@ -1352,7 +1352,7 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
/* Convert path into actual directory spec */ /* Convert path into actual directory spec */
GetFullPathNameW(argCopy, ARRAY_SIZE(thisDir), thisDir, NULL); GetFullPathNameW(argCopy, ARRAY_SIZE(thisDir), thisDir, NULL);
WCMD_splitpath(thisDir, drive, dir, fname, ext); _wsplitpath(thisDir, drive, dir, fname, ext);
lstrcpyW(thisDir, drive); lstrcpyW(thisDir, drive);
lstrcatW(thisDir, dir); lstrcatW(thisDir, dir);
...@@ -2986,7 +2986,7 @@ void WCMD_move (void) ...@@ -2986,7 +2986,7 @@ void WCMD_move (void)
wine_dbgstr_w(param1), wine_dbgstr_w(output)); wine_dbgstr_w(param1), wine_dbgstr_w(output));
/* Split into components */ /* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext); _wsplitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); hff = FindFirstFileW(input, &fd);
if (hff == INVALID_HANDLE_VALUE) if (hff == INVALID_HANDLE_VALUE)
...@@ -3207,7 +3207,7 @@ void WCMD_rename (void) ...@@ -3207,7 +3207,7 @@ void WCMD_rename (void)
dotDst = wcschr(param2, '.'); dotDst = wcschr(param2, '.');
/* Split into components */ /* Split into components */
WCMD_splitpath(input, drive, dir, fname, ext); _wsplitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); hff = FindFirstFileW(input, &fd);
if (hff == INVALID_HANDLE_VALUE) if (hff == INVALID_HANDLE_VALUE)
...@@ -3492,7 +3492,7 @@ void WCMD_setshow_default (const WCHAR *args) { ...@@ -3492,7 +3492,7 @@ void WCMD_setshow_default (const WCHAR *args) {
/* Convert path into actual directory spec */ /* Convert path into actual directory spec */
GetFullPathNameW(string, ARRAY_SIZE(fpath), fpath, NULL); GetFullPathNameW(string, ARRAY_SIZE(fpath), fpath, NULL);
WCMD_splitpath(fpath, drive, dir, fname, ext); _wsplitpath(fpath, drive, dir, fname, ext);
/* Rebuild path */ /* Rebuild path */
wsprintfW(string, fmt, drive, dir, fd.cFileName); wsprintfW(string, fmt, drive, dir, fd.cFileName);
......
...@@ -166,8 +166,8 @@ static int __cdecl WCMD_dir_sort (const void *a, const void *b) ...@@ -166,8 +166,8 @@ static int __cdecl WCMD_dir_sort (const void *a, const void *b)
WCHAR extB[MAX_PATH]; WCHAR extB[MAX_PATH];
/* Split into components */ /* Split into components */
WCMD_splitpath(filea->cFileName, drive, dir, fname, extA); _wsplitpath(filea->cFileName, drive, dir, fname, extA);
WCMD_splitpath(fileb->cFileName, drive, dir, fname, extB); _wsplitpath(fileb->cFileName, drive, dir, fname, extB);
result = lstrcmpiW(extA, extB); result = lstrcmpiW(extA, extB);
} }
...@@ -819,7 +819,7 @@ void WCMD_directory (WCHAR *args) ...@@ -819,7 +819,7 @@ void WCMD_directory (WCHAR *args)
thisEntry->next = NULL; thisEntry->next = NULL;
/* Split into components */ /* Split into components */
WCMD_splitpath(path, drive, dir, fname, ext); _wsplitpath(path, drive, dir, fname, ext);
WINE_TRACE("Path Parts: drive: '%s' dir: '%s' name: '%s' ext:'%s'\n", WINE_TRACE("Path Parts: drive: '%s' dir: '%s' name: '%s' ext:'%s'\n",
wine_dbgstr_w(drive), wine_dbgstr_w(dir), wine_dbgstr_w(drive), wine_dbgstr_w(dir),
wine_dbgstr_w(fname), wine_dbgstr_w(ext)); wine_dbgstr_w(fname), wine_dbgstr_w(ext));
......
...@@ -117,7 +117,6 @@ WCHAR *WCMD_skip_leading_spaces (WCHAR *string); ...@@ -117,7 +117,6 @@ WCHAR *WCMD_skip_leading_spaces (WCHAR *string);
BOOL WCMD_keyword_ws_found(const WCHAR *keyword, int len, const WCHAR *ptr); BOOL WCMD_keyword_ws_found(const WCHAR *keyword, int len, const WCHAR *ptr);
void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute); void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute);
void WCMD_splitpath(const WCHAR* path, WCHAR* drv, WCHAR* dir, WCHAR* name, WCHAR* ext);
WCHAR *WCMD_strip_quotes(WCHAR *cmd); WCHAR *WCMD_strip_quotes(WCHAR *cmd);
WCHAR *WCMD_LoadMessage(UINT id); WCHAR *WCMD_LoadMessage(UINT id);
void WCMD_strsubstW(WCHAR *start, const WCHAR* next, const WCHAR* insert, int len); void WCMD_strsubstW(WCHAR *start, const WCHAR* next, const WCHAR* insert, int len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment