From: Joe Souza jsouza@yahoo.com
--- programs/cmd/directory.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index 3f4f7853710..c6cb27efb0c 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -49,7 +49,7 @@ static int file_total, dir_total, max_width; static ULONGLONG byte_total; static DISPLAYTIME dirTime; static DISPLAYORDER dirOrder; -static BOOL orderReverse, orderGroupDirs, orderGroupDirsReverse, orderByCol; +static BOOL orderReverse, orderGroupDirs, orderGroupDirsReverse, orderByCol, orderUnspecified; static BOOL paged_mode, recurse, wide, bare, lower, shortname, usernames, separator; static ULONG showattrs, attrsbits;
@@ -99,7 +99,12 @@ static int __cdecl WCMD_dir_sort (const void *a, const void *b) (fileb->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))) { BOOL aDir = filea->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; - if (aDir) result = -1; + BOOL bDir = fileb->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; + if (aDir && bDir && orderUnspecified) { + result = lstrcmpiW(filea->cFileName, fileb->cFileName); + } else if (aDir) { + result = -1; + } else result = 1; if (orderGroupDirsReverse) result = -result; return result; @@ -678,6 +683,7 @@ RETURN_CODE WCMD_directory(WCHAR *args) orderReverse = FALSE; orderGroupDirs = FALSE; orderGroupDirsReverse = FALSE; + orderUnspecified = FALSE; showattrs = 0; attrsbits = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
@@ -742,6 +748,11 @@ RETURN_CODE WCMD_directory(WCHAR *args) break; case 'O': p = p + 1; if (*p==':') p++; /* Skip optional : */ + if (!*p) { /* /O by itself */ + orderUnspecified = TRUE; + dirOrder = Name; + orderGroupDirs = TRUE; + } while (*p && *p != '/') { WINE_TRACE("Processing subparm '%c' (in %s)\n", *p, wine_dbgstr_w(quals)); switch (*p) {