[parchive2-cvs] command_line_client/src/progs par2.cc,1.28,1.29
Status: Pre-Alpha
Brought to you by:
coppit
|
From: <ja...@us...> - 2003-05-07 01:50:27
|
Update of /cvsroot/parchive2/command_line_client/src/progs
In directory sc8-pr-cvs1:/tmp/cvs-serv5606/src/progs
Modified Files:
par2.cc
Log Message:
finished most functionality of the CLI
Index: par2.cc
===================================================================
RCS file: /cvsroot/parchive2/command_line_client/src/progs/par2.cc,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** par2.cc 5 May 2003 23:05:39 -0000 1.28
--- par2.cc 7 May 2003 01:50:23 -0000 1.29
***************
*** 11,15 ****
#include <list>
- #define YOURE_FEELING_LUCKY 0
char myTolower(char c)
--- 11,14 ----
***************
*** 48,52 ****
! string tempbuf = "Usage:\n par2 -c(--check) [options] <par archive>: Check parity archive\n par2 -r(--recover) [options] <par archive>: Restore missing volumes\n par2 -a(--add) [options] <par archive> [filenames] : Add files to parity archive\n\nOptions: \n -m (--move) : Move existing files out of the way\n -k (--keep) : Keep broken files\n -z (--nocreate) : Do not create parity volumes\n -i : Ignore case in filename comparisons\n -p (--redundancy) <float percentage> : Percent redundancy in parity files\n -v (--verbose): Give verbosity\n -V (--moreverbose) Give greater verbosity\n -h (--help) : Display this help\n --files <filenames> : Give between 1 and infinity files names\n \n";
parser.setUsage(tempbuf);
--- 47,51 ----
! string tempbuf = "Usage:\n par2 -c(--check) [options] <par archive>: Check parity archive\n par2 -r(--recover) [options] <par archive>: Restore missing volumes\n par2 -a(--add) [options] <par archive> [filenames] : Add files to parity archive\n\nOptions: \n -m (--move) : Move existing files out of the way\n -k (--keep) : Keep broken files\n -z (--nocreate) : Do not create parity volumes\n -i (--ignore) : Ignore case in filename comparisons\n -p (--redundancy) <float percentage> : Percent redundancy in parity files\n -v (--verbose): Give verbosity\n -V (--moreverbose) Give greater verbosity\n -h (--help) : Display this help\n --files <filenames> : Give between 1 and infinity files names\n \n";
parser.setUsage(tempbuf);
***************
*** 58,62 ****
//if no correct arguments, call help statement
- // parses the entire line --Recover should set -r flag
if(!parser.parseArgs(argc, argv)) {
parser.printUsage();
--- 57,60 ----
***************
*** 65,69 ****
string basename=parser.files_vector[0];
- cout << basename << endl;
string directory="";//should be present working directory
--- 63,66 ----
***************
*** 73,79 ****
//process information in stored by parseArgs
! //Implement like -i option (global)
! //Ex. cerr<<"Runnning Recover option."<<endl;
! //USE STDERR
if( parser.getFlgValue('v')){
--- 70,74 ----
//process information in stored by parseArgs
! //verbose mode
if( parser.getFlgValue('v')){
***************
*** 84,90 ****
}
! //Implement like -i option (global)
! //Want to print out more stuff in library
! //Ex. cerr<<"Running Reed-Solomon."<<endl;
if( parser.getFlgValue('V')){
--- 79,83 ----
}
! //More verbose mode
if( parser.getFlgValue('V')){
***************
*** 101,109 ****
}
! //Ex. User runs recover option, move files already in there out
! // of the way (DO NOT OVERWRITE THE FILES) can get filenames using
! // the get_path stuff in the file library
if( parser.getFlgValue('m')){
!
//place to store whether file is recoverable
--- 94,101 ----
}
! //move option -- not implemented yet
if( parser.getFlgValue('m')){
! cout << "under construction" << endl;
! return (1);
//place to store whether file is recoverable
***************
*** 127,134 ****
//checks to see if enough files to recover in this directory, using
// function from Par2_Library
- #if YOURE_FEELING_LUCKY
bool can_recover;
! p2.Check_Data_Files(basename, directory, files_map,can_recover);
! #endif
cout << "Checked " << basename << ".par2" << endl;
//CREATE A DIRECTORY TO MOVE THE FILES TO
--- 119,124 ----
//checks to see if enough files to recover in this directory, using
// function from Par2_Library
bool can_recover;
! //p2.Check_Data_Files(basename, directory, files_map,can_recover);
cout << "Checked " << basename << ".par2" << endl;
//CREATE A DIRECTORY TO MOVE THE FILES TO
***************
*** 141,148 ****
for ( file_and_status = files_map.begin(); file_and_status != files_map.end(); file_and_status++)
{
!
! if((*file_and_status).second == true)
! ;
! else {
//moves broken files into a directory called "movedfiles"
//might need to concatonate the filename too
--- 131,137 ----
for ( file_and_status = files_map.begin(); file_and_status != files_map.end(); file_and_status++)
{
! if((*file_and_status).second == true) {
!
! } else {
//moves broken files into a directory called "movedfiles"
//might need to concatonate the filename too
***************
*** 155,163 ****
}
! //Ex. Recovery, instead of missing the file may be corrupted (parchive
! // library may tell whether missing or corrupted)
! //File might be broken, implement LIKE THE MOVE FUNCTION
! //Same as move, just saves the broken files
if( parser.getFlgValue('k')){
//place to store whether file is recoverable
--- 144,151 ----
}
! //Keep option -not working yet
if( parser.getFlgValue('k')){
+ cout << "under construction" << endl;
+ return (1);
//place to store whether file is recoverable
***************
*** 180,187 ****
//checks to see if enough files to recover in this directory, using
// function from Par2_Library
- #if YOURE_FEELING_LUCKY
bool can_recover;
! p2.Check_Data_Files(basename, directory, files_map,can_recover);
! #endif
cout << "Checked " << basename << ".par" << endl;
//map of each file and status of recovery
--- 168,173 ----
//checks to see if enough files to recover in this directory, using
// function from Par2_Library
bool can_recover;
! //p2.Check_Data_Files(basename, directory, files_map,can_recover);
cout << "Checked " << basename << ".par" << endl;
//map of each file and status of recovery
***************
*** 225,231 ****
// function from Par2_Library ?files have to be in this directory?
bool can_recover;
! #if YOURE_FEELING_LUCKY
! p2.Check_Data_Files(basename, directory, files_map,can_recover);
! #endif
cout << "Checked " << basename << ".par" << endl;
cout << "Data files are recoverable." << endl;
--- 211,215 ----
// function from Par2_Library ?files have to be in this directory?
bool can_recover;
! //p2.Check_Data_Files(basename, directory, files_map,can_recover);
cout << "Checked " << basename << ".par" << endl;
cout << "Data files are recoverable." << endl;
***************
*** 253,258 ****
//Code for the recover option
if( parser.getFlgValue('r')){
- //present directory
- //Parchive2 r;
string directory="";
list<File> list_of_files;
--- 237,240 ----
***************
*** 269,273 ****
}
- //#if YOURE_FEELING_LUCKY
if(p2.Recover_Data_Files(list_of_files))
{
--- 251,254 ----
***************
*** 279,283 ****
could not find parity files.\n";
}
- //#endif
--- 260,263 ----
***************
*** 319,331 ****
}
! //Set value in library to set option for case (coppit already wrote the
! // files for the global variable Options.cc and Options.h)
! //set string to ignore case to true
! // set that where you want to check the filenames IN THE LIBRARY
! //Ex. Parchive2::options["ignorecaseinfiles"] = false;
! // like a STL map
! //IN LIBRARY: if (options["ignorecaseinfiles"] == true { do something}
if( parser.getFlgValue('i')){
!
list<File> realnames;
string destination_directory = ".";
--- 299,308 ----
}
! //ignore case -- not correct yet
if( parser.getFlgValue('i')){
! cout << "under construction" << endl;
! return (1);
!
!
list<File> realnames;
string destination_directory = ".";
|