check for and write new lines as ascii only in copy /A, regardless of whether cmd was compiled as unicode or ansi

svn path=/trunk/; revision=18188
This commit is contained in:
Thomas Bluemel 2005-10-01 12:50:16 +00:00
parent 0f55e53480
commit 626370f6aa

View file

@ -240,7 +240,8 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl
{ {
for (i = 0; i < dwRead; i++) for (i = 0; i < dwRead; i++)
{ {
if (((LPTSTR)buffer)[i] == 0x1A) /* we're dealing with ASCII files! */
if (((LPSTR)buffer)[i] == 0x1A)
{ {
bEof = TRUE; bEof = TRUE;
break; break;
@ -273,12 +274,13 @@ int copy (TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFl
if (lpdwFlags & COPY_ASCII) if (lpdwFlags & COPY_ASCII)
{ {
((LPTSTR)buffer)[0] = 0x1A; /* we're dealing with ASCII files! */
((LPTSTR)buffer)[1] = _T('\0'); ((LPSTR)buffer)[0] = 0x1A;
((LPSTR)buffer)[1] = '\0';
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf (_T("appending ^Z\n")); DebugPrintf (_T("appending ^Z\n"));
#endif #endif
WriteFile (hFileDest, buffer, sizeof(TCHAR), &dwWritten, NULL); WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
} }
free (buffer); free (buffer);