Exemple #1
0
void FileList_R(cStringList &mylist, cString fullpath, bool usedirs) {
	cStringList split;
//	cerr<<"fullpath="<<fullpath<<endl;
	if(fullpath.Contains('*')) 
		split.FromString(fullpath,"*.");
	else
		split.FromString(fullpath,".");
	FileList_R(mylist,fullpath.ChopRt('/'),fullpath.ChopAllLf('/'),usedirs);
}
Exemple #2
0
void FileList_1(cStringList &mylist, cString fullpath, bool usedirs) {
	cStringList split;
	if(fullpath.Contains('*')) 
		split.FromString(fullpath,"*.");
	else
		split.FromString(fullpath,".");
		
	FileList_1(mylist,fullpath.ChopRt('/'),fullpath.ChopAllLf('/'),usedirs);
}
bool cPHP::System(cString fname,int &retval) {
	#ifdef WIN32
		retval=system((char*)fname);
	#else
	pid_t pid=fork();
	cExec myexec;
	myexec.FromCommandline(fname);
	bool background=false;
	
	
	myexec.SetVerbose(false);
	
	
	if(fname[-1]=='&'){
		background=true;
		fname=fname.ChopRt(1);
	}
	
	switch(pid) {
		case -1:
			if(background) signal(SIGCHLD,SIG_IGN);
		
			retval=-1;
			return false;
		break;
		case 0:
			if(background) signal(SIGCHLD,SIG_IGN);
			
			
	
			setenv("PATH","/bin:/usr/bin",1);
			if(!myexec.Exec()) {
				cerr<<"exec failed?"<<endl;
			}
			cerr<<"child exits 1"<<endl;
			exit(1);
		break;
	}
	if(background) {
		signal(SIGCHLD,SIG_IGN);
		retval=0;
	} else {
		waitpid(pid,&retval,0);
		
	}
	#endif
	return retval==0;
}