/* ----------------------------------------------------------------------- */
/* J-Source Version 4.1 - COPYRIGHT 1992 Iverson Software Inc.             */
/* 33 Major Street, Toronto, Ontario, Canada, M5S 2K9, (416) 925 6096      */
/*                                                                         */
/* J-Source is provided "as is" without warranty of any kind.              */
/*                                                                         */
/* J-Source Version 4.1 license agreement:  You may use, copy, and         */
/* modify the source.  You have a non-exclusive, royalty-free right        */
/* to redistribute source and executable files.                            */
/* ----------------------------------------------------------------------- */
/*                                                                         */
/* Modified version of WATCOM C/386 wstub.c                                */

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <process.h>
#include <string.h>
#include <mfcf/libc/string.h>

typedef char C;

main(int argc, C**argv){C**av;int ac=2+argc,m=sizeof(C*);
 av=malloc(m*ac);
 if(!av){puts("Stub failed to allocate argv.\n"); exit(1);}
 memcpy(1+av,argv,m*argc);
 av[0]="dos4gw.exe";
 av[1]=getenv("387")||getenv("486")?"j387.le":"jemu.le";
 av[ac-1]=0;
 putenv("DOS4G=quiet");
 execvp(av[0],av);
 puts("Stub exec failed: dos4gw.exe "); puts(strerror(errno)); exit(1);
}

