Signed-off-by: Zebediah Figura z.figura12@gmail.com --- programs/cmd/batch.c | 54 +--------------------------------------- programs/cmd/builtins.c | 10 ++++---- programs/cmd/directory.c | 6 ++--- programs/cmd/wcmd.h | 1 - 4 files changed, 9 insertions(+), 62 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 371f75af54..06437ecf1b 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -301,58 +301,6 @@ WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h) 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 * @@ -627,7 +575,7 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute) BOOL addSpace = (finaloutput[0] != 0x00);
/* Split into components */ - WCMD_splitpath(fullfilename, drive, dir, fname, ext); + _wsplitpath(fullfilename, drive, dir, fname, ext);
/* 5. Handle 'd' : Drive Letter */ if (wmemchr(firstModifier, 'd', modifierLen) != NULL) { diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 43c4d9efef..1870e5688d 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -1217,7 +1217,7 @@ static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted)
/* Convert path into actual directory spec */ 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 */ if ((lstrcmpW(fname, starW) == 0) && @@ -1352,7 +1352,7 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
/* Convert path into actual directory spec */ GetFullPathNameW(argCopy, ARRAY_SIZE(thisDir), thisDir, NULL); - WCMD_splitpath(thisDir, drive, dir, fname, ext); + _wsplitpath(thisDir, drive, dir, fname, ext);
lstrcpyW(thisDir, drive); lstrcatW(thisDir, dir); @@ -2986,7 +2986,7 @@ void WCMD_move (void) wine_dbgstr_w(param1), wine_dbgstr_w(output));
/* Split into components */ - WCMD_splitpath(input, drive, dir, fname, ext); + _wsplitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); if (hff == INVALID_HANDLE_VALUE) @@ -3207,7 +3207,7 @@ void WCMD_rename (void) dotDst = wcschr(param2, '.');
/* Split into components */ - WCMD_splitpath(input, drive, dir, fname, ext); + _wsplitpath(input, drive, dir, fname, ext);
hff = FindFirstFileW(input, &fd); if (hff == INVALID_HANDLE_VALUE) @@ -3492,7 +3492,7 @@ void WCMD_setshow_default (const WCHAR *args) {
/* Convert path into actual directory spec */ GetFullPathNameW(string, ARRAY_SIZE(fpath), fpath, NULL); - WCMD_splitpath(fpath, drive, dir, fname, ext); + _wsplitpath(fpath, drive, dir, fname, ext);
/* Rebuild path */ wsprintfW(string, fmt, drive, dir, fd.cFileName); diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index 41e1f4e929..2d35f8eb1d 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -166,8 +166,8 @@ static int __cdecl WCMD_dir_sort (const void *a, const void *b) WCHAR extB[MAX_PATH];
/* Split into components */ - WCMD_splitpath(filea->cFileName, drive, dir, fname, extA); - WCMD_splitpath(fileb->cFileName, drive, dir, fname, extB); + _wsplitpath(filea->cFileName, drive, dir, fname, extA); + _wsplitpath(fileb->cFileName, drive, dir, fname, extB); result = lstrcmpiW(extA, extB); }
@@ -819,7 +819,7 @@ void WCMD_directory (WCHAR *args) thisEntry->next = NULL;
/* 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_dbgstr_w(drive), wine_dbgstr_w(dir), wine_dbgstr_w(fname), wine_dbgstr_w(ext)); diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 112fc1a1ea..247f3dfdf3 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -117,7 +117,6 @@ WCHAR *WCMD_skip_leading_spaces (WCHAR *string); BOOL WCMD_keyword_ws_found(const WCHAR *keyword, int len, const WCHAR *ptr); 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_LoadMessage(UINT id); void WCMD_strsubstW(WCHAR *start, const WCHAR* next, const WCHAR* insert, int len);