diff -urp 1900-1/C/7zVersion.h 1900-3/C/7zVersion.h
--- 1900-1/C/7zVersion.h 2020-03-03 18:10:32 +1000
+++ 1900-3/C/7zVersion.h 2020-03-04 10:04:37 +1000
@@ -2,7 +2,7 @@
#define MY_VER_MINOR 00
#define MY_VER_BUILD 0
#define MY_VERSION_NUMBERS "19.00"
-#define MY_VERSION MY_VERSION_NUMBERS "a"
+#define MY_VERSION MY_VERSION_NUMBERS "a2"
#ifdef MY_CPU_NAME
#define MY_VERSION_CPU MY_VERSION " (" MY_CPU_NAME ")"
@@ -10,7 +10,7 @@
#define MY_VERSION_CPU MY_VERSION
#endif
-#define MY_DATE "2019-07-06"
+#define MY_DATE "2020-03-04"
#undef MY_COPYRIGHT
#undef MY_VERSION_COPYRIGHT_DATE
#define MY_AUTHOR_NAME "Igor Pavlov"
diff -urp 1900-1/C/7zVersion.rc 1900-3/C/7zVersion.rc
--- 1900-1/C/7zVersion.rc 2020-03-03 18:10:32 +1000
+++ 1900-3/C/7zVersion.rc 2020-03-04 10:01:23 +1000
@@ -11,7 +11,7 @@
#include "7zVersion.h"
#endif
-#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,1
+#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,3
#ifdef DEBUG
#define DBG_FL VS_FF_DEBUG
diff -urp 1900-1/CPP/7zip/UI/Common/ArchiveCommandLine.cpp 1900-3/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
--- 1900-1/CPP/7zip/UI/Common/ArchiveCommandLine.cpp 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/7zip/UI/Common/ArchiveCommandLine.cpp 2020-03-03 17:38:11 +1000
@@ -39,6 +39,7 @@
extern bool g_CaseSensitive;
extern bool g_PathTrailReplaceMode;
+extern bool g_ArchiveWildcards;
#ifdef _7ZIP_LARGE_PAGES
bool g_LargePagesMode = false;
@@ -271,11 +272,11 @@ static const CSwitchForm kSwitchForms[]
{ "sns", NSwitchType::kMinus },
{ "snr" },
{ "snc" },
-
- { "sub", NSwitchType::kString, true, 1},
{ "snt", NSwitchType::kMinus },
+ { "sub", NSwitchType::kString, true, 1},
+
{ "sdel" },
{ "stl" }
@@ -644,7 +645,13 @@ static void AddSub(const UStringVector &
for (i = 0; i < strings.Size(); i++)
{
CSubPair &pair = SubPairs.AddNew();
- const UString &name = strings[i];
+ pair.anywhere = false;
+ UString name = strings[i];
+ if (*name == L'*')
+ {
+ pair.anywhere = true;
+ name.Delete(0);
+ }
int eq = name.Find(L'=');
if (eq == -1)
pair.Old = name;
@@ -1103,6 +1110,12 @@ void CArcCmdLineParser::Parse2(CArcCmdLi
g_CodePage = FindCharset(parser, NKey::kConsoleCharSet, true, -1);
Int32 codePage = FindCharset(parser, NKey::kListfileCharSet, false, CP_UTF8);
+ bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
+ bool isExtractOrList = isExtractGroupCommand ||
+ options.Command.CommandType == NCommandType::kList ||
+ options.Command.CommandType == NCommandType::kProperties;
+ g_ArchiveWildcards = isExtractOrList;
+
bool thereAreSwitchIncludes = false;
if (parser[NKey::kInclude].ThereIs)
@@ -1128,10 +1141,6 @@ void CArcCmdLineParser::Parse2(CArcCmdLi
options.Command.CommandType != NCommandType::kInfo &&
options.Command.CommandType != NCommandType::kHash;
- bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
- bool isExtractOrList = isExtractGroupCommand ||
- options.Command.CommandType == NCommandType::kList ||
- options.Command.CommandType == NCommandType::kProperties;
bool isRename = options.Command.CommandType == NCommandType::kRename;
if ((isExtractOrList || isRename) && options.StdInMode)
diff -urp 1900-1/CPP/7zip/UI/Common/OpenArchive.cpp 1900-3/CPP/7zip/UI/Common/OpenArchive.cpp
--- 1900-1/CPP/7zip/UI/Common/OpenArchive.cpp 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/7zip/UI/Common/OpenArchive.cpp 2020-03-02 12:08:23 +1000
@@ -723,7 +723,15 @@ HRESULT CArc::GetItemPath(UInt32 index,
do_sub:
FOR_VECTOR (i, SubPairs)
- result.Replace(SubPairs[i].Old, SubPairs[i].New);
+ {
+ if (SubPairs[i].anywhere)
+ result.Replace(SubPairs[i].Old, SubPairs[i].New);
+ else if (result.IsPrefixedBy(SubPairs[i].Old))
+ {
+ result.DeleteFrontal(SubPairs[i].Old.Len());
+ result.Insert(0, SubPairs[i].New);
+ }
+ }
if (result.IsEmpty())
return GetDefaultItemPath(index, result);
diff -urp 1900-1/CPP/7zip/UI/Common/OpenArchive.h 1900-3/CPP/7zip/UI/Common/OpenArchive.h
--- 1900-1/CPP/7zip/UI/Common/OpenArchive.h 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/7zip/UI/Common/OpenArchive.h 2020-03-02 11:26:02 +1000
@@ -226,6 +226,7 @@ struct CSubPair
{
UString Old;
UString New;
+ bool anywhere;
};
extern CObjectVector SubPairs;
diff -urp 1900-1/CPP/7zip/UI/Console/List.cpp 1900-3/CPP/7zip/UI/Console/List.cpp
--- 1900-1/CPP/7zip/UI/Console/List.cpp 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/7zip/UI/Console/List.cpp 2019-07-11 17:51:54 +1000
@@ -779,20 +779,20 @@ void CFieldPrinter::PrintSum(const CList
void CFieldPrinter::PrintStats(const CListStat2 &stat2, UInt64 physicalSize)
{
if (stat2.NumDirs != 0)
- g_StdOut << "Folders: " << stat2.NumDirs << endl;
- if (stat2.MainFiles.NumFiles != 1 || stat2.NumDirs != 0 || stat2.AltStreams.NumFiles != 0)
- g_StdOut << "Files: " << stat2.MainFiles.NumFiles << endl;
+ g_StdOut << "Folders = " << stat2.NumDirs << endl;
+ if (stat2.MainFiles.NumFiles != 0 || stat2.NumDirs != 0 || stat2.AltStreams.NumFiles != 0)
+ g_StdOut << "Files = " << stat2.MainFiles.NumFiles << endl;
if (stat2.AltStreams.NumFiles != 0)
{
- g_StdOut << "Alternate Streams: " << stat2.AltStreams.NumFiles << endl;
- g_StdOut << "Alternate Streams Size: " << stat2.AltStreams.Size.Val << endl;
+ g_StdOut << "Alternate Streams = " << stat2.AltStreams.NumFiles << endl;
+ g_StdOut << "Alternate Streams Size = " << stat2.AltStreams.Size.Val << endl;
}
g_StdOut
- << "Size: " << stat2.MainFiles.Size.Val << endl
- << "Compressed: " << stat2.MainFiles.PackSize.Val << endl;
+ << "Size = " << stat2.MainFiles.Size.Val << endl
+ << "Compressed = " << stat2.MainFiles.PackSize.Val << endl;
if (physicalSize)
- g_StdOut << "Physical: " << physicalSize << endl;
+ g_StdOut << "Physical = " << physicalSize << endl;
}
static HRESULT GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, CListUInt64Def &value)
@@ -824,7 +824,7 @@ static HRESULT GetItemMTime(IInArchive *
static void PrintPropNameAndNumber(CStdOutStream &so, const char *name, UInt64 val)
{
- so << name << ": " << val << endl;
+ so << name << " = " << val << endl;
}
static void PrintPropName_and_Eq(CStdOutStream &so, PROPID propID)
diff -urp 1900-1/CPP/7zip/UI/Console/Main.cpp 1900-3/CPP/7zip/UI/Console/Main.cpp
--- 1900-1/CPP/7zip/UI/Console/Main.cpp 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/7zip/UI/Console/Main.cpp 2020-03-04 10:11:45 +1000
@@ -92,7 +92,7 @@ static const char * const kHelpString =
"\n"
" a : Add files to archive\n"
" b : Benchmark\n"
- " c : extract to Console (short for \"e -so -bso1 -bb\")\n"
+ " c : Extract to console (short for \"e -so -bso1 -bb\")\n"
" d : Delete files from archive\n"
" e : Extract files from archive (without using directory names)\n"
" h : Calculate hash values for files\n"
@@ -139,6 +139,7 @@ static const char * const kHelpString =
" -snl : store symbolic links as links\n"
" -sni : store NT security information\n"
" -sns[-] : store NTFS alternate streams\n"
+ " -snt[-] : replace trailing spaces and dots in path names with underscores\n"
" -so : write data to stdout\n"
" -spd : disable wildcard matching for file names\n"
" -spe : eliminate duplication of root folder for extract command\n"
@@ -149,7 +150,7 @@ static const char * const kHelpString =
" -stl : set archive timestamp from the most recently modified file\n"
" -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)\n"
" -stx{Type} : exclude archive type\n"
- " -sub{old}[=[{new}]] : substitute text in list/extract path names\n"
+ " -sub[*]{old}[=[{new}]] : substitute text in list/extract path names\n"
" -t{Type} : Set type of archive\n"
" -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options\n"
" -v{Size}[b|k|m|g] : Create volumes\n"
diff -urp 1900-1/CPP/Common/Wildcard.cpp 1900-3/CPP/Common/Wildcard.cpp
--- 1900-1/CPP/Common/Wildcard.cpp 2020-03-03 18:10:33 +1000
+++ 1900-3/CPP/Common/Wildcard.cpp 2020-03-04 10:54:46 +1000
@@ -11,6 +11,8 @@ bool g_CaseSensitive =
true;
#endif
+bool g_ArchiveWildcards;
+
bool IsPath1PrefixedByPath2(const wchar_t *s1, const wchar_t *s2)
{
@@ -227,7 +229,8 @@ bool CItem::CheckPath(const UStringVecto
{
if (isFile && !ForFile)
return false;
- start = finish = delta;
+ if (MatchAtEnd)
+ start = finish = delta;
}
for (int d = start; d <= finish; d++)
@@ -316,6 +319,7 @@ void CCensorNode::AddItem(bool include,
item.ForFile = forFile;
item.ForDir = forDir;
item.WildcardMatching = wildcardMatching;
+ item.MatchAtEnd = false;
AddItem(include, item);
}
@@ -548,6 +552,15 @@ void CCensor::AddItem(ECensorPathMode pa
forFile = false;
pathParts.DeleteBack();
}
+
+ bool matchAtEnd = false;
+ if (g_ArchiveWildcards)
+ {
+ if (pathParts.Front().IsEmpty())
+ pathParts.Delete(0);
+ else
+ matchAtEnd = true;
+ }
UString prefix;
@@ -628,6 +641,7 @@ void CCensor::AddItem(ECensorPathMode pa
item.ForFile = forFile;
item.Recursive = recursive;
item.WildcardMatching = wildcardMatching;
+ item.MatchAtEnd = matchAtEnd;
Pairs[index].Head.AddItem(include, item, ignoreWildcardIndex);
}
diff -urp 1900-1/CPP/Common/Wildcard.h 1900-3/CPP/Common/Wildcard.h
--- 1900-1/CPP/Common/Wildcard.h 2017-02-16 17:19:16 +1000
+++ 1900-3/CPP/Common/Wildcard.h 2020-03-03 17:26:28 +1000
@@ -37,6 +37,7 @@ struct CItem
bool ForFile;
bool ForDir;
bool WildcardMatching;
+ bool MatchAtEnd;
#ifdef _WIN32
bool IsDriveItem() const
diff -urp 1900-1/DOC/7zip.hhp 1900-3/DOC/7zip.hhp
--- 1900-1/DOC/7zip.hhp 2015-11-06 02:10:43 +1000
+++ 1900-3/DOC/7zip.hhp 2019-07-05 11:37:06 +1000
@@ -26,6 +26,7 @@ cmdline\commands\bench.htm
cmdline\commands\delete.htm
cmdline\commands\extract.htm
cmdline\commands\extract_full.htm
+cmdline\commands\extract_console.htm
cmdline\commands\update.htm
cmdline\commands\hash.htm
cmdline\commands\index.htm
@@ -39,10 +40,13 @@ cmdline\switches\method.htm
cmdline\switches\ar_include.htm
cmdline\switches\ar_exclude.htm
cmdline\switches\ar_no.htm
+cmdline\switches\b.htm
cmdline\switches\bb.htm
cmdline\switches\bs.htm
cmdline\switches\charset.htm
cmdline\switches\email.htm
+cmdline\switches\list_bare.htm
+cmdline\switches\list_short.htm
cmdline\switches\list_tech.htm
cmdline\switches\large_pages.htm
cmdline\switches\output_dir.htm
@@ -64,6 +68,7 @@ cmdline\switches\stdout.htm
cmdline\switches\stl.htm
cmdline\switches\stop_switch.htm
cmdline\switches\stx.htm
+cmdline\switches\sub.htm
cmdline\switches\type.htm
cmdline\switches\update.htm
cmdline\switches\working_dir.htm
diff -urp 1900-1/help/cmdline/commands/index.htm 1900-3/help/cmdline/commands/index.htm
--- 1900-1/help/cmdline/commands/index.htm 2020-03-03 18:10:52 +1000
+++ 1900-3/help/cmdline/commands/index.htm 2020-03-04 11:26:45 +1000
@@ -20,7 +20,7 @@
Command | Description |
a | Add |
b | Benchmark |
- c | extract to Console |
+ c | Extract to console |
d | Delete |
e | Extract |
h | Hash |
diff -urp 1900-1/help/cmdline/switches/sub.htm 1900-3/help/cmdline/switches/sub.htm
--- 1900-1/help/cmdline/switches/sub.htm 2020-03-03 18:10:52 +1000
+++ 1900-3/help/cmdline/switches/sub.htm 2020-03-03 11:24:04 +1000
@@ -16,7 +16,7 @@
Syntax
--sub{old}[=[{new}]]
+-sub[*]{old}[=[{new}]]
@@ -26,7 +26,8 @@
- Text to replace, or delete if absent.
-Note: Each instance of {old} is replaced with {new}.
+Note: Use * to replace every instance of {old} with {new}; otherwise {old}
+must occur at the start of the path.
Examples
diff -urp 1900-1/help/cmdline/syntax.htm 1900-3/help/cmdline/syntax.htm
--- 1900-1/help/cmdline/syntax.htm 2020-03-03 18:10:52 +1000
+++ 1900-3/help/cmdline/syntax.htm 2020-03-03 18:06:51 +1000
@@ -73,7 +73,8 @@ use a * wildcard.
?a* | means all files with a second character of "a" |
*1* | means all names that contains character "1" |
*.*.* | means all names that contain two at least "." characters |
- f* | will match "dir\file", but not "folder\name" (matches from the end) |
+ f* | in list/extract will match "dir\file", but not "folder\name" (matches from the end) |
+ \f* | in list/extract will match "folder\name", but not "dir\file" (matches from the start) |
-r f* | will match "dir\folder\name" (matches any component) |
diff -urp 1900-1/help/start.htm 1900-3/help/start.htm
--- 1900-1/help/start.htm 2020-03-03 18:10:52 +1000
+++ 1900-3/help/start.htm 2020-03-03 18:03:43 +1000
@@ -10,7 +10,7 @@
7-Zip
-Welcome to 7-Zip 19.00a
+Welcome to 7-Zip 19.00a2
7-Zip is a file archiver with a high compression ratio.
The documentation for 7-Zip includes: