The Gaudi Framework  master (37c0b60a)
merge.cpp File Reference
#include "merge.C"
#include <TError.h>
#include <cstdlib>
Include dependency graph for merge.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 32 of file merge.cpp.

32  {
33  bool dbg = false, fixup = true;
34  vector<string> input;
35  string output;
36  for ( int i = 1; i < argc; ++i ) {
37  if ( *argv[i] == '-' ) {
38  switch ( ::toupper( *( argv[i] + 1 ) ) ) {
39  case 'N':
40  fixup = false;
41  break;
42  case 'D':
43  dbg = true;
44  break;
45  case 'O':
46  if ( i + 1 < argc ) output = argv[i + 1];
47  ++i;
48  break;
49  case 'I':
50  if ( i + 1 < argc ) input.push_back( argv[i + 1] );
51  ++i;
52  break;
53  default:
54  return usage();
55  }
56  }
57  }
58  if ( input.empty() ) {
59  ::printf( "\nERROR: No input file(s) supplied\n\n" );
60  return usage();
61  } else if ( output.empty() ) {
62  ::printf( "\nERROR: No output file supplied.\n\n" );
63  return usage();
64  }
65  gROOT->SetBatch( kTRUE );
66  s_err = SetErrorHandler( err_handler );
67  for ( size_t i = 0; i < input.size(); ++i ) {
68  const string& in = input[i];
69  bool do_fixup = fixup && ( ( i + 1 ) == input.size() );
70  //::printf("+++ Target:%s\n+++ Source file:%s Fixup:%s Dbg:%s %d %d\n",
71  // output.c_str(),in.c_str(),do_fixup ? "YES" : "NO",dbg ? "YES" : "NO",i,input.size());
72  int result = merge( output.c_str(), in.c_str(), do_fixup, dbg );
73  if ( result == MERGE_ERROR ) {
74  printf( "\nERROR: File merge failed after %ld files.\n\n", long( i + 1 ) );
75  return 1;
76  }
77  }
78  return 0;
79 }
toupper
void toupper(std::string &s)
Definition: ExceptionSvc.cpp:36
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:173
std::vector
STL class.
std::vector::size
T size(T... args)
gaudirun.output
output
Definition: gaudirun.py:521
std::vector::push_back
T push_back(T... args)
std::printf
T printf(T... args)
std::string::c_str
T c_str(T... args)
merge
int merge(const char *target, const char *source, bool fixup=false, bool dbg=true)
Definition: merge.C:430
usage
void usage(const std::string &argv0)
Definition: listcomponents.cpp:40
std::vector::empty
T empty(T... args)
gaudirun.argv
list argv
Definition: gaudirun.py:327