예제 #1
0
파일: distrib.c 프로젝트: hnrose/ibssa2
static void *distrib_construct(int node_type, unsigned short daemon)
{
    int ret;
    char msg[1024] = {};

    ret = ssa_open_lock_file(lock_file, msg, sizeof msg);
    if (ret) {
        if (!daemon)
            fprintf(stderr, "%s\n", msg);
        openlog("ibssa", LOG_PERROR | LOG_PID, LOG_USER);
        syslog(LOG_INFO, "%s", msg);
        closelog();
        return NULL;
    }

    ret = ssa_open_log(log_file);
    if (ret) {
        ssa_close_lock_file();
        return NULL;
    }
    ssa_set_ssa_signal_handler();
    ssa_log(SSA_LOG_DEFAULT, "Scalable SA Distribution/Access\n");
    distrib_log_options();

    ret = ssa_init(&ssa, node_type, sizeof(struct ssa_device),
                   sizeof(struct ssa_port));
    if (ret) {
        ssa_close_log();
        ssa_close_lock_file();
        return NULL;
    }

    return &ssa;
}
예제 #2
0
파일: main.c 프로젝트: jhautbois/iamtrainer
int main(int argc, char *argv[])
{
    Window play_win;
    FILE *mplayer_fp;
	ssa_s *ssa = ssa_init();

	if (ssa != NULL)
	{
		printf("Script type %s\n", ssa->Script.ScriptType);
		ssa->Style.PrimaryColour = 0xFF00FF;
		write_header(ssa);
	}

	ssa_release(ssa);
	printf("-> %s\n", ssa->Script.ScriptType);
	

    if (argc < 2) {
	fprintf(stderr, "Usage:\n\t%s <uri>\n\n", argv[0]);
	return -1;
    }

    if (!init_sdl())
	return -1;

    play_win = create_sdl_x11_subwindow(0, 0, 1366, 768);
    if (!play_win) {
	fprintf(stderr, "Cannot create X11 window\n");
	return -1;
    }

    mplayer_fp = NULL;
    create_mplayer(argv[1], play_win, &mplayer_fp);
    main_loop(mplayer_fp);
    pclose(mplayer_fp);

	return 0;
}