Hi folks!

I need get return code from dosemu programms in my unix shell.

Example:
% dosemu -dumb asm96000.exe -B tmp/moto.cln -L tmp/moto.alst -- simple.asm
Motorola DSP96000 Assembler  Version 5.0.1
(C) Copyright Motorola, Inc. 1989-1992.  All rights reserved.
**** 10 [simple.asm 10]: ERROR --- Unrecognized mnemonic: asdf
make: *** [simple_m.bin] Ошибка 1
% echo %?
=> 1

But command  "echo %?" return 0.

I wrote patch (see attacment), if write in DOS: "exitemu 22", dosemu return 22.

But patch very stupid. And for run asm96000.exe in uxix sheel need
create file run.bat:
 @echo off
 dosemu -dumb asm96000.exe -B tmp/moto.cln -L tmp/moto.alst -- simple.asm
 exitemu %ERRORLEVEL%

And run it:
 dosemu -dumb "run.bat"

But logic tell: You need only write in DOS prompt:
 dosemu -dumb asm96000.exe -B tmp/moto.cln -L tmp/moto.alst -- simple.asm
write in unix shell:
 echo %?
and get:
 1

Any ideas about it?
Sorry my English.
diff -rc dosemu-1.4.0/src/base/async/int.c dosemu-1.4.0.new/src/base/async/int.c
*** dosemu-1.4.0/src/base/async/int.c	2007-05-04 05:59:48.000000000 +0000
--- dosemu-1.4.0.new/src/base/async/int.c	2009-06-24 12:31:24.000000000 +0000
***************
*** 105,110 ****
--- 105,112 ----
     }
  }
  
+ extern int ERRORLEVEL; //FIXME
+ 
  static void process_master_boot_record(void)
  {
    /* Ok, _we_ do the MBR code in 32-bit C code,
***************
*** 542,548 ****
        dbug_printf("DOS termination requested\n");
        if (config.cardtype != CARD_NONE)
  	p_dos_str("\n\rLeaving DOS...\n\r");
!       leavedos(LO(bx));
      }
      break;
  
--- 544,551 ----
        dbug_printf("DOS termination requested\n");
        if (config.cardtype != CARD_NONE)
  	p_dos_str("\n\rLeaving DOS...\n\r");
!       exit(ERRORLEVEL);
!       //leavedos(LO(bx));
      }
      break;
  
diff -rc dosemu-1.4.0/src/plugin/commands/commands.c dosemu-1.4.0.new/src/plugin/commands/commands.c
*** dosemu-1.4.0/src/plugin/commands/commands.c	2007-05-04 05:59:48.000000000 +0000
--- dosemu-1.4.0.new/src/plugin/commands/commands.c	2009-06-24 12:30:03.000000000 +0000
***************
*** 39,44 ****
--- 39,46 ----
  
  /* ============= old .com ported ================= */
  
+ int ERRORLEVEL;
+ 
  static int do_doshelper(int ax, int bx)
  {
  	LWORD(eax) = ax;
***************
*** 159,164 ****
--- 161,169 ----
  
  int exitemu_main(int argc, char **argv)
  {
+ 	if(argc > 1)
+ 		ERRORLEVEL=atoi(argv[1]);
+ 
  	do_doshelper(DOS_HELPER_REALLY_EXIT, 0);
  	return 0;
  }
------------------------------------------------------------------------------
_______________________________________________
Dosemu-devel mailing list
Dosemu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dosemu-devel

Reply via email to