File extundelete-0.2.0-01_output_dir.patch of Package extundelete

Description: create an additional option: --output-dir
 This allows restore files in a output specific directory
 instead  default directory ./RESTORE_FILES
Forwarded: yes
Author: Elías Alejandro Año Mendoza <ealmdz@gmail.com>
Last-Update: 2010-10-25

===================================================================
--- extundelete.orig/src/extundelete.cc	2010-10-25 11:50:25.000000000 -0500
+++ extundelete/src/extundelete.cc	2010-10-25 12:01:12.000000000 -0500
@@ -466,6 +466,8 @@
   os << "  --restore-files 'path' Will restore files which are listed in the file 'path'.\n";
   os << "                         Each filename should be in the same format as an option\n";
   os << "                         to --restore-file, and there should be one per line.\n";
+  os << "  --output-dir 'path'    Restore files in the output dir 'path'.\n";
+  os << "                         By default the restored files are created under current directory 'RECOVERED_FILES'.\n";
   os << "  --restore-all          Attempts to restore everything.\n";
   os << "  -j journal             Reads an external journal from the named file.\n";
   os << "  -b blocknumber         Uses the backup superblock at blocknumber when opening\n";
@@ -601,6 +603,7 @@
 		opt_show_journal_inodes,
 		opt_restore_file,
 		opt_restore_files,
+		opt_output_dir,
 		opt_restore_directory,
 		opt_restore_inode,
 		opt_restore_all,
@@ -626,6 +629,7 @@
 		{"restore-inode", 1, &long_option, opt_restore_inode},
 		{"restore-file", 1, &long_option, opt_restore_file},
 		{"restore-files", 1, &long_option, opt_restore_files},
+		{"output-dir", 1, &long_option, opt_output_dir},
 		{"restore-directory", 1, &long_option, opt_restore_directory},
 		{"restore-all", 0, &long_option, opt_restore_all},
 		{"show-hardlinks", 0, &long_option, opt_show_hardlinks},
@@ -688,6 +692,21 @@
 			case opt_restore_files:
 				commandline_restore_files = optarg;
 				break;
+			case opt_output_dir:
+				{
+				std::string optarg1 = optarg;
+				int subcad = optarg1.find_last_of("/");
+				std::string res = optarg1.substr(subcad+1);
+					if(res!="")
+						{
+						outputdir = optarg1 + "/RECOVERED_FILES/";
+						}
+					else
+						{
+						outputdir = optarg1 + "RECOVERED_FILES/";
+						}
+				}
+				break;
 			case opt_restore_directory:
 				commandline_restore_directory = optarg;
 				break;
openSUSE Build Service is sponsored by