#include #include #include #include #include #include #include "VNConsole.h" #include "vga.h" int main(int argc, char **argv) { Bool interactive=FALSE,sendOnlyWholeLines=TRUE; int serverArgc,programArg0; for(serverArgc=1;serverArgcdoEcho = FALSE; if(max_fd=0) { /* event loop */ vcProcessEvents(console); /* get input */ if(console->inputCount) { if(sendOnlyWholeLines) { for(i=0;iinputCount;i++) if(console->inputBuffer[i]=='\n') { i++; fwrite(console->inputBuffer,i,1,input_pipe); fflush(input_pipe); /* fwrite(console->inputBuffer,i,1,stderr); */ if(console->inputCount>i) memmove(console->inputBuffer,console->inputBuffer+i,console->inputCount-i); console->inputCount-=i; i=0; } } else { fwrite(console->inputBuffer,console->inputCount,1,input_pipe); fflush(input_pipe); /* fwrite(console->inputBuffer,console->inputCount,1,stderr); */ console->inputCount=0; } } /* process output */ fs1=fs; tv1=tv; num_fds=select(max_fd+1,&fs1,NULL,NULL,&tv1); if(num_fds>0) { /* if(FD_ISSET(0,&fs1)) { ch=getchar(); fputc(ch,f); } */ if(FD_ISSET(out[0],&fs1)) { c=read(out[0],buffer,1024); for(i=0;i