#!/bin/csh -f
#
# NextMidas SourceCode Editor script
# p1=routine p2=area p3=option
#
# @author Jeff Schoen
# @version $Id: nmedit,v 1.4 2001/04/25 17:08:12 kingm Exp $
#
set routine = bogus
set area = $NM_DIR 
set option = $NM_OPT
if "$1" != "" set routine = $1
if "$2" != "" set area = $2
if "$3" != "" set option = $3
set editor = `$NM_OS/nmsf ENV.EDITOR`

if ( $area == "home" ) then
 set jpath = $HOME.$routine
 set cpath = $HOME/$routine
 set cdir  = $HOME
else
 set root = `$NM_OS/nmsf OPT.$option`
 if ( "$root" == "NotFound" ) set root = $NMROOT
 set jpath = nxm.$option.$area.$routine
 set cpath = $root/nxm/$option/$area/$routine
 set cdir  = $root/nxm/$option/$area
endif

if (-e $cpath.mm) then
  $editor $cpath.mm
  exit
endif

if (-e $cpath) then
  $editor $cpath
endif

if (-e $cpath.c) then
  $editor $cpath.c
endif

if (-e $cpath.cnf) then
  $editor $cpath.cnf
endif

if (-e $cpath.java) then
  $editor $cpath.java
  $NM_OS/nmbld $routine $area $option
endif

exit
