From 3896ee587ebb93aee587b5c6f286c28705109be4 Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Thu, 15 Mar 2018 09:46:04 -0400
Subject: [PATCH] Sync main.C with podd version.   Fix annoyance of spurious
 extra prompt on exit   Add -l, -v and --version command line options

---
 src/main.C | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/main.C b/src/main.C
index 4b1d99d..6f57832 100644
--- a/src/main.C
+++ b/src/main.C
@@ -6,6 +6,7 @@
 
 #include "THcInterface.h"
 #include <iostream>
+#include <cstring>
 
 using namespace std;
 
@@ -13,9 +14,26 @@ int main(int argc, char **argv)
 {
   // Create a ROOT-style interactive interface
 
+  // Handle convenience command line options
+  bool print_version = false, no_logo = false;
+  for( int i=1; i<argc; ++i ) {
+    if( !strcmp(argv[i],"-l") )
+      no_logo = true;
+    else if( !strcmp(argv[1],"-v") || !strcmp(argv[1],"--version") ) {
+      print_version = true;
+      break;
+    }
+  }
+
+  if( print_version ) {
+    cout << "hcana using " << THcInterface::GetVersionString() << endl;
+    return 0;
+  }
+
+
   TApplication *theApp = 
-    new THcInterface( "The Hall C analyzer", &argc, argv );
-  theApp->Run(kTRUE);
+    new THcInterface( "The Hall C analyzer", &argc, argv, 0, 0, no_logo );
+  theApp->Run(kFALSE);
 
   cout << endl;
 
-- 
GitLab