Skip to content
Merged
Show file tree
Hide file tree
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
73 changes: 39 additions & 34 deletions man/par2.1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Also:
.br
.SH DESCRIPTION
par2cmdline is a program for creating and using PAR2 files to detect damage in data files and repair them if necessary. It can be used with any kind of file.
.SH OPTIONS
.SH OPTIONS global
.TP
.B \-h
Show this help
Expand All @@ -41,16 +41,51 @@ Show version
.TP
.B \-VV
Show version and copyright
.SH OPTIONS all uses
.TP
.BI "\-a <" "file" ">"
Set the main PAR2 archive name; required on create, optional for verify and repair
.TP
.B \-B <" "path" ">"
Set the basepath to use as reference for the datafiles
.TP
.B \-v [\-v]
Be more verbose
.TP
.B \-q [\-q]
.RB "Be more quiet (" "\-q \-q" " gives silence)"
.TP
.B \-m<n>
Memory (in MB) to use (default is half of total physical memory)
.TP
.B \-t<n>
.RB "Number of threads used for main processing (default auto-detected)"
.TP
.B \-T<n>
.RB "Number of files hashed in parallel (default 2)"
.TP
.B \-\-
Treat all following arguments as filenames
.SH OPTIONS verify or repair
.TP
.B \-p
Purge backup files and par files on successful recovery or when no recovery is needed
.TP
.B \-O
Rename-only mode (skip files that are not perfect matches, useful for quickly fixing renamed files)
.TP
.B \-N
data skipping (find badly mispositioned data blocks)
.TP
.B \-S<n>
Skip leaway (distance +/\- from expected block position, default 64)
.SH OPTIONS create
.TP
.B \-b<n>
Set the Block\(hyCount (default 2000 when neither \-b nor \-s is specified)
.TP
.B \-s<n>
.RB "Set the Block\(hySize (don't use both " "\-b" " and " "\-s" ")"

.TP
.B \-r<n>
Level of redundancy (percentage, default 5%)
Expand All @@ -73,41 +108,11 @@ Uniform recovery file sizes (default is variable sizes)
.B \-n<n>
.RB "Number of recovery files (max 31) (don't use both " "\-n" " and " "\-l" ")"
.TP
.B \-m<n>
Memory (in MB) to use (default is half of total physical memory)
.TP
.B \-t<n>
.RB "Number of threads used for main processing (default auto-detected)"
.TP
.B \-T<n>
.RB "Number of files hashed in parallel (default 2)"
.TP
.B \-v [\-v]
Be more verbose
.TP
.B \-q [\-q]
.RB "Be more quiet (" "\-qq" " gives silence)"
.TP
.B \-p
Purge backup files and par files on successful recovery or when no recovery is needed
.TP
.B \-R
Recurse into subdirectories (only useful on create)
.TP
.B \-O
Rename-only mode (skip files that are not perfect matches, useful for quickly fixing renamed files)
.TP
.B \-N
data skipping (find badly mispositioned data blocks)
.TP
.B \-S<n>
Skip leaway (distance +/\- from expected block position, default 64)
.TP
.B \-B<path>
Set the basepath to use as reference for the datafiles
.TP
.B \-\-
Treat all following arguments as filenames
.B @
Process a listing of files specified in text (file) input
.SH EXITCODES
.TP
.B 0
Expand Down
35 changes: 16 additions & 19 deletions src/commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void CommandLine::usage(void)
"\"par2verify\", or \"par2repair\" instead.\n"
"\n"
"Options: (all uses)\n"
" -a<file> : Set the main PAR2 archive name\n"
" -B<path> : Set the basepath to use as reference for the datafiles\n"
" -v [-v] : Be more verbose\n"
" -q [-q] : Be more quiet (-q -q gives silence)\n"
Expand All @@ -130,7 +131,6 @@ void CommandLine::usage(void)
" -N : Data skipping (find badly mispositioned data blocks)\n"
" -S<n> : Skip leaway (distance +/- from expected block position, default 64)\n"
"Options: (create)\n"
" -a<file> : Set the main PAR2 archive name\n"
" -b<n> : Set the Block-Count (default 2000)\n"
" -s<n> : Set the Block-Size (don't use both -b and -s)\n"
" -r<n> : Level of redundancy (%, default 5%)\n"
Expand Down Expand Up @@ -309,26 +309,23 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv)
{
case 'a':
{
if (operation == opCreate)
std::string str = argv[0];
bool setparfile = false;
if (str == "-a")
{
std::string str = argv[0];
bool setparfile = false;
if (str == "-a")
{
setparfile = SetParFilename(argv[1]);
argc--;
argv++;
}
else
{
setparfile = SetParFilename(str.substr(2));
}
setparfile = SetParFilename(argv[1]);
argc--;
argv++;
}
else
{
setparfile = SetParFilename(str.substr(2));
}

if (! setparfile)
{
std::cerr << "failed to set the main par file" << std::endl;
return false;
}
if (! setparfile)
{
std::cerr << "failed to set the main par file" << std::endl;
return false;
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion tests/test16
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ echo $dashes

cd subdir1

$PARBINARY c -r2 test.par2 *.data ../subdir2/*.data > $testname.log || { echo "ERROR: creating files using PAR 2.0 failed" ; exit 1; } >&2
$PARBINARY c -r2 -a test.par2 *.data ../subdir2/*.data > $testname.log || { echo "ERROR: creating files using PAR 2.0 failed" ; exit 1; } >&2

# check if there were ignored files
grep 'Ignoring' "$testname.log" || { echo "ERROR: there were no files ignored"; exit 1; } >&2
Expand Down
4 changes: 2 additions & 2 deletions tests/test16.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ try {

Set-Location "subdir1"

$result = Invoke-Par2 -Arguments @("c", "-r2", "test.par2", "test-0.data", "test-1.data", "test-2.data", "test-3.data", "test-4.data", "..\subdir2\test-5.data", "..\subdir2\test-6.data", "..\subdir2\test-7.data", "..\subdir2\test-8.data", "..\subdir2\test-9.data") -ReturnObject
$result = Invoke-Par2 -Arguments @("c", "-r2", "-a", "test.par2", "test-0.data", "test-1.data", "test-2.data", "test-3.data", "test-4.data", "..\subdir2\test-5.data", "..\subdir2\test-6.data", "..\subdir2\test-7.data", "..\subdir2\test-8.data", "..\subdir2\test-9.data") -ReturnObject
if ($result.ExitCode -ne 0) {
Exit-TestWithError "creating files using PAR 2.0 failed"
}
Expand All @@ -36,4 +36,4 @@ catch {
Write-Host "ERROR: $_" -ForegroundColor Red
Complete-Test
exit 1
}
}
2 changes: 1 addition & 1 deletion tests/test2
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ echo $dashes
echo $banner
echo $dashes

$PARBINARY v testdata.par2 || { echo "ERROR: Initial PAR 2.0 verification failed" ; exit 1; } >&2
$PARBINARY v -a testdata.par2 || { echo "ERROR: Initial PAR 2.0 verification failed" ; exit 1; } >&2

cd "$TESTROOT"
rm -rf "run$testname"
Expand Down
4 changes: 2 additions & 2 deletions tests/test2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ try {

Write-Banner "Verifying using PAR 2.0 data"

$exitCode = Invoke-Par2 -Arguments @("v", "testdata.par2")
$exitCode = Invoke-Par2 -Arguments @("v", "-a", "testdata.par2")
if ($exitCode -ne 0) {
Exit-TestWithError "Initial PAR 2.0 verification failed"
}
Expand All @@ -28,4 +28,4 @@ catch {
Write-Host "ERROR: $_" -ForegroundColor Red
Complete-Test
exit 1
}
}
2 changes: 1 addition & 1 deletion tests/test6
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cp subdir1/test-2.data subdir1/test-2.data.orig
cp subdir2/test-7.data subdir2/test-7.data.orig

rm -f subdir1/test-2.data subdir2/test-7.data
$PARBINARY r testdata.par2 || { echo "ERROR: Reconstruction of two files using PAR 2.0 failed" ; exit 1; } >&2
$PARBINARY r -a testdata.par2 || { echo "ERROR: Reconstruction of two files using PAR 2.0 failed" ; exit 1; } >&2
cmp -s subdir1/test-2.data subdir1/test-2.data.orig && cmp -s subdir2/test-7.data subdir2/test-7.data.orig || { echo "ERROR: Repaired files do not match originals" ; exit 1; } >&2

cd "$TESTROOT"
Expand Down
4 changes: 2 additions & 2 deletions tests/test6.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ try {
Remove-Item "subdir1\test-2.data"
Remove-Item "subdir2\test-7.data"

$exitCode = Invoke-Par2 -Arguments @("r", "testdata.par2")
$exitCode = Invoke-Par2 -Arguments @("r", "-a", "testdata.par2")
if ($exitCode -ne 0) {
Exit-TestWithError "Reconstruction of two files using PAR 2.0 failed"
}
Expand All @@ -41,4 +41,4 @@ catch {
Write-Host "ERROR: $_" -ForegroundColor Red
Complete-Test
exit 1
}
}
Loading