Exemplo n.º 1
0
Arquivo: sigyn.c Projeto: alyx/sigyn
int main(int argc, char *argv[])
{
    me.ev = mowgli_eventloop_create();

    signals_init();

    parse_commandline_options(argc, argv);

    me.config = mowgli_config_file_load(config_file);

    if(me.config == NULL)
        sigyn_fatal("Cannot load configuration file.");
    logger_init(me.config->entries);
    config_check(me.config);

    me.uplink.line = new_conn(me.uplink.hostname, me.uplink.port, me.uplink.ssl, read_irc, NULL);
    if (me.uplink.line == NULL)
        sigyn_fatal("Connection to uplink failed.");
    me.uplink.connected = true;

    loadmodules(me.config->entries);

    sigyn_introduce_client(me.client->nick, me.client->user, NULL);
    if (should_fork)
        daemonise(SYSCONFDIR "/sigyn.pid");
    mowgli_eventloop_run(me.ev);

    sigyn_cleanup();
    return EXIT_SUCCESS;
}
Exemplo n.º 2
0
int main(int argc, const char **argv)
{
    base_eventloop = mowgli_eventloop_create ();
    
    irc_connect(argv[1], argv[2]);
    
    mowgli_eventloop_run (base_eventloop);
    return EXIT_SUCCESS; 
}
Exemplo n.º 3
0
int main(int argc, char *argv[])
{
	mowgli_eventloop_t *base_eventloop;

	/* Bleh this is needed to ensure some systems can set the process title */
	argv = mowgli_proctitle_init(argc, argv);

	base_eventloop = mowgli_eventloop_create();

	helper_spawn(base_eventloop);

	mowgli_eventloop_run(base_eventloop);

	return EXIT_SUCCESS;
}
Exemplo n.º 4
0
void helper_start(mowgli_eventloop_helper_proc_t *helper, void *userdata)
{
	mowgli_eventloop_t *eventloop = helper->eventloop;

	mowgli_writef(helper->fd, "hi from pid %d\n", getpid());

	mowgli_timer_add(eventloop, "timer_tick", (mowgli_event_dispatch_func_t *) timer_tick, helper, 1);
	mowgli_timer_add_once(eventloop, "timer_oneshot", (mowgli_event_dispatch_func_t *) timer_oneshot, helper, 5);

	mowgli_eventloop_run(eventloop);

	mowgli_writef(helper->fd, "eventloop halted\n");

	mowgli_eventloop_destroy(eventloop);
}
Exemplo n.º 5
0
int main(int argc, char *argv[])
{
	eventloop = mowgli_eventloop_create();

	mowgli_timer_add(eventloop, "timer_tick", timer_tick, NULL, 1);
	mowgli_timer_add_once(eventloop, "timer_oneshot", timer_oneshot, NULL, 5);

	mowgli_eventloop_run(eventloop);

	printf("eventloop halted\n");

	mowgli_eventloop_destroy(eventloop);

	return EXIT_SUCCESS;
}
Exemplo n.º 6
0
int
main(void)
{
	mowgli_eventloop_t *evloop = mowgli_eventloop_create();
	mowgli_dns_t *dns = mowgli_dns_create(evloop, MOWGLI_DNS_TYPE_ASYNC);
	mowgli_eventloop_pollable_t *stdin_pollable = mowgli_pollable_create(evloop, STDIN_FILENO, dns);

	mowgli_pollable_set_nonblocking(stdin_pollable, true);

	mowgli_pollable_setselect(evloop, stdin_pollable, MOWGLI_EVENTLOOP_IO_READ, read_data);

	mowgli_eventloop_run(evloop);

	mowgli_eventloop_destroy(evloop);

	return 0;
}