61int main(
int argc,
char* argv[])
66 signal(SIGILL, SIG_DFL);
67 signal(SIGBUS, SIG_DFL);
68 signal(SIGSEGV, SIG_DFL);
69 signal(SIGPIPE, SIG_DFL);
71 std::vector<std::string> args;
72 for (
int i=0; i<argc; i++) {
73 if (strcmp(argv[i],
"-h")==0)
75 args.push_back(argv[i]);
80 std::vector<std::string> files;
82 for (
unsigned int i=1; i<args.size(); i++) {
83 std::string arg = args[i];
88 httpPort = atoi(arg.c_str()+2);
89 }
else if (arg ==
"-h") {
91 }
else if (arg[0] ==
'-') {
94 files.push_back(args[i]);
103 snprintf(str,
sizeof(str),
"http:127.0.0.1:%d?cors", httpPort);
105 THttpServer* httpServer =
new THttpServer(str);
107 if (!httpServer->IsAnyEngine()) {
108 fprintf(stderr,
"ERROR: Cannot start web server on http port %d, see previous error message.\n", httpPort);
114 std::vector<TFile*> root_files;
116 for (
unsigned i=0; i<files.size(); i++) {
117 printf(
"file[%d]: %s\n", i, files[i].c_str());
119 TFile* f =
new TFile(files[i].c_str(),
"READ");
122 fprintf(stderr,
"Error: cannot open ROOT file \"%s\"\n", files[i].c_str());
131 root_files.push_back(f);
136 int nreq = httpServer->ProcessRequests();
144 bool intr = gSystem->ProcessEvents();
151 printf(
"Interrupted, shutting down!\n");
160 for (TFile* f: root_files) {