Add some ctrl breaker checks into copy, del, and dir. Modified: trunk/reactos/subsys/system/cmd/cmd.c Modified: trunk/reactos/subsys/system/cmd/copy.c Modified: trunk/reactos/subsys/system/cmd/del.c Modified: trunk/reactos/subsys/system/cmd/dir.c _____
Modified: trunk/reactos/subsys/system/cmd/cmd.c --- trunk/reactos/subsys/system/cmd/cmd.c 2005-11-05 23:10:43 UTC (rev 19023) +++ trunk/reactos/subsys/system/cmd/cmd.c 2005-11-06 01:24:21 UTC (rev 19024) @@ -643,6 +643,8 @@
} } } + /* Just in case a CTRL+C slipped through a command */ + bCtrlBreak = FALSE; free(com); }
_____
Modified: trunk/reactos/subsys/system/cmd/copy.c --- trunk/reactos/subsys/system/cmd/copy.c 2005-11-05 23:10:43 UTC (rev 19023) +++ trunk/reactos/subsys/system/cmd/copy.c 2005-11-06 01:24:21 UTC (rev 19024) @@ -51,7 +51,12 @@
#define BUFF_SIZE 16384 /* 16k = max buffer size */
-int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch) +INT +copy (TCHAR source[MAX_PATH], + TCHAR dest[MAX_PATH], + INT append, + DWORD lpdwFlags, + BOOL bTouch) { TCHAR szMsg[RC_STRING_MAX_SIZE]; FILETIME srctime,NewFileTime; @@ -68,6 +73,9 @@ TCHAR * FileName; SYSTEMTIME CurrentTime;
+ /* Check Breaker */ + if(CheckCtrlBreak(BREAK_INPUT)) + return 0;
#ifdef _DEBUG DebugPrintf (_T("checking mode\n")); @@ -235,6 +243,7 @@
do { + ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL); if (lpdwFlags & COPY_ASCII) { @@ -254,14 +263,14 @@ break;
WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL); - if (dwWritten != dwRead) + if (dwWritten != dwRead || CheckCtrlBreak(BREAK_INPUT)) { ConOutResPuts(STRING_COPY_ERROR3);
free (buffer); CloseHandle (hFileDest); CloseHandle (hFileSrc); - nErrorLevel = 1; + nErrorLevel = 1; return 0; } } @@ -731,6 +740,12 @@
do { + /* Check Breaker */ + if(CheckCtrlBreak(BREAK_INPUT)) + { + freep(arg); + return 1; + } /* Set the override to yes each new file */ nOverwrite = 1;
_____
Modified: trunk/reactos/subsys/system/cmd/del.c --- trunk/reactos/subsys/system/cmd/del.c 2005-11-05 23:10:43 UTC (rev 19023) +++ trunk/reactos/subsys/system/cmd/del.c 2005-11-06 01:24:21 UTC (rev 19024) @@ -107,8 +107,9 @@
/*This function is called by CommandDelete and does the actual process of deleting the single file*/ + if(CheckCtrlBreak(BREAK_INPUT)) + return 1;
- /*check to see if it is read only and if this is done based on /A if it is done by file name, access is denied. However, if it is done using the /A switch you must un-read only the file and allow it to be _____
Modified: trunk/reactos/subsys/system/cmd/dir.c --- trunk/reactos/subsys/system/cmd/dir.c 2005-11-05 23:10:43 UTC (rev 19023) +++ trunk/reactos/subsys/system/cmd/dir.c 2005-11-06 01:24:21 UTC (rev 19024) @@ -2027,7 +2027,7 @@
}
/* read the parameters */ - if (!DirReadParam(rest, ¶ms, &entries, &stFlags)) + if (!DirReadParam(rest, ¶ms, &entries, &stFlags) || CheckCtrlBreak(BREAK_INPUT)) { nErrorLevel = 1; return 1; @@ -2044,7 +2044,7 @@ for(loop = 0; loop < entries; loop++) { /* parse the directory info */ - if (DirParsePathspec (params[loop], szPath, szFilespec)) + if (DirParsePathspec (params[loop], szPath, szFilespec) || CheckCtrlBreak(BREAK_INPUT)) { nErrorLevel = 1; return 1;