Fix echo commands for Solaris systems.
[rsync/rsync.git] / io.c
diff --git a/io.c b/io.c
index 5ca0e6c..fda04dd 100644 (file)
--- a/io.c
+++ b/io.c
@@ -136,6 +136,12 @@ void read_buf(int f,char *buf,int len)
   total_read += len;
 }
 
+unsigned char read_byte(int f)
+{
+  char c;
+  read_buf(f,&c,1);
+  return (unsigned char)c;
+}
 
 int read_write(int fd_in,int fd_out,int size)
 {
@@ -163,6 +169,7 @@ static int writefd(int fd,char *buf,int len)
 {
   int total = 0;
   fd_set fds;
+  struct timeval tv;
 
   if (buffer_f_in == -1) 
     return write(fd,buf,len);
@@ -180,7 +187,9 @@ static int writefd(int fd,char *buf,int len)
 
       FD_ZERO(&fds);
       FD_SET(fd,&fds);
-      select(16,NULL,&fds,NULL,NULL);
+      tv.tv_sec = BLOCKING_TIMEOUT;
+      tv.tv_usec = 0;
+      select(16,NULL,&fds,NULL,&tv);
     } else {
       total += ret;
     }
@@ -212,6 +221,11 @@ void write_buf(int f,char *buf,int len)
 }
 
 
+void write_byte(int f,unsigned char c)
+{
+  write_buf(f,(char *)&c,1);
+}
+
 void write_flush(int f)
 {
 }