X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=inline;f=vsyssh%2Fvsyssh.c;h=0239fec948548d780807119f1d4c78b5d7c0234e;hb=c83cc6c663566b82531b670f8b492c6ff1e1f18f;hp=b77d7f2a7c54ef7349e4bba32f6ddcc8fa201389;hpb=47e86c6701f0bfe11a8a8784cd06db3283a57775;p=vsys.git diff --git a/vsyssh/vsyssh.c b/vsyssh/vsyssh.c index b77d7f2..0239fec 100644 --- a/vsyssh/vsyssh.c +++ b/vsyssh/vsyssh.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,10 @@ #include #include +void pipe_handler (int sig) { + printf("SIGPIPE"); +} + int main(int argc, char **argv, char **envp) { if (argc<2) { @@ -33,6 +38,7 @@ int main(int argc, char **argv, char **envp) char *inf,*outf; struct timeval tv; + signal(SIGPIPE,pipe_handler); inf=(char *)malloc(strlen(argv[1])+3); outf=(char *)malloc(strlen(argv[1])+4); strcpy(inf,argv[1]); @@ -56,7 +62,8 @@ int main(int argc, char **argv, char **envp) FD_SET(0, &set); FD_SET(vfd0, &set); - while (1) { + while (1) + { int ret; printf("vsys>");fflush(stdout); FD_SET(0, &set); @@ -66,6 +73,8 @@ int main(int argc, char **argv, char **envp) char lineread[2048]; int ret; ret=read(0,lineread,2048); + lineread[ret]='\0'; + printf ("writing %s\n",lineread); write(vfd1,lineread,ret); FD_CLR(0,&set); } if (FD_ISSET(vfd0,&set)) {