AW: [Mono-list] Windows: Propagating exit codes in .bat files?
Shantanu Kumar
shantanu@ax100.net
Tue, 04 May 2004 02:00:34 +0530
On Mon, 2004-05-03 at 23:43, Cory Nelson wrote:
> Why not just package a small wrapping mcs.exe to stick in \Windows
> with the install?
>
> #include <string.h>
> #include <windows.h>
>
> int main(void) {
> char *cmdline=GetCommandLine();
> char *args=strchr(cmdline, ' ');
>
> char mcs[MAX_PATH]="C:\\mono\\mono.exe C:\\mono\\mcs.exe";
> if(args!=NULL) strcat(mcs, args);
>
> return system(mcs);
> }
>
That is a good idea. To avoid ambiguity (while PATH resolution), the original EXE files in Mono/bin may be renamed to something else (e.g. go-mcs.exe instead of mcs.exe ;-).
In the code above, three inserts would be needed in the middle, for
1. Replacement code for "setlocal"
2. Setting PATH
2. Replacement code for "endlocal"
Setlocal and endlocal are not available on Win9x.
Regards,
Shantanu