/*
 *	VIABUS INTERFACE
 */
static int via_sock;
onew_in(sock,request,leng)
	char *request;
{	char com[1024],arg[1024];

	get_comarg(request,com,arg);
	if( strcmp(com,"ONEW_KEYIN") == 0 ){
		char key[2];

		key[0] = arg[0];
		key[1] = 0;
		Incommand_enQ(key);
	}
}
onew_on_via(ac,av)
	char *av[];
{	int ai;
	static int pipes[2];

	if( ac < 2 )
		return ac;
	if( strcmp(av[1],"-via") != 0 )
		return ac;
	ac--;
	for(ai = 1; ai < ac; ai++)
		av[ai] = av[ai+1];

	ac = via_scan_args(ac,av);
	close(0);
	pipe(pipes);
	via_sock = via_attach("",onew_in);
	if( 0 < via_sock ){
		via_send_message("SENDME ONEW_KEYIN");
		on_via = 1;
	}
	return ac;
}
GetChar1(){
	int nready,ch;

	nready = InputReady(0);
	ch = select_getc();
	printf("nready:%d ch:%x\n",nready,ch);
	return ch;
}
send_to_client(out)
	char *out;
{	char message[1024];

	sprintf(message,"ONEW_OUT %s",out);
	if( via_send_message(message) < 0 )
		exit(-1);
}


syntax highlighted by Code2HTML, v. 0.9.1