Пример #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);
}
Пример #2
0
static void key_action(int key)
{
	int i, size;
	if(signal_sent) {
	    print_help();
	    signal_sent = 0;
	}
	/* 
	 * First, try to process the key by object (subwindow, menu) that
	 * could be on top.
	 */
	size = sizeof key_funct/sizeof(int (*)(int));
	for(i = 0; i < size; i++)
		if(key_funct[i](key)) goto SKIP; 
	
	if(current->keys(key)) goto SKIP;
	/* cursor movement */
	size = sizeof key_handlers/sizeof(struct key_handler);
	for(i = 0; i < size; i++) 
		if(key_handlers[i].c == key) {
			key_handlers[i].handler(current);
			if(can_draw()) pad_draw();
			goto SKIP;
		}
	switch(key) {
	case 'c':
		full_cmd ^= 1;
		current->redraw();
		break;
	case '/':
		m_search();
		break;			
	case KBD_F1:
		help();
		break;
	case KBD_ESC:
	case 'q':
		curses_end();
		exit(0);
	default: return;
	}
SKIP:
	dolog("%s: doing refresh\n", __FUNCTION__);
	wnoutrefresh(main_win);
	wnoutrefresh(info_win.wd);
	pad_refresh();
	menu_refresh();
	box_refresh();
	info_refresh();
	doupdate();
}
Пример #3
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;
}
Пример #4
0
void allocate_error(){
	curses_end();
	fprintf(stderr,"Cannot allocate memory.\n");
	exit (1);
}
Пример #5
0
void prg_exit(char *s)
{
	curses_end();
	if(s) printf("%s\n", s);
	exit(0);
}
Пример #6
0
static void int_handler()
{
	curses_end();
	exit(0);
}