| 8 |
#include <dirent.h> |
#include <dirent.h> |
| 9 |
} |
} |
| 10 |
|
|
|
|
|
|
|
|
| 11 |
using namespace pamela; |
using namespace pamela; |
| 12 |
using namespace log4cxx; |
using namespace log4cxx; |
| 13 |
using namespace std; |
using namespace std; |
| 15 |
|
|
| 16 |
static LoggerPtr logger = Logger::getLogger(_T("pamela.techmodel.TechmodelReader")); |
static LoggerPtr logger = Logger::getLogger(_T("pamela.techmodel.TechmodelReader")); |
| 17 |
|
|
| 18 |
|
int GetYODAver(){ |
| 19 |
|
return(60312); |
| 20 |
|
}; |
| 21 |
|
|
| 22 |
int main(int argc, char* argv[]) { |
int main(int argc, char* argv[]) { |
| 23 |
|
|
| 24 |
stringstream oss; |
stringstream oss; |
| 26 |
bool multiFile = 0; |
bool multiFile = 0; |
| 27 |
short compression = 3; |
short compression = 3; |
| 28 |
char nomeFileLog[L_tmpnam]; |
char nomeFileLog[L_tmpnam]; |
| 29 |
tmpnam(nomeFileLog); |
mkstemp(nomeFileLog); |
| 30 |
DIR *dirp; |
DIR *dirp; |
| 31 |
char *outDir = ""; |
char *outDir = ""; |
| 32 |
|
|
| 54 |
if (argc < 2){ |
if (argc < 2){ |
| 55 |
//logger->info(_T("You have forgotten the file name.")); |
//logger->info(_T("You have forgotten the file name.")); |
| 56 |
cout << "You have forgotten the file name. \n"; |
cout << "You have forgotten the file name. \n"; |
| 57 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 58 |
exit(1); |
exit(1); |
| 59 |
} |
} |
| 60 |
|
|
| 61 |
if (!strcmp(argv[1], "--help")){ |
if (!strcmp(argv[1], "-help")){ |
| 62 |
cout << "Usage: yoda FILE [OPTION] \n"; |
cout << "Usage: yoda FILE [OPTION] \n"; |
| 63 |
cout << "\t --help print this help and exit \n"; |
cout << "\t -help print this help and exit \n"; |
| 64 |
|
cout << "\t -version print version number \n"; |
| 65 |
cout << "\t -p maximum number of packets to process [default all] \n"; |
cout << "\t -p maximum number of packets to process [default all] \n"; |
| 66 |
cout << "\t -multi generate multiple root files \n"; |
cout << "\t -multi generate multiple root files \n"; |
| 67 |
cout << "\t -c set the compression level for the generated root file(s). Values: [0,9] [default = 3]\n"; |
cout << "\t -c set the compression level for the generated root file(s). Values: [0,9] [default = 3]\n"; |
| 69 |
exit(1); |
exit(1); |
| 70 |
} |
} |
| 71 |
|
|
| 72 |
|
if (!strcmp(argv[1], "-version")){ |
| 73 |
|
printf(" Version %i \n",GetYODAver()); |
| 74 |
|
// cout << "$Name: $ $Revision: 6.5 $" << "\n"; |
| 75 |
|
exit(1); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
ifstream from (argv[1]); |
ifstream from (argv[1]); |
| 79 |
if (!from) { |
if (!from) { |
| 80 |
//logger->info(_T("The file does not exist.")); |
//logger->info(_T("The file does not exist.")); |
| 86 |
if (!strcmp(argv[i], "-p")){ |
if (!strcmp(argv[i], "-p")){ |
| 87 |
if (++i >= argc){ |
if (++i >= argc){ |
| 88 |
cerr << "-p needs arguments. \n"; |
cerr << "-p needs arguments. \n"; |
| 89 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 90 |
exit(1); |
exit(1); |
| 91 |
} |
} |
| 92 |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) { |
| 94 |
} else { |
} else { |
| 95 |
//logger->info(_T("The file does not exist.")); |
//logger->info(_T("The file does not exist.")); |
| 96 |
cerr << "-p needs a integer value. \n"; |
cerr << "-p needs a integer value. \n"; |
| 97 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 98 |
exit(1); |
exit(1); |
| 99 |
} |
} |
| 100 |
continue; |
continue; |
| 105 |
if (!strcmp(argv[i], "-c")){ |
if (!strcmp(argv[i], "-c")){ |
| 106 |
if (++i >= argc){ |
if (++i >= argc){ |
| 107 |
cerr << "-c needs arguments. \n"; |
cerr << "-c needs arguments. \n"; |
| 108 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 109 |
exit(1); |
exit(1); |
| 110 |
} |
} |
| 111 |
if ((isdigit(*argv[i])) && ( (atoi(argv[i]) >= 0) && (atoi(argv[i]) <= 9))) { |
if ((isdigit(*argv[i])) && ( (atoi(argv[i]) >= 0) && (atoi(argv[i]) <= 9))) { |
| 113 |
} else { |
} else { |
| 114 |
//logger->info(_T("The file does not exist.")); |
//logger->info(_T("The file does not exist.")); |
| 115 |
cerr << "-c needs a integer value beetween 0 and 9. \n"; |
cerr << "-c needs a integer value beetween 0 and 9. \n"; |
| 116 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 117 |
exit(1); |
exit(1); |
| 118 |
} |
} |
| 119 |
continue; |
continue; |
| 122 |
if (!strcmp(argv[i], "-o")){ |
if (!strcmp(argv[i], "-o")){ |
| 123 |
if (++i >= argc){ |
if (++i >= argc){ |
| 124 |
cerr << "-o needs arguments. \n"; |
cerr << "-o needs arguments. \n"; |
| 125 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 126 |
exit(1); |
exit(1); |
| 127 |
} |
} |
| 128 |
DIR* tempdir; |
DIR* tempdir; |
| 132 |
} else { |
} else { |
| 133 |
//logger->info(_T("The file does not exist.")); |
//logger->info(_T("The file does not exist.")); |
| 134 |
cerr << "-o needs an existing/accessable directory. \n"; |
cerr << "-o needs an existing/accessable directory. \n"; |
| 135 |
cout << "Try '--help' for more information. \n"; |
cout << "Try '-help' for more information. \n"; |
| 136 |
exit(1); |
exit(1); |
| 137 |
} |
} |
| 138 |
continue; |
continue; |
| 186 |
Run.WriteFiles(); |
Run.WriteFiles(); |
| 187 |
|
|
| 188 |
logger->info("<-------------------------------END UNPACKING------------------------------->\n"); |
logger->info("<-------------------------------END UNPACKING------------------------------->\n"); |
| 189 |
|
printf("Finished, exiting...\n"); |
| 190 |
|
|
| 191 |
//Momentarly suspended the save |
//Momentarly suspended the save |
| 192 |
//system(command.c_str()); |
//system(command.c_str()); |
| 193 |
} |
} |
| 194 |
|
|