diff --git a/cmddata.cpp b/cmddata.cpp index 8502210..2905b10 100644 --- a/cmddata.cpp +++ b/cmddata.cpp @@ -130,7 +130,7 @@ void CommandData::ParseArg(wchar *Arg) { FindData FileData; bool Found=FindFile::FastFind(Arg,&FileData); - if ((!Found || ListMode==RCLM_ACCEPT_LISTS) && + if ((!Found || ListMode==RCLM_ACCEPT_LISTS) && ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg)) { FileLists=true; @@ -866,6 +866,20 @@ void CommandData::ProcessSwitch(const wchar *Switch) case 'P': VolumePause=true; break; + case 'A': + if (toupperw(Switch[2])=='P') + { + VolumeAutoPause=true; + if (IsDigit(Switch[3])) + { + VolumeAutoPauseInterval=atoiw(Switch+3); + } + else + { + VolumeAutoPauseInterval=5; + } + } + break; case 'E': if (toupperw(Switch[2])=='R') VersionControl=atoiw(Switch+3)+1; @@ -992,8 +1006,8 @@ void CommandData::OutHelp(RAR_EXIT ExitCode) MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOW,MCHelpSwP, MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSC,MCHelpSwSL,MCHelpSwSM, MCHelpSwTA,MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU, - MCHelpSwVUnr,MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal, - MCHelpSwY + MCHelpSwVUnr,MCHelpSwVER,MCHelpSwVP,MCHelpSwVAP,MCHelpSwX,MCHelpSwXa, + MCHelpSwXal,MCHelpSwY #else #endif }; @@ -1077,7 +1091,7 @@ bool CommandData::CheckArgs(StringList *Args,bool Dir,const wchar *CheckName,boo { // We process the directory and have the directory exclusion mask. // So let's convert "mask\" to "mask" and process it normally. - + *LastMaskChar=0; } else @@ -1085,7 +1099,7 @@ bool CommandData::CheckArgs(StringList *Args,bool Dir,const wchar *CheckName,boo // REMOVED, we want -npath\* to match empty folders too. // If mask has wildcards in name part and does not have the trailing // '\' character, we cannot use it for directories. - + // if (IsWildcard(PointToName(CurMask))) // continue; } diff --git a/loclang.hpp b/loclang.hpp index 71b8985..fb3879c 100644 --- a/loclang.hpp +++ b/loclang.hpp @@ -139,6 +139,7 @@ #define MCHelpSwVER L"\n ver[n] File version control" #define MCHelpSwVN L"\n vn Use the old style volume naming scheme" #define MCHelpSwVP L"\n vp Pause before each volume" +#define MCHelpSwVAP L"\n vap Wait for each volume to appear, check interval in seconds" #define MCHelpSwW L"\n w Assign work directory" #define MCHelpSwX L"\n x Exclude specified file" #define MCHelpSwXa L"\n x@ Read file names to exclude from stdin" @@ -164,6 +165,7 @@ #define MAskNextDisk L"\nDisk full. Insert next" #define MCreatVol L"\n\nCreating %sarchive %s\n" #define MAskNextVol L"\nInsert disk with %s" +#define MWaitNextVol L"\nWaiting for %s to appear\n" #define MTestVol L"\n\nTesting archive %s\n" #define MExtrVol L"\n\nExtracting from %s\n" #define MConverting L"\nConverting %s" @@ -353,11 +355,11 @@ #define MWrongSFXVer L"\nERROR: default SFX module does not support RAR %d.%d archives" #define MCannotEncName L"\nCannot encrypt archive already contained encrypted files" #define MCannotEmail L"\nCannot email the file %s" -#define MCopyrightS L"\nRAR SFX archive" -#define MSHelpCmd L"\n\n" -#define MSHelpCmdE L"\n -x Extract from archive (default)" -#define MSHelpCmdT L"\n -t Test archive files" -#define MSHelpCmdV L"\n -v Verbosely list contents of archive" +#define MCopyrightS L"\nRAR SFX archive" +#define MSHelpCmd L"\n\n" +#define MSHelpCmdE L"\n -x Extract from archive (default)" +#define MSHelpCmdT L"\n -t Test archive files" +#define MSHelpCmdV L"\n -v Verbosely list contents of archive" #define MRecVolLimit L"\nTotal number of usual and recovery volumes must not exceed %d" #define MVolumeNumber L"volume %d" #define MCannotDelete L"\nCannot delete %s" diff --git a/options.hpp b/options.hpp index 05d9e10..228436b 100644 --- a/options.hpp +++ b/options.hpp @@ -32,7 +32,7 @@ enum {NAMES_ORIGINALCASE=0,NAMES_UPPERCASE,NAMES_LOWERCASE}; enum MESSAGE_TYPE {MSG_STDOUT=0,MSG_STDERR,MSG_ERRONLY,MSG_NULL}; -enum RECURSE_MODE +enum RECURSE_MODE { RECURSE_NONE=0, // no recurse switches RECURSE_DISABLE, // switch -r- @@ -40,7 +40,7 @@ enum RECURSE_MODE RECURSE_WILDCARDS, // switch -r0 }; -enum OVERWRITE_MODE +enum OVERWRITE_MODE { OVERWRITE_DEFAULT=0, // Ask when extracting, silently overwrite when archiving. OVERWRITE_ALL, @@ -100,7 +100,7 @@ class RAROptions wchar ArcPath[NM]; SecPassword Password; bool EncryptHeaders; - + bool ManualPassword; // Password entered manually during operation, might need to clean for next archive. wchar LogName[NM]; @@ -162,6 +162,8 @@ class RAROptions bool Lock; bool Test; bool VolumePause; + bool VolumeAutoPause; + uint VolumeAutoPauseInterval; FilterMode FilterModes[MAX_FILTER_TYPES]; wchar EmailTo[NM]; uint VersionControl; diff --git a/volume.cpp b/volume.cpp index f0d010f..6b9c269 100644 --- a/volume.cpp +++ b/volume.cpp @@ -18,9 +18,9 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma if (DataIO!=NULL && SplitHeader) { - bool PackedHashPresent=Arc.Format==RARFMT50 || + bool PackedHashPresent=Arc.Format==RARFMT50 || hd->UnpVer>=20 && hd->FileHash.CRC32!=0xffffffff; - if (PackedHashPresent && + if (PackedHashPresent && !DataIO->PackedDataHash.Cmp(&hd->FileHash,hd->UseHashKey ? hd->HashKey:NULL)) uiMsg(UIERROR_CHECKSUMPACKED, Arc.FileName, hd->FileName); } @@ -50,6 +50,11 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma FailedOpen=true; #endif + if (Cmd->VolumeAutoPause) + { + WaitNextVol(NextName,Cmd->VolumeAutoPauseInterval); + } + uint OpenMode = Cmd->OpenShared ? FMF_OPENSHARED : 0; if (!FailedOpen) @@ -57,7 +62,7 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma { // We need to open a new volume which size was not calculated // in total size before, so we cannot calculate the total progress - // anymore. Let's reset the total size to zero and stop + // anymore. Let's reset the total size to zero and stop // the total progress. if (DataIO!=NULL) DataIO->TotalArcSize=0; @@ -110,7 +115,7 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma #endif // RARDLL } - + if (FailedOpen) { uiMsg(UIERROR_MISSINGVOL,NextName); @@ -158,7 +163,7 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma #ifdef SFX_MODULE DataIO->UnpArcSize=Arc.FileLength(); #endif - + // Reset the size of packed data read from current volume. It is used // to display the total progress and preceding volumes are already // compensated with ProcessedArcSize, so we need to reset this variable. @@ -170,6 +175,23 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Comma } +void WaitNextVol(wchar *ArcName,uint Interval) +{ + eprintf(St(MWaitNextVol),ArcName); + while (!FileExist(ArcName)) + { + sleep(Interval); + } + File *ArcFile=new File(); + ArcFile->Open(ArcName,FMF_READ); + int64 ArcFileLastSize=0, ArcFileSize=1; + while (ArcFileSize!=ArcFileLastSize) + { + ArcFileLastSize=ArcFileSize; + sleep(Interval); + ArcFileSize=ArcFile->FileLength(); + } +} diff --git a/volume.hpp b/volume.hpp index 2d6a6d5..2410836 100644 --- a/volume.hpp +++ b/volume.hpp @@ -6,5 +6,6 @@ void SplitArchive(Archive &Arc,FileHeader *fh,int64 *HeaderPos, bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName, wchar Command); void SetVolWrite(Archive &Dest,int64 VolSize); +void WaitNextVol(wchar *ArcName,uint Interval); #endif