:
CALCHEP=/home/pukhov/CALCHEP/may_be_bug/calchep_2.5.6
export CALCHEP

if(test -r lock) then 
   echo \"lock\" file in the current directory tells us that CalcHEP 
   echo already was launched in this directory. See details about 
   echo the process in  \"lock\" file. If the process indeed was 
   echo  finished remove \"lock\" file to continue. 
   exit 1
fi 

echo host `uname -n` ,  process $$  >lock
   
trap "rm -f lock"  0 1 2 3 9 



. $CALCHEP/FlagsForSh

while :
do 
  $CALCHEP/bin/s_calchep $*
  err=$?
  case $err in 
     0) exit;; 
    20) ;;
    22)  
         $CALCHEP/bin/s_calchep -blind "[{{0" 
         cd results 
         . ./EXTLIB
         $CALCHEP/nCompil 1>/dev/null 2>/dev/null; $CALCHEP/ld_n
         err=$?
         if(test $err -eq 0) then
           echo n_calchep is created
         else 
           echo n_calchep is not created. 
         fi 
         break;;
     *) echo CalcHEP has finished with error code $err
      break 
  esac 
done 
