diff --git a/man/par2.1 b/man/par2.1 index c0072604..4e4da1d2 100644 --- a/man/par2.1 +++ b/man/par2.1 @@ -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 @@ -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 +Memory (in MB) to use (default is half of total physical memory) +.TP +.B \-t +.RB "Number of threads used for main processing (default auto-detected)" +.TP +.B \-T +.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 +Skip leaway (distance +/\- from expected block position, default 64) +.SH OPTIONS create +.TP .B \-b Set the Block\(hyCount (default 2000 when neither \-b nor \-s is specified) .TP .B \-s .RB "Set the Block\(hySize (don't use both " "\-b" " and " "\-s" ")" - .TP .B \-r Level of redundancy (percentage, default 5%) @@ -73,41 +108,11 @@ Uniform recovery file sizes (default is variable sizes) .B \-n .RB "Number of recovery files (max 31) (don't use both " "\-n" " and " "\-l" ")" .TP -.B \-m -Memory (in MB) to use (default is half of total physical memory) -.TP -.B \-t -.RB "Number of threads used for main processing (default auto-detected)" -.TP -.B \-T -.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 -Skip leaway (distance +/\- from expected block position, default 64) -.TP -.B \-B -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 diff --git a/src/commandline.cpp b/src/commandline.cpp index 8e0991b9..c7b2111b 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -110,6 +110,7 @@ void CommandLine::usage(void) "\"par2verify\", or \"par2repair\" instead.\n" "\n" "Options: (all uses)\n" + " -a : Set the main PAR2 archive name\n" " -B : 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" @@ -130,7 +131,6 @@ void CommandLine::usage(void) " -N : Data skipping (find badly mispositioned data blocks)\n" " -S : Skip leaway (distance +/- from expected block position, default 64)\n" "Options: (create)\n" - " -a : Set the main PAR2 archive name\n" " -b : Set the Block-Count (default 2000)\n" " -s : Set the Block-Size (don't use both -b and -s)\n" " -r : Level of redundancy (%, default 5%)\n" @@ -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; diff --git a/tests/test16 b/tests/test16 index da7fc895..e2f2dd94 100755 --- a/tests/test16 +++ b/tests/test16 @@ -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 diff --git a/tests/test16.ps1 b/tests/test16.ps1 index 6cff3571..ede93bf3 100644 --- a/tests/test16.ps1 +++ b/tests/test16.ps1 @@ -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" } @@ -36,4 +36,4 @@ catch { Write-Host "ERROR: $_" -ForegroundColor Red Complete-Test exit 1 -} \ No newline at end of file +} diff --git a/tests/test2 b/tests/test2 index e50bb7bf..5cafd448 100755 --- a/tests/test2 +++ b/tests/test2 @@ -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" diff --git a/tests/test2.ps1 b/tests/test2.ps1 index 0039164f..4555cb5b 100644 --- a/tests/test2.ps1 +++ b/tests/test2.ps1 @@ -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" } @@ -28,4 +28,4 @@ catch { Write-Host "ERROR: $_" -ForegroundColor Red Complete-Test exit 1 -} \ No newline at end of file +} diff --git a/tests/test6 b/tests/test6 index 5cd983e2..c678788a 100755 --- a/tests/test6 +++ b/tests/test6 @@ -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" diff --git a/tests/test6.ps1 b/tests/test6.ps1 index f5ce4f22..f1a0b478 100644 --- a/tests/test6.ps1 +++ b/tests/test6.ps1 @@ -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" } @@ -41,4 +41,4 @@ catch { Write-Host "ERROR: $_" -ForegroundColor Red Complete-Test exit 1 -} \ No newline at end of file +}