#!/bin/tcsh
if ($# < 1) then
  echo " "
  if (-e fitexample.f) then
    echo "fitexample.f is already present"
  else
    set b=`dirname $0`
    echo "fitexample.f created"
    cp $b/../lib/fitexample.f .
  endif
  echo " "
  echo "Create your own fit function:"
  echo " "
  echo "- rename fitexample.f to an other name (i.e. xxx.f)"
  echo "- edit xxx.f changing the parameter list and the function"
  echo "  and type"
  echo " "
  echo "     myfit -o xxx xxx.f"
  echo " "
  exit
endif
if ($# == 1) then
  if (-r "$1.f") then
    set argv=(-o $1 $1.f)
  else
    set f="${1}_"
    set s=${f:s/.f_//:s/.for_//}
    if ($s != $f && -r $1) then
      set argv=(-o $s $1)
    else
      echo "Usage: myfit -o xxx xxx.f"
      exit
    endif
  endif
  echo myfit $argv
endif
