示例#1
0
KPROXY_API f8_int kproxy_shell_ex(
	const char * cmd, 
	__uint timeout, 
	void * reserved
	)
{
	f8_uuid	oldUuid;
	struct proxy_shell_param psp;
	int code;
	CArgsExA a;
	int i;

	oldUuid = sections->h.uuid;
	a.parse(cmd, ";", 256, strlen(cmd) + 1, __true);
	for(i=0; i<a.argc; i++){
		psp.timeout = timeout;	
		if(!shell_execute_ex(g_shell, a.argv[i], &psp, &code)){
			code = F8_UNKNOWN_COMMAND;
		}
	}
	
	if(F8_FAILED(code)){
		utils_error(
			"<* PROXY_SHELL:`%s' returns %d(%s) *>\n", 
			cmd, 
			code, 
			_errmsg(code)
			);
	}else if(!proxy_silent){
		utils_debug(
			"<* PROXY_SHELL:`%s' returns %d(%s) *>\n", 
			cmd,
			code, 
			_errmsg(code)
			);
	}

/* if executing inside on_play(), no autosave is made as that will
degrade performance */
	if(!proxy_silent)
		autoSave(0,0);
	
	if(oldUuid != sections->h.uuid){
		move_resource(&oldUuid, &sections->h.uuid);
	}
	
	return code;
}
示例#2
0
FILE *
zfopen(int severity, char *path, char *type)
{
	FILE	*fp;	/* file pointer */

	if ((fp = fopen(path, type)) == NULL) {
		char	*mode;

		if (type[1] == '+')
			mode = "updating";
		else
			switch (type[0]) {
			case 'r':
				mode = "reading";
				break;
			case 'w':
				mode = "writing";
				break;
			case 'a':
				mode = "appending";
				break;
			default:
				mode = type;
			}
		_errmsg("UXzfopen1", severity,
			"Cannot open file \"%s\" for %s.",
			path, mode);
	}
	return (fp);
}
示例#3
0
/*
	reconstruct register usage map.
	called upon opening project and uploading project
*/
__bool build_reg_map()
{
	CRegRequirementList req;

	req.m_bGatherForDelete = false;
	_traverse(sections, _gather_reg_usage, (__uint)&req);
	if(F8_FAILED(req.m_errcode)){
		utils_error("Warning : _gather_reg_usage failed %d(%s).\n", req.m_errcode, _errmsg(req.m_errcode));
	}
	req.Commit(__true);
	
	return __true;
}