Skip to content

/-Y and COPYCMD=/-Y: prompt before overwriting instead of skipping - #8

Open
314TeR wants to merge 1 commit into
FDOS:masterfrom
314TeR:copycmd-ask
Open

314TeR wants to merge 1 commit into
FDOS:masterfrom
314TeR:copycmd-ask

Conversation

@314TeR

@314TeR 314TeR commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

The help text (0.10) says /-Y "Causes prompting to confirm you want to overwrite an existing destination file", which is also how COPYCMD=/-Y works in MS-DOS and in FreeCOM's COPY. In move.c both map to SKIP:

  • move.c:601-613 - COPYCMD=/-Y (and /N) -> opt_prompt = SKIP
  • move.c:635-636 - option /-Y -> opt_prompt = SKIP

FreeDOS sets COPYCMD=/-Y in FDAUTO.BAT, so on a default installation MOVE never asks: it prints " [File already exists]" and skips, while COPY asks. Found while testing the Polish translation (the overwrite prompt never appeared).

While there: strncpy(environ, getenv("COPYCMD"), ...) has no NULL check, so with COPYCMD unset it reads from address 0, and the copy is not terminated if the value is 255+ chars.

This PR:

  • /-Y (option and COPYCMD) -> ASK (prompt), as documented;
  • COPYCMD=/N stays SKIP, /Y stays OVERWRITE;
  • getenv result checked, copy always terminated.

Tested on FreeDOS T2610 (QEMU), built with Open Watcom 2.0 (build.bat flags), Polish NLS:

Case Before After
default (COPYCMD=/-Y from FDAUTO) skipped, " [File already exists]" prompt; N keeps the target
/Y overwrite overwrite
COPYCMD=/Y overwrite overwrite
COPYCMD=/N skip skip
COPYCMD unset prompt prompt; None skips
COPYCMD=/Y + option /-Y skip prompt; All moves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant