git://git.onelab.eu
/
vsys.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use more familiar HTB instead of TBF
[vsys.git]
/
vsyssh
/
vsyssh.c
diff --git
a/vsyssh/vsyssh.c
b/vsyssh/vsyssh.c
index
b77d7f2
..
0239fec
100644
(file)
--- a/
vsyssh/vsyssh.c
+++ b/
vsyssh/vsyssh.c
@@
-6,6
+6,7
@@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
@@
-22,6
+23,10
@@
#include <stdarg.h>
#include <dirent.h>
#include <stdarg.h>
#include <dirent.h>
+void pipe_handler (int sig) {
+ printf("SIGPIPE");
+}
+
int main(int argc, char **argv, char **envp)
{
if (argc<2) {
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;
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]);
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);
FD_SET(0, &set);
FD_SET(vfd0, &set);
- while (1) {
+ while (1)
+ {
int ret;
printf("vsys>");fflush(stdout);
FD_SET(0, &set);
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);
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)) {
write(vfd1,lineread,ret);
FD_CLR(0,&set);
} if (FD_ISSET(vfd0,&set)) {