Beispiel #1
0
int main(int argc, char *argv[]) {

	initConfig();
	if (!parseCmdLine(argc, argv))
		goto exit;

	if (estgbconf.isSingleton) {
		switch (checkSingleton()) {
		case 0:
			break; // No another instance found, continue to work
		case 1:
			goto exit;
			// Found another instance of bot, exiting
		case 2:
			printf("Error open PID file for singleton check\n");
			goto exit;
			// Something goes wrong, exiting
		}

	}

	if (!globalInit())
		goto exit;

	if (estgbconf.isDaemonize)
		daemon(0, 0);

	if (estgbconf.needUnescape) {
		estgbconf.text = zc_unescape(estgbconf.text);
		estgbconf.comment = zc_unescape(estgbconf.comment);
	}

	if (estgbconf.isScan >= 0) {
		scan();
		goto exit;
	}

	if (estgbconf.isWildcard)
		sendMultiple();
	else
		sendSingle();

	exit: freeConfig();
	return 0;
}
Beispiel #2
0
int main(int argc ,char* argv[])
{

    signal(SIGPIPE, sigPipeHandler);
    
    g_eggMemServerConfig = readcommandline(NULL, &argc, argv);

    char *eggPath;
    char *analyzerName;
    eggPath = realpath(argv[1], NULL);
    analyzerName = argv[2];
    
    checkSingleton(eggPath);
    
    g_mem_server = eggMemServer_new(g_eggMemServerConfig);

    g_hEggMemEggHandle = calloc(1, sizeof(*g_hEggMemEggHandle));
    assert(g_hEggMemEggHandle);
    if (argc < 3)
    {
        fprintf(stderr, "Usage: %s eggPath analyzerName\n", argv[0]);
        exit(-1);
    }

    if (EGG_FALSE == eggMemEggHandle_init(g_hEggMemEggHandle, eggPath, analyzerName))
    {
        exit(-2);
    }

    while (eggMemServer_get_request(g_mem_server))
    {
        ;
    }

    eggMemEggHandle_release(g_hEggMemEggHandle);
    free(g_hEggMemEggHandle);
    g_hEggMemEggHandle = NULL;
    eggMemServer_delete(g_mem_server);
    eggServiceServerConfig_delete(g_eggMemServerConfig);


    return 0;
}