Disabled prompting when in batch mode.

svn path=/trunk/; revision=737
This commit is contained in:
Eric Kohl 1999-10-27 22:46:53 +00:00
parent 788e4dc053
commit 863afe8930

View file

@ -16,6 +16,9 @@
* *
* 26-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) * 26-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Replaced CRT io functions by Win32 io functions. * Replaced CRT io functions by Win32 io functions.
*
* 27-Oct-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Disabled prompting then used in batch mode.
*/ */
#include "config.h" #include "config.h"
@ -29,6 +32,7 @@
#include <ctype.h> #include <ctype.h>
#include "cmd.h" #include "cmd.h"
#include "batch.h"
#define VERIFY 1 /* VERIFY Switch */ #define VERIFY 1 /* VERIFY Switch */
@ -205,7 +209,7 @@ AddFiles (LPFILES f, char *arg, int *source, int *dest,
static BOOL static BOOL
GetDestination (LPFILES f, LPFILES dest) GetDestination (LPFILES f, LPFILES dest)
{ {
LPFILES p = NULL; LPFILES p = NULL;
LPFILES start = f; LPFILES start = f;
while (f->next != NULL) while (f->next != NULL)
@ -270,6 +274,7 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
} }
} }
} }
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf ("ParseCommand: flags has %s\n", DebugPrintf ("ParseCommand: flags has %s\n",
*lpdwFlags & ASCII ? "ASCII" : "BINARY"); *lpdwFlags & ASCII ? "ASCII" : "BINARY");
@ -299,6 +304,7 @@ Overwrite (LPTSTR fn)
ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn); ConOutPrintf (_T("Overwrite %s (Yes/No/All)? "), fn);
ConInString (inp, 10); ConInString (inp, 10);
ConOutPuts (_T(""));
_tcsupr (inp); _tcsupr (inp);
for (p = inp; _istspace (*p); p++) for (p = inp; _istspace (*p); p++)
@ -417,8 +423,6 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
return 0; return 0;
} }
ConOutPuts (source);
do do
{ {
ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL); ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL);
@ -484,11 +488,11 @@ int setup_copy (LPFILES sources, char **p, BOOL bMultiple,
{ {
WIN32_FIND_DATA find; WIN32_FIND_DATA find;
char drive_s[_MAX_DRIVE], char drive_s[_MAX_DRIVE];
dir_s[_MAX_DIR], CHAR dir_s[_MAX_DIR];
file_s[_MAX_FNAME], char file_s[_MAX_FNAME];
ext_s[_MAX_EXT]; char ext_s[_MAX_EXT];
char from_merge[_MAX_PATH]; char from_merge[_MAX_PATH];
LPTSTR real_source; LPTSTR real_source;
LPTSTR real_dest; LPTSTR real_dest;
@ -498,7 +502,6 @@ int setup_copy (LPFILES sources, char **p, BOOL bMultiple,
BOOL bDone; BOOL bDone;
HANDLE hFind; HANDLE hFind;
real_source = (LPTSTR)malloc (MAX_PATH); real_source = (LPTSTR)malloc (MAX_PATH);
real_dest = (LPTSTR)malloc (MAX_PATH); real_dest = (LPTSTR)malloc (MAX_PATH);
@ -556,13 +559,23 @@ int setup_copy (LPFILES sources, char **p, BOOL bMultiple,
if (IsValidFileName (real_dest) && !bAll) if (IsValidFileName (real_dest) && !bAll)
{ {
int over = Overwrite (real_dest); /* Don't prompt in a batch file */
if (over == 2) if (bc != NULL)
bAll = TRUE; {
else if (over == 0)
goto next;
else if (bMultiple)
bAll = TRUE; bAll = TRUE;
}
else
{
int over;
over = Overwrite (real_dest);
if (over == 2)
bAll = TRUE;
else if (over == 0)
goto next;
else if (bMultiple)
bAll = TRUE;
}
} }
if (copy (real_source, real_dest, *append, lpdwFlags)) if (copy (real_source, real_dest, *append, lpdwFlags))
nCopied++; nCopied++;
@ -587,16 +600,16 @@ int setup_copy (LPFILES sources, char **p, BOOL bMultiple,
INT cmd_copy (LPTSTR first, LPTSTR rest) INT cmd_copy (LPTSTR first, LPTSTR rest)
{ {
char **p; char **p;
char drive_d[_MAX_DRIVE], char drive_d[_MAX_DRIVE];
dir_d[_MAX_DIR], char dir_d[_MAX_DIR];
file_d[_MAX_FNAME], char file_d[_MAX_FNAME];
ext_d[_MAX_EXT]; char ext_d[_MAX_EXT];
int argc, int argc;
append, int append;
files, int files;
copied; int copied;
LPFILES sources; LPFILES sources;
FILES dest; FILES dest;