From f37863116494a4011988ad51100e6b956bcb4bd7 Mon Sep 17 00:00:00 2001
From: Sapan Bhatia <sapanb@cs.princeton.edu>
Date: Mon, 3 Mar 2008 23:31:41 +0000
Subject: [PATCH]

---
 dirwatcher.ml   | 2 --
 vsyssh/vsyssh.c | 9 ++++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dirwatcher.ml b/dirwatcher.ml
index 918a06a..67a8c92 100644
--- a/dirwatcher.ml
+++ b/dirwatcher.ml
@@ -69,8 +69,6 @@ let receive_event (eventdescriptor:fname_and_fd) (bla:fname_and_fd) =
                        let (dirname,handler,oneshot) = 
                          try Hashtbl.find wdmap wd with Not_found->("",None,false)
                        in
-                         List.iter (fun l->printf "%s " (string_of_event l)) evlist;
-                         printf "\n";flush Pervasives.stdout;
                          if (oneshot) then Hashtbl.remove wdmap wd;
                          (
                            match handler with
diff --git a/vsyssh/vsyssh.c b/vsyssh/vsyssh.c
index 58625f5..0239fec 100644
--- a/vsyssh/vsyssh.c
+++ b/vsyssh/vsyssh.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -22,6 +23,10 @@
 #include <stdarg.h>
 #include <dirent.h>
 
+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);
-- 
2.47.0