void main( int argc, char *argv[] ) { char *av[4]; auto char cmdline[128]; av[0] = dos4g_path(); /* Locate the DOS/4GW loader */ av[1] = argv[0]; /* name of executable to run */ av[2] = getcmd( cmdline ); /* command line */ av[3] = NULL; /* end of list */ #ifdef QUIET putenv( "DOS4G=QUIET" ); /* disables DOS/4GW Copyright banner */ /* (note: you must display elsewhere) */ #endif execvp( (const char *)av[0], (const char **)av ); puts( "Stub exec failed:" ); puts( av[0] ); puts( strerror( errno ) ); exit( 1 ); /* indicate error */ }
main(int argc, char **argv) { /* Allocate arg vector with room for new av[0] and terminal NULL */ char **av = malloc( sizeof( char* ) * ( argc + 2 ) ); int ac; if( !av ) { puts( "Stub failed to allocate argv" ); exit( 1 ); } av[0] = dos4g_path(); /* Locate the DOS/4G loader */ /* Copy arguments */ for( ac = 0; ac < argc; ac++ ) av[ac+1] = argv[ac]; av[ac+1] = (void *)0; /* Terminate list */ #ifdef QUIET putenv( "DOS4G=QUIET" ); /* disables DOS/4G Copyright banner */ #endif execvp( av[0], av ); puts( "Stub exec failed:" ); puts( av[0] ); puts( strerror( errno ) ); exit( 1 ); /* indicate error */ }