Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
merge.cpp File Reference
#include "merge/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

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file merge.cpp.

22  {
23  bool dbg = false, fixup = true;
24  vector<string> input;
25  string output;
26  for ( int i = 1; i < argc; ++i ) {
27  if ( *argv[i] == '-' ) {
28  switch ( ::toupper( *( argv[i] + 1 ) ) ) {
29  case 'N':
30  fixup = false;
31  break;
32  case 'D':
33  dbg = true;
34  break;
35  case 'O':
36  if ( i + 1 < argc ) output = argv[i + 1];
37  ++i;
38  break;
39  case 'I':
40  if ( i + 1 < argc ) input.push_back( argv[i + 1] );
41  ++i;
42  break;
43  default:
44  return usage();
45  }
46  }
47  }
48  if ( input.empty() ) {
49  ::printf( "\nERROR: No input file(s) supplied\n\n" );
50  return usage();
51  } else if ( output.empty() ) {
52  ::printf( "\nERROR: No output file supplied.\n\n" );
53  return usage();
54  }
55  gROOT->SetBatch( kTRUE );
56  s_err = SetErrorHandler( err_handler );
57  for ( size_t i = 0; i < input.size(); ++i ) {
58  const string& in = input[i];
59  bool do_fixup = fixup && ( ( i + 1 ) == input.size() );
60  //::printf("+++ Target:%s\n+++ Source file:%s Fixup:%s Dbg:%s %d %d\n",
61  // output.c_str(),in.c_str(),do_fixup ? "YES" : "NO",dbg ? "YES" : "NO",i,input.size());
62  int result = merge( output.c_str(), in.c_str(), do_fixup, dbg );
63  if ( result == MERGE_ERROR ) {
64  printf( "\nERROR: File merge failed after %ld files.\n\n", long( i + 1 ) );
65  return 1;
66  }
67  }
68  return 0;
69 }
list argv
Definition: gaudirun.py:294
void usage(std::string argv0)
T printf(T...args)
void toupper(std::string &s)
T merge(T...args)