[Mono-list] suggestion: should we rename mcs.exe?

Greg Haerr Greg Haerr" <greg@censoft.com
Sat, 6 Apr 2002 14:54:28 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_017D_01C1DD7A.F34DDF00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

: (it hands %1, %2, ... %9 to mint. Has anyone a solution to hand higher
: parameters too?)

Here's two C programs to eliminate the .bat files, which suffer
from increasing your PATH environment size every time
they execute, eventually the shell will run out of environment space.
Any number of parameters can be included.  This uses
mcs.exe renamed to monomcs.exe. 

There needs to be a way of having knowing the mono
installation directory, currently this is hardcoded.  Thoughts
on using an environment variable?

Regards,

Greg



: 
: On linux this is the same with a sh-file.
: Wouldn't it make sense to rename mcs.exe generally to libmcs.exe (or
: something like this)?
: 
: 
: - The linux-mcs-wrapper is included in mono - I think we should include
: mcs.bat in the install folder, too.
: 
: 
: mcs.bat:
: mint.exe libmcs.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
:

------=_NextPart_000_017D_01C1DD7A.F34DDF00
Content-Type: application/octet-stream;
	name="mcs.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="mcs.c"

/*
 * mcs wrapper for windows
 * 
 * 4/6/2002 Greg Haerr
 */
#include <stdio.h>
#include <stdlib.h>

#define MINT	"monomint.exe"
#define MCS		"monomcs.exe"
#define PATH	"c:\\mono-0.10\\install\\bin"
#define LIB		"c:\\mono-0.10\\install\\lib"

int
main(int ac, char **av)
{
	char *p;
	char **newav;
	int  i;
	char newpath[256];
	char mcspath[256];

	/* set PATH=*/
	if ((p = getenv("PATH")) == NULL)
		p = "";
	sprintf(newpath, "PATH=%s;%s;%s", PATH, LIB, p);
	putenv(newpath);

	/* copy args up one*/
	newav = malloc((ac+1)*sizeof(char **));
	if (!newav) {
		printf("No mem for args\n");
		exit(1);
	}
	for(i=ac+1; i>0; --i)
		newav[i] = av[i-1];

	/* run "[path]monomint [path]monomcs.exe [args]*/
	sprintf(newpath, "%s\\%s", PATH, MINT);
	newav[0] = newpath;
	sprintf(mcspath, "%s\\%s", PATH, MCS);
	newav[1] = mcspath;
	execv(newpath, newav);
	printf("Can't find %s\n", newpath);
	exit(1);
}

------=_NextPart_000_017D_01C1DD7A.F34DDF00
Content-Type: application/octet-stream;
	name="mint.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="mint.c"

/*
 * mint wrapper for windows
 * 
 * 4/6/2002 Greg Haerr
 */
#include <stdio.h>
#include <stdlib.h>

#define PROGRAM	"monomint.exe"
#define PATH	"c:\\mono-0.10\\install\\bin"
#define LIB		"c:\\mono-0.10\\install\\lib"

int
main(int ac, char **av)
{
	char *p;
	char newpath[256];

	/* set PATH=*/
	if ((p = getenv("PATH")) == NULL)
		p = "";
	sprintf(newpath, "PATH=%s;%s;%s", PATH, LIB, p);
	putenv(newpath);

	/* run "[path]monomint [args]"*/
	sprintf(newpath, "%s\\%s", PATH, PROGRAM);
	av[0] = newpath;
	execv(newpath, av);
	printf("Can't find %s\n", newpath);
	exit(1);
}

------=_NextPart_000_017D_01C1DD7A.F34DDF00--