Example #1
0
int main(int argc, char **argv)
{
	createSharedMemory();
	ipcon_create(&MyIP);
    // Connect to brickd
    if(ipcon_connect(&MyIP, HOST, PORT) < 0) {
        fprintf(stderr, "Could not connect to brickd\n");
        exit(1);
    }


	getTinker();
	sleep(2);   // Es dauert etwas, bis die Enumeration der Devices durch ist, also warten !!!

	if ( tinkerCounter <= 0 ) {
		fprintf(stderr,"Kein Gerät vorhanden ");
		exit(2);
	}

	curses_init();
	showSystem(1);
	// Threads für die Anzeige erstellen
	tf1_init();
	getchar();

	curses_end();
	deleteSharedMemory();
	return (0);
}
Example #2
0
//Basic Init, create the font, backbuffer, etc
WINDOW *initscr(void)
{
    // initscr is a ncurses function, it is not supposed to throw.
    try {
        stdscr = curses_init();
    } catch( const std::exception &err ) {
        fprintf( stderr, "Error while initializing: %s\n", err.what() );
        return nullptr;
    }
    return stdscr;
}
Example #3
0
static void curses_getsize(aa_context * c, int *width, int *height)
{
    if (__resized_curses)
	curses_uninit(c), curses_init(&c->params, NULL,&c->driverparams, NULL), __resized_curses = 0;
    *width = getmaxx(stdscr) + 1;
    *height = getmaxy(stdscr) + 1;
#ifdef GPM_MOUSEDRIVER
    gpm_mx = *width;
    gpm_my = *height;
#endif

}
Example #4
0
static int term_start() {
	char *term = getenv("TERM");
	is_xterm = (strncmp(term, "xterm", 5) == 0) || (strncmp(term, "gnome", 5) == 0) || (strncmp(term, "st", 2) == 0);

	term_title_push();
	term_show_scrollbar(0);

	int ok = curses_init();
	init_coersion();

	return ok;
}
Example #5
0
int main (int argc, char **argv) {

	char *sysname;
	kr_client_t *client;
  int res;

	if (argc != 2) {
		fprintf (stderr,"Need 1 arg, station name \n");
		return 1;
	}

  if (krad_valid_host_and_port (argv[1])) {
    sysname = argv[1];
  } else {
    if (!krad_valid_sysname(argv[1])) {
      fprintf (stderr, "Invalid station sysname! \n");
      return 1;
    } else {
      sysname = argv[1];
    }
  }

	client = kr_client_create ("krad command line client");

  if (client == NULL) {
    fprintf (stderr, "Could create client \n");
    return 1;
  }

  if (!kr_connect (client, sysname)) {
    fprintf (stderr, "Could not connect to %s krad radio daemon \n", sysname);
    kr_client_destroy (&client);
    return 1;
  }

  curses_init ();
  
  if ( ( res = gnmc_run (client,sysname) ) < 0 ) {
  	curses_exit ();
    fprintf (stderr,
      "Something went wrong, probably not enough space to draw data \n");
  }
  else {
  	curses_exit ();
  }

  kr_disconnect (client);
  kr_client_destroy (&client);


	return 0;
}
Example #6
0
int 
main (int argc, char *argv[])
{
	curses_init();

	void *ctx = zmq_ctx_new();

	command_shell(ctx);

	zmq_ctx_destroy(ctx);

	curses_end();
	return 0;
}
Example #7
0
int main(int argc, char** argv)
{
    ToxGroup *g;

    if(argc != 1 && argc != 3) {
        printf("Usage: %s [ip port]\n", argv[0]);
        return 1;
    }

    curses_init();

    if(argc == 3) {
        uint32_t ip;
        uint16_t port;

        inet_pton(AF_INET, argv[1], &ip);
        port = strtol(argv[2], NULL, 0);

        g = toxgroup_new_bootstrap(ip, port);
    } else {
        g = toxgroup_new();
    }

    update_info(g);
    g->peer_callback = peer_callback;
    g->message_callback = message_callback;

    int z = 0;
    while(1) {
        toxgroup_do(g);

        do_input(g);
        if(info_change) {
            update_info(g);
            info_change = 0;
        }
        usleep(500);
        z++;
        if(z == 2000) {
            if(send_audio) {toxgroup_sendaudio(g);}
            z = 0;
        }
    }

    return 0;
}
Example #8
0
int main (int argc, char **argv)
{
	struct timeval tv;

#ifdef HAVE_LIBKVM
	if (kvm_init()) can_use_kvm = 1;
#endif
	
#ifdef DEBUG
	if (!(debug_file = fopen("debug", "w"))) {
		printf("file debug open error\n");
		exit(0);
	}
#endif
	get_boot_time();
	get_rows_cols(&screen_rows, &screen_cols);
	buf_size = screen_cols + screen_cols/2;
	line_buf = malloc(buf_size);
	if (!line_buf)
		errx(1, "Cannot allocate memory for buffer.");

	curses_init();
	current = &users_list;
	users_init();
	procwin_init();
	subwin_init();
	menu_init();
	signal(SIGINT, int_handler);
	signal(SIGWINCH, winch_handler);  
	//	signal(SIGSEGV, segv_handler);

	print_help();
	update_load();
	current->redraw();
	wnoutrefresh(main_win);
	wnoutrefresh(info_win.wd);
	wnoutrefresh(help_win.wd);
	doupdate();
	
	tv.tv_sec = TIMEOUT;
	tv.tv_usec = 0;
	
	for(;;) {				/* main loop */
#ifndef RETURN_TV_IN_SELECT
		struct timeval before;
		struct timeval after;
#endif
		fd_set rfds;
		int retval;
		
		FD_ZERO(&rfds);
		FD_SET(STDIN_FILENO,&rfds);
#ifdef RETURN_TV_IN_SELECT
		retval = select(1, &rfds, 0, 0, &tv);
		if(retval > 0) {
			int key = read_key();
			key_action(key);
		}
		if (!tv.tv_sec && !tv.tv_usec){
			ticks++;
			periodic();
			tv.tv_sec = TIMEOUT;
		}
#else
		gettimeofday(&before, 0);
		retval = select(1, &rfds, 0, 0, &tv);
		gettimeofday(&after, 0);
		tv.tv_sec -= (after.tv_sec - before.tv_sec);
		if(retval > 0) {
			int key = read_key();
			key_action(key);
		}
		if(tv.tv_sec <= 0) {
			ticks++;
			periodic();
			tv.tv_sec = TIMEOUT;

		}
#endif
		if (size_changed) resize();
	}
}
//Basic Init, create the font, backbuffer, etc
WINDOW *initscr(void)
{
    return curses_init();
}
Example #10
0
//Basic Init, create the font, backbuffer, etc
WINDOW *initscr(void)
{
    stdscr = curses_init();
    return stdscr;
}