Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,16 +599,23 @@ int main(int argc, char *argv[])
atexit(exit_fn);

/* Read COPYCMD to set confirmation. */
strncpy(environ,getenv("COPYCMD"),sizeof(environ));
ptr = getenv("COPYCMD");
environ[0] = '\0';
if (ptr != NULL)
{
strncpy(environ, ptr, sizeof(environ) - 1);
environ[sizeof(environ) - 1] = '\0';
}
if (environ[0] != '\0')
{
strupr(environ);
if ((environ[0] == '/') || (environ[0] == switchch))
{
if ((environ[1] == 'Y') && (environ[2] == '\0'))
opt_prompt = OVERWRITE; /* Overwrite existing files. */
else if (((environ[1] == 'N') && (environ[2] == '\0')) ||
((environ[1] == '-') && (environ[2] == 'Y') && (environ[3] == '\0')))
else if ((environ[1] == '-') && (environ[2] == 'Y') && (environ[3] == '\0'))
opt_prompt = ASK; /* Prompt before overwriting. */
else if ((environ[1] == 'N') && (environ[2] == '\0'))
opt_prompt = SKIP; /* Skip existing files. */
}
} /* end if. */
Expand All @@ -633,7 +640,7 @@ int main(int argc, char *argv[])
else if (stricmp(option, "y") == 0)
opt_prompt=OVERWRITE;
else if (stricmp(option, "-y") == 0)
opt_prompt=SKIP;
opt_prompt=ASK;
else if (stricmp(option, "s") == 0)
movedirs = 1;
else
Expand Down