Author: jmorlan
Date: Thu Dec 25 17:12:54 2008
New Revision: 38347
URL:
http://svn.reactos.org/svn/reactos?rev=38347&view=rev
Log:
Allow the DIR command to be interrupted via Ctrl-C even while in the middle of a
directory. (Bug 3967)
Modified:
trunk/reactos/base/shell/cmd/dir.c
Modified: trunk/reactos/base/shell/cmd/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=3…
==============================================================================
--- trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/dir.c [iso-8859-1] Thu Dec 25 17:12:54 2008
@@ -989,7 +989,7 @@
INT iSizeFormat;
ULARGE_INTEGER u64FileSize;
- for (i = 0;i < dwCount;i++)
+ for (i = 0; i < dwCount && !bCtrlBreak; i++)
{
/* Calculate size */
if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -1097,7 +1097,7 @@
/* Calculate the lines that will be printed */
iLines = (USHORT)((dwCount + iColumns - 1) / iColumns);
- for (i = 0; i < iLines; i++)
+ for (i = 0; i < iLines && !bCtrlBreak; i++)
{
for (j = 0; j < iColumns; j++)
{
@@ -1154,7 +1154,7 @@
int iSizeFormat; /* The format of size field */
ULARGE_INTEGER u64FileSize; /* The file size */
- for(i = 0;i < dwCount;i++)
+ for (i = 0; i < dwCount && !bCtrlBreak; i++)
{
/* Broke 8.3 format */
if (*ptrFiles[i]->cAlternateFileName )
@@ -1228,7 +1228,7 @@
TCHAR szFullName[MAX_PATH];
DWORD i;
- for (i = 0; i < dwCount; i++)
+ for (i = 0; i < dwCount && !bCtrlBreak; i++)
{
if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) ||
(_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0))
@@ -1681,6 +1681,15 @@
/* Free array */
cmd_free(ptrFileArray);
+ /* Free linked list */
+ while (ptrStartNode)
+ {
+ ptrNextNode = ptrStartNode->ptrNext;
+ cmd_free(ptrStartNode);
+ ptrStartNode = ptrNextNode;
+ dwCount --;
+ }
+
if (CheckCtrlBreak(BREAK_INPUT))
return 1;
@@ -1739,15 +1748,6 @@
}
}while(FindNextFile(hRecSearch,&wfdFileInfo));
FindClose(hRecSearch);
- }
-
- /* Free linked list */
- while (ptrStartNode)
- {
- ptrNextNode = ptrStartNode->ptrNext;
- cmd_free(ptrStartNode);
- ptrStartNode = ptrNextNode;
- dwCount --;
}
return 0;