示例#1
0
int	extractCron::do_job(char *jobdesc)
{
	ACE_SOCK_Connector conn;
	ACE_SOCK_Stream  peer;
	ACE_Time_Value tv(3, 0);
	ACE_INET_Addr	addr(harvestPort, harvestIPaddr);
	char	urlbuff[1024];
	StrStream	httpreq;
	int	ret;

	printf("JobDesc: %s\n", jobdesc);
	CGI::escape(urlbuff, jobdesc);
	httpreq.init(2); // 2 kilobytes buff
	httpreq.rawadd("GET /harvest?expr=");
	httpreq.rawadd(urlbuff);
	httpreq.rawadd(" HTTP/1.1\n\n");

	httpreq.print();
	
	if ( conn.connect(peer, addr) < 0) {
		printf("conn failed!\n");
		return 0;
	}

	ret = peer.send( httpreq.str(), httpreq.len() );
	return 0;
	
}
示例#2
0
int
main (int argc, char **argv)
{
	int	res=0;
	char fname[256];
	
	/*
	if (argc < 2) {
		printf("option: w for word, i for idiom\n");
		exit(0);
	}
	*/
	init_env();	

	HanChar::prepare();

	//test_nameValPairTable();
	
	/*
	res = dbStore::prepare(
		config.GetStrVal("DBNAME", "ANYDICT"),
		config.GetStrVal("DBID", "inisoft"),
		config.GetStrVal("DBPASS", "gksehf")
		);
	*/
	//res = dbStore::prepare( "ANYDICT2", "inisoft", "gksehf");
	if (res < 0) {
		return -1;
	}

	HDict::load(adhome);
	HGram::load(adhome);

	printf("### %s", argv[0]);
	if (argc > 1) printf("\tOption: %s", argv[1]);
	printf("\n\n");

	printf("# JH2WS_TABSIZE = %d\n", JH2WS_TABSIZE);
	if (argc > 1 && argv[1][0]=='w') {
		HanChar::printCodeTab();
	}
	
	if (argc > 1 && argv[1][0]=='y') {
		HanChar::printSylInfo();
	}

	if (argc > 1 && argv[1][0]=='d') {
		HDict::printList();
	}

	if (argc > 1 && argv[1][0]=='c') {
		HDict::printListConjOnly();
	}

	if (argc > 1 && argv[1][0]=='a') {
		HDict::printListAuxOnly();
	}

	if (argc > 1 && argv[1][0]=='j') {
		HDict::printListJosaOnly();
	}

	if (argc > 1 && argv[1][0]=='e') {
		HDict::printListEomiOnly();
	}
	
	if (argc > 1 && argv[1][0]=='g') {
		HGram::printList();
	}
	
	if (argc > 1 && argv[1][0]=='s') {
		StrStream resStr;
		resStr.init(10*1024);
		HProc::test_stemmer( StrUtil::path_merge(fname, adhome, "dataH/test-howtoberich.txt"),  resStr);
	}

	
	return 0;
		
}