Line data Source code
1 : // This file (util_main.cc) was created by Ron Rechenmacher <ron@fnal.gov> on
2 : // May 13, 2015. "TERMS AND CONDITIONS" governing this file are in the README
3 : // or COPYING file. If you do not have such a file, one can be obtained by
4 : // contacting Ron or Fermi Lab in Batavia IL, 60510, phone: 630-840-3000.
5 : // $RCSfile: .emacs.gnu,v $
6 : // rev="$Revision: 1.23 $$Date: 2012/01/23 15:32:40 $";
7 :
8 : #include "dtcInterfaceLib/DTC_Data_Verifier.h"
9 :
10 : #include "TRACE/tracemf.h"
11 : #define TRACE_NAME "data_file_verifier"
12 :
13 0 : void printHelpMsg()
14 : {
15 0 : std::cout << "Verifies the DMA and Data block content of DTC binary file(s)" << std::endl;
16 0 : std::cout << "Usage: data_file_verifier [options] file.."
17 0 : << std::endl;
18 : std::cout
19 0 : << "Options are:" << std::endl
20 0 : << " -h, --help: This message." << std::endl
21 0 : << std::endl;
22 0 : exit(0);
23 : }
24 :
25 0 : int main(int argc, char* argv[])
26 : {
27 0 : std::vector<std::string> binaryFiles;
28 0 : for (auto optind = 1; optind < argc; ++optind)
29 : {
30 0 : if (argv[optind][0] == '-')
31 : {
32 0 : switch (argv[optind][1])
33 : {
34 0 : case '-': // Long option
35 : {
36 0 : auto option = DTCLib::Utilities::getLongOptionOption(&optind, &argv);
37 0 : if (option == "--help")
38 : {
39 0 : printHelpMsg();
40 : }
41 0 : break;
42 0 : }
43 0 : default:
44 0 : TLOG(TLVL_ERROR) << "Unknown option: " << argv[optind] << std::endl;
45 0 : printHelpMsg();
46 0 : break;
47 0 : case 'h':
48 0 : printHelpMsg();
49 0 : break;
50 : }
51 : }
52 : else
53 : {
54 0 : binaryFiles.push_back(std::string(argv[optind]));
55 : }
56 : }
57 :
58 0 : for (auto& file : binaryFiles)
59 : {
60 0 : DTCLib::DTC_Data_Verifier verifier;
61 0 : verifier.VerifyFile(file);
62 0 : }
63 0 : }
|