Example #1
0
/*
=================
Error

For abnormal program terminations
=================
*/
void Error( const char *error, ...)
{
  char out_buffer[4096];
  char tmp[4096];
	va_list argptr;

	va_start (argptr,error);
	vsprintf (tmp, error, argptr);
	va_end (argptr);

  sprintf( out_buffer, "************ ERROR ************\n%s\n", tmp );

  FPrintf( SYS_ERR, out_buffer );

#ifdef DBG_XML  
  DumpXML();
#endif

  //++timo HACK ALERT .. if we shut down too fast the xml stream won't reach the listener.
  // a clean solution is to send a sync request node in the stream and wait for an answer before exiting
  Sys_Sleep( 1000 );
  
  Broadcast_Shutdown();

	exit (1);
}
Example #2
0
int main(int argc, char **argv)
{
/*
	int i;
	char *pcDocRoot = NULL;
	int iPort = 0;

	for (i = 1; i < argc; i++)
	{
		if (i + 1 < argc && strcmp(argv[i], "-d") == 0)
			pcDocRoot = argv[++i];
		if (i + 1 < argc && strcmp(argv[i], "-p") == 0)
			iPort = String2Long(argv[++i]);
	}
	if (pcDocRoot == NULL || iPort == 0)
	{
		fprintf(stderr, "Usage:\n	-d HtmlDir -p port\n");
		return 0;
	}

	//RegisterEmbedFun("/Jpeg/*.jpg", tt, NULL);
	//RegisterEmbedFun("*", tt, NULL);
	RegisterEmbedFun("test", t, NULL);
*/
	char *pcDocRoot = "./";
	int aiPort[] = {80, 0};
	int aiSSLPort[] = {443, 0};
	RegisterEmbedFun("/", text, NULL);
	StartThttpdEx3(pcDocRoot, aiPort, aiSSLPort,
					10, 100, 3,
					NULL, NULL, NULL);

#if 0
	XML *pXML = CreateXML("eee");
	XML *pSub;
	XML *pSub1;
	XML *pSub2;
	SetString(pXML->plAttrib, "type", "text");
	SetString(pXML->plAttrib, "value", "mytest");
	SetString(pXML->plAttrib, "name", "test");

	pSub = AppendXML(pXML, NULL);

printf("%d %d %d\n", pXML, pSub,
GetParentXML(pSub)
);
	return 0;

	pSub = CreateXML("sub");
	pSub1 = AppendXML(pXML, pSub);
	SetString(pSub1->plAttrib, "sss", "eeeee");

	pSub = AppendXML(pXML, NULL);
	AppendXML(pSub, NULL);
	AppendXML(pSub, NULL);
	AppendXML(pSub, NULL);
	DumpXML(pXML, NULL, NULL);
	PTI;

	pSub2 = CreateXMLText("how ass s ss s s ");
	pSub2 = AppendXML(pSub1, pSub2);
	DumpXML(pSub1, NULL, NULL);

	PTI;
	pSub1 = DetachXML(pXML, pSub1);
	DumpXML(pXML, NULL, NULL);
	PTI;
	DumpXML(pSub1, NULL, NULL);

	DeleteXML(pXML);
	DeleteXML(pSub1);
	pt_mem_result();
#endif
}