Esempio n. 1
0
// interface functions
MF_API const char* MFFile_SystemPath(const char *pFilename)
{
	MFCALLSTACK;

	pFilename = pFilename ? pFilename : "";

#if defined(MF_IPHONE)
	const char *GetAppHome();
	return MFStr("%s/%s", GetAppHome(), pFilename);
#else
	return MFStr("./%s", pFilename);
#endif
}
Esempio n. 2
0
CLogManager::CLogManager()
{
	uint32 nVal;
	const char* s;

	//FocpLogFileSize
	s = GetEnvVar("FocpLogFileSize");
	nVal = FOCP_LOG_MAXFILE;
	if(s)
	{
		nVal = atoi(s);
		if(nVal < FOCP_LOG_MINFILE)
			nVal = FOCP_LOG_MINFILE;
		else if(nVal > FOCP_LOG_MAXFILE)
			nVal = FOCP_LOG_MAXFILE;
	}
	m_nLogFileSize = nVal*1048576;

	//FocpLogFileSize
	s = GetEnvVar("FocpLogFileNo");
	nVal = FOCP_LOG_FILENO;
	if(s)
	{
		nVal = atoi(s);
		if(nVal < 9)
			nVal = 9;
		else if(nVal > FOCP_LOG_FILENO)
			nVal = FOCP_LOG_FILENO;
	}
	m_nLogFileNo = nVal;

	m_nDmn = 0;
	m_nAin = 0;
	m_sHostIp[0] = '\0';
	GetHostIpList(m_sHostIp);

	m_bHold = true;

	m_bLocked = false;

	char sDate[20];
	GetFileDate(sDate);
	GetProgramFileName(m_sHome);
	m_sApp = GetAppName(m_sHome);
	GetAppHome(m_sHome, m_sApp);
	sprintf(m_sName, "%s%s", m_sApp, sDate);

	m_pFile = NULL;
	m_nFileId = 0;

	m_nSocket = socket(AF_INET, SOCK_DGRAM, 0);

	//FocpLogServerPort
	uint16 nPort = 2269;
	s = GetEnvVar("FocpLogServerPort");
	if(s)
	{
		nVal = atoi(s);
		if(nVal && nVal <= 65535)
			nPort = (uint16)nVal;
	}

	uint32 nAddr;
	s =  GetEnvVar("FocpLogServerAddr");
	if(s)
	{
		nAddr = inet_addr(s);
		if(nAddr == (uint32)(-1))
		{
			m_oMutex.Enter();
			struct hostent *hptr = gethostbyname(s);
			if(hptr)
				nAddr = *(uint32*)(hptr->h_addr_list[0]);
			else
				nAddr = inet_addr("127.0.01");
			m_oMutex.Leave();
		}
	}
	else
		nAddr = inet_addr("127.0.0.1");

	m_oServerAddr.sin_family = AF_INET;
	m_oServerAddr.sin_port = htons(nPort);
	m_oServerAddr.sin_addr.s_addr = nAddr;
}