@echo off
rem NeXtMidas build script
rem @author Jeff Schoen
rem @version $Id: nmedit.bat,v 1.5 2001/11/17 16:51:43 grass Exp $

set routine=bogus
set area=%NM_DIR%
set option=%NM_OPT%
if NOT [%1]==[] set routine=%1
if NOT [%2]==[] set area=%2
if NOT [%3]==[] set option=%3

call nmsfset root opt.%option%
if [%root%]==[NotFound] set root=%NMROOT%

set cdir=%root%\nxm\%option%\%area%
set cpath=%cdir%\%routine%
set lpath=%cdir%\lib%routine%

call nmsfset nm_editor env.editor
if [%root%]==[NotFound] set nm_editor=edit

if not exist %cpath% goto NO_RAW
%NM_EDITOR% %cpath%
:NO_RAW

if not exist %cpath%.c goto NO_C
%NM_EDITOR% %cpath%.c
:NO_C

if not exist %cpath%.mm goto NO_MM
%NM_EDITOR% %cpath%.mm
:NO_MM

if not exist %cpath%.cnf goto NO_CNF
%NM_EDITOR% %cpath%.cnf
:NO_CNF

if not exist %cpath%.java goto NO_JAVA
%NM_EDITOR% %cpath%.java
%NM_OS%\nmbld %routine% %area% %option%
:NO_JAVA

set nm_editor=

