@if not "%1" == ""  goto MARKE1
@ECHO    /****************************************************************/
@ECHO    /**                       D L I N K                            **/
@ECHO    /**                                                            **/
@ECHO    /** DLINK links programs using the DISLIN Fortran library.     **/
@ECHO    /**                                                            **/
@ECHO    /** Command:  DLINK   [option]  main                           **/
@ECHO    /**                                                            **/
@ECHO    /** option    is an optional qualifier that may have one of    **/
@ECHO    /**           the following values:                            **/
@ECHO    /**      -c   to compile programs before linking               **/
@ECHO    /**      -r   to run programs after linking                    **/
@ECHO    /**      -a   to compile, link and run programs.               **/
@ECHO    /**                                                            **/
@ECHO    /** main      is the name of the main program.                 **/
@ECHO    /**                                                            **/
@ECHO    /** Example:  DLINK  -a   TEST                                 **/
@ECHO    /** Version:  MS-DOS, G77 for DJGPP v.20                       **/  
@ECHO    /****************************************************************/
@goto ENDE
:MARKE1
@if "%DISLIN%" == "" goto ERROR
@if %1 ==  -c	goto COMPILE
@if %1 ==  -C	goto COMPILE
@if %1 ==  -a	goto COMPILE
@if %1 ==  -A	goto COMPILE
@if %1 ==  -r	goto MARKE2
@if %1 ==  -R	goto MARKE2
@goto  LINK
:COMPILE
g77 -c %2.for
@if not errorlevel 1 goto MARKE2
@goto ENDE
:MARKE2
g77 %2.o -o %2.exe %DISLIN%\dislin.a %DISLIN%\disgrx.a
@rem g77 %2.o -o %2.exe %DISLIN%\dislin.a -lgrx20
@if %1 ==  -a	goto RUN
@if %1 ==  -A	goto RUN
@if %1 ==  -r	goto RUN
@if %1 ==  -R	goto RUN
@goto ENDE
:LINK
g77 %1.o -o %1.exe %DISLIN%\dislin.a %DISLIN%\disgrx.a
@rem g77 %1.o -o %1.exe %DISLIN%\dislin.a -lgrx20
@GOTO ENDE
:RUN
@if not errorlevel 1 goto MARKE3
@goto ENDE
:MARKE3
%2
@goto ENDE
:ERROR
@echo "The environment DISLIN is not defined."
:ENDE
