cmd.exe: Add DIR /X support.

This commit is contained in:
Jason Edmeades 2007-03-13 01:09:05 +00:00 committed by Alexandre Julliard
parent 577b8ef233
commit ae964c68eb
1 changed files with 25 additions and 11 deletions

View File

@ -47,6 +47,7 @@ typedef enum _DISPLAYTIME
} DISPLAYTIME;
static int file_total, dir_total, recurse, wide, bare, max_width, lower;
static int shortname;
static ULONGLONG byte_total;
static DISPLAYTIME dirTime;
@ -75,6 +76,7 @@ void WCMD_directory (void) {
wide = (strstr(quals, "/W") != NULL);
bare = (strstr(quals, "/B") != NULL);
lower = (strstr(quals, "/L") != NULL);
shortname = (strstr(quals, "/X") != NULL);
if ((p = strstr(quals, "/T")) != NULL) {
p = p + 2;
@ -94,7 +96,8 @@ void WCMD_directory (void) {
}
/* Handle conflicting args and initialization */
if (bare) wide = FALSE;
if (bare || shortname) wide = FALSE;
if (bare) shortname = FALSE;
if (wide) {
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &consoleInfo))
@ -280,8 +283,13 @@ void WCMD_list_directory (char *search_path, int level) {
dir_count++;
if (!bare) {
if (shortname) {
WCMD_output ("%10s %8s <DIR> %-13s%s\n",
datestring, timestring, (fd+i)->cAlternateFileName, (fd+i)->cFileName);
} else {
WCMD_output ("%10s %8s <DIR> %s\n",
datestring, timestring, (fd+i)->cFileName);
}
} else {
if (!((strcmp((fd+i)->cFileName, ".") == 0) ||
(strcmp((fd+i)->cFileName, "..") == 0))) {
@ -295,9 +303,15 @@ void WCMD_list_directory (char *search_path, int level) {
file_size.u.HighPart = (fd+i)->nFileSizeHigh;
byte_count.QuadPart += file_size.QuadPart;
if (!bare) {
if (shortname) {
WCMD_output ("%10s %8s %10s %-13s%s\n",
datestring, timestring,
WCMD_filesize64(file_size.QuadPart), (fd+i)->cAlternateFileName, (fd+i)->cFileName);
} else {
WCMD_output ("%10s %8s %10s %s\n",
datestring, timestring,
WCMD_filesize64(file_size.QuadPart), (fd+i)->cFileName);
}
} else {
WCMD_output ("%s%s\n", recurse?real_path:"", (fd+i)->cFileName);
}