#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <process.h>
#include <libp.h>
																	   
int _ll_spawn(char *file, char *parms, char *env)
{
	PROCESS_INFORMATION pi;
   STARTUPINFO si ;
	DWORD rv ;
   char buf[1000];
	memset(&si,0,sizeof(si)) ;
   sprintf(buf,"%s %s",file,parms) ;
   MessageBox(0,buf,file,0) ;
   if (CreateProcess(file,buf,0,0,FALSE,
						NORMAL_PRIORITY_CLASS,
						(LPVOID)env,0,&si,&pi)) {
		WaitForSingleObject(pi.hProcess,INFINITE);
		GetExitCodeProcess(pi.hProcess,&rv) ;
		CloseHandle(pi.hProcess);
		CloseHandle(pi.hThread) ;
		return FALSE ;
	} else
		return TRUE ;

}
int system(const char *string)
{
	FILE *f;
	char buf[100],*a;
	a = getenv("COMSPEC");
	if (!a)
		a = searchpath("cmd.exe");
	if (!string) {
		if (!a)
			return 0;
		else
			if (f = fopen(a,"r")) {
				fclose(f);
				return 1;
			}
			else
				return 0;
	}
	if (!a) {
		errno = ENOENT;
		return -1;
	}
	buf[0] = ' ';
	buf[1] = '-';
	buf[2] = 'C';
	strcpy(buf+3,string);
	spawnlp(P_WAIT,a,a,buf,0);
	return 0;
}