From 3038d8248eb8baa8648a4d6eaa81f26f49cb63a7 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Sun, 11 Aug 2013 16:47:42 +1000 Subject: cmd directory --- programs/cmd/directory.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c index 58fff44..1c8f994 100644 --- a/programs/cmd/directory.c +++ b/programs/cmd/directory.c @@ -244,7 +244,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le WIN32_FIND_DATAW *fd; FILETIME ft; SYSTEMTIME st; - HANDLE hff; + HANDLE hff = INVALID_HANDLE_VALUE; int dir_count, file_count, entry_count, i, widest, cur_width, tmp_width; int numCols, numRows; int rows, cols; @@ -276,6 +276,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le fd = heap_alloc(sizeof(WIN32_FIND_DATAW)); while (parms && strcmpW(inputparms->dirName, parms->dirName) == 0) { concurrentDirs++; + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ /* Work out the full path + filename */ strcpyW(real_path, parms->dirName); @@ -286,6 +287,8 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le hff = FindFirstFileW(real_path, (fd+entry_count)); if (hff != INVALID_HANDLE_VALUE) { do { + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ + /* Skip any which are filtered out by attribute */ if (((fd+entry_count)->dwFileAttributes & attrsbits) != showattrs) continue; @@ -348,6 +351,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le for (rows=0; rows 0) { + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ dirsToCopy--; /* Work out search parameter in sub dir */ @@ -546,6 +552,13 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le errorlevel = 1; } +exit: + if (WCMD_check_abort()) { + parms = NULL; /* Stop all commands and exit */ + heap_free(fd); + } + if (hff != INVALID_HANDLE_VALUE) FindClose(hff); + return parms; } @@ -799,6 +812,7 @@ void WCMD_directory (WCHAR *args) while (argN) { WCHAR fullname[MAXSTRING]; WCHAR *thisArg = WCMD_parameter(args, argno++, &argN, FALSE, FALSE); + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ if (argN && argN[0] != '/') { WINE_TRACE("Found parm '%s'\n", wine_dbgstr_w(thisArg)); @@ -887,6 +901,8 @@ void WCMD_directory (WCHAR *args) while (thisEntry != NULL) { + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ + /* Output disk free (trailer) and volume information (header) if the drive letter changes */ if (lastDrive != toupper(thisEntry->dirName[0])) { @@ -921,6 +937,7 @@ void WCMD_directory (WCHAR *args) errorlevel = 0; prevEntry = thisEntry; thisEntry = WCMD_list_directory (thisEntry, 0); + if (WCMD_check_abort()) goto exit; /* Stop all commands and exit */ } /* Trailer Information */ -- 1.7.10.4