From 5afc3f8ae1e04fc8d4ebb16eb3cb45ef91a256c4 Mon Sep 17 00:00:00 2001
From: Brad Sawatzky <brads@jlab.org>
Date: Thu, 14 Sep 2017 17:10:15 -0400
Subject: [PATCH] Tweak 'interactive shell' fallback so it is more general

- Apparently  $?loginsh is not a good indicator of whether tcsh is
  interactive (bad Google...) so we'll look for 'setup.csh' in the
  current directory and if it is present assume it is the hcana/
  directory.
- The if($?prompt) clause should print some info text if you're
  interactive.  (Although it's not definitive either -- dammit csh.)

-- Brad
---
 setup.csh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/setup.csh b/setup.csh
index 999258d..6a543dc 100644
--- a/setup.csh
+++ b/setup.csh
@@ -1,11 +1,13 @@
-#!/bin/tcsh
+#!/bin/csh
 
-if ( $?loginsh ) then
+if ( -r "./setup.csh" ) then
   set MYDIR=`pwd`
-  echo "--> Setting HCANALYZER to $MYDIR"
+  if ($?prompt) then
+    echo "--> Setting HCANALYZER to '$MYDIR'"
+  endif
 else
   if ( "$1" == "" ) then
-    echo "ERROR:  'setup.csh' must have a path to the hcana location as its argument"
+    echo "ERROR:  'setup.csh' should have a path to the hcana location as its argument."
     echo "   Often this is also the location of the setup.csh script itself:"
     echo "     source /my/path/to/setup.csh /my/path/to/setup.csh"
     echo "   Or, if you have already cd'd into the hcana directory, then you can call:"
-- 
GitLab