Allow the DIR command to be interrupted via Ctrl-C even while in the middle of a directory. (Bug 3967)

svn path=/trunk/; revision=38347
This commit is contained in:
Jeffrey Morlan 2008-12-25 23:12:54 +00:00
parent 10d052aa36
commit 238bb2f73a

View file

@ -989,7 +989,7 @@ DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[], /* [IN]Files' Info */
INT iSizeFormat; INT iSizeFormat;
ULARGE_INTEGER u64FileSize; ULARGE_INTEGER u64FileSize;
for (i = 0;i < dwCount;i++) for (i = 0; i < dwCount && !bCtrlBreak; i++)
{ {
/* Calculate size */ /* Calculate size */
if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@ -1097,7 +1097,7 @@ DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
/* Calculate the lines that will be printed */ /* Calculate the lines that will be printed */
iLines = (USHORT)((dwCount + iColumns - 1) / iColumns); 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++) for (j = 0; j < iColumns; j++)
{ {
@ -1154,7 +1154,7 @@ TCHAR szSize[30]; /* The size of file */
int iSizeFormat; /* The format of size field */ int iSizeFormat; /* The format of size field */
ULARGE_INTEGER u64FileSize; /* The file size */ ULARGE_INTEGER u64FileSize; /* The file size */
for(i = 0;i < dwCount;i++) for (i = 0; i < dwCount && !bCtrlBreak; i++)
{ {
/* Broke 8.3 format */ /* Broke 8.3 format */
if (*ptrFiles[i]->cAlternateFileName ) if (*ptrFiles[i]->cAlternateFileName )
@ -1228,7 +1228,7 @@ DirPrintBareList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
TCHAR szFullName[MAX_PATH]; TCHAR szFullName[MAX_PATH];
DWORD i; DWORD i;
for (i = 0; i < dwCount; i++) for (i = 0; i < dwCount && !bCtrlBreak; i++)
{ {
if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) || if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) ||
(_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0)) (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0))
@ -1681,6 +1681,15 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
/* Free array */ /* Free array */
cmd_free(ptrFileArray); cmd_free(ptrFileArray);
/* Free linked list */
while (ptrStartNode)
{
ptrNextNode = ptrStartNode->ptrNext;
cmd_free(ptrStartNode);
ptrStartNode = ptrNextNode;
dwCount --;
}
if (CheckCtrlBreak(BREAK_INPUT)) if (CheckCtrlBreak(BREAK_INPUT))
return 1; return 1;
@ -1741,15 +1750,6 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
FindClose(hRecSearch); FindClose(hRecSearch);
} }
/* Free linked list */
while (ptrStartNode)
{
ptrNextNode = ptrStartNode->ptrNext;
cmd_free(ptrStartNode);
ptrStartNode = ptrNextNode;
dwCount --;
}
return 0; return 0;
} }