" SS_updateprobe_ALL - A macro to install the autocalibration probe     "
"                      template SS_AutoCal_probe.template in the current"
"                      probe file. Current probe data will be overwritten"

"                      The existing information is backed up as         "
"                      probename.orig in the probename directory        "    

"                      The probefile must be local to the user          "

// Get the Exisiting probename
                
exists('probe','parameter','global'):$probe
if ($probe<0.5) then 
   write('error','Error: Probe parameter does not exist')
   abort
else
   if (probe='') then
      write('error','Error: Probe parameter not set')
      abort
   endif
endif

$probedir=''
exists(userdir+'/probes/'+ probe,'file'):$e
if ($e > 0.5) then
   $probedir = userdir+'/probes/'+ probe
else 
   write('error','Error: Local probe directory %s not found',probe)
   abort
endif

$probefile = $probedir + '/' + probe
exists($probefile,'file'):$e2
if ($e2<0.5) then
   write('error', 'Probefile is missing from probe directory')
   abort
endif

// Back up the probefile

$newprobefile = $probefile + '.orig'
mv($probefile, $newprobefile)

// Copy the probe template

$templatefile = userdir + '/maclib/SS_AutoCal_probe.template'
write('line3','%s',$templatefile)
exists($templatefile,'file'):$e
if($e>0) then 
   cp($templatefile,$probefile)
else 
   write('error','Probe template not found')
   abort
endif





