if you run command "copy" on file which is source and target then file should not be copied and shell should print message "File cannot be copied onto self". I tested it in dos 5.0 and dos 6.22.
this fixes it (shell_cmds.cpp)
//Special variable to ensure that copy * a_file, where a_file is not a directory concats.
bool special = second_file_of_current_source && target_is_file;
second_file_of_current_source = true;
if (special) oldsource.concat = true;
** if (!oldsource.concat && (!strcasecmp(nameSource, nameTarget))) {
WriteOut("File cannot be copied onto itself\r\n");
dos.dta(save_dta);
DOS_CloseFile(sourceHandle);
if (targetHandle)
DOS_CloseFile(targetHandle);
return;
}**
//Don't create a new file when in concat mode
if (oldsource.concat || DOS_CreateFile(nameTarget,0,&targetHandle)) {
Oh, seems I can't modify my ticket... So, sorry for bad layout, I will post it here. Without this fix is target file truncated, result is empty file
Last edit: Bruenor41 2023-03-09