diff -r -C 3 socat-1.0.4.0/CHANGES socat-1.0.4.1/CHANGES
*** socat-1.0.4.0/CHANGES	Mon Feb 11 19:43:53 2002
--- socat-1.0.4.1/CHANGES	Wed Mar  6 11:37:58 2002
***************
*** 1,7 ****
  
  ####################### V 1.0.4.0:
  
! resolved problems and bugs:
  	Debug output for lstat and fstat said "stat"
  
  further corrections:
--- 1,22 ----
  
+ ####################### V 1.0.4.1:
+ 
+ solved problems and bugs:
+ 	PROB: assert in libc caused an endless recursion
+ 	SOLVED: no longer catch SIGABRT
+ 
+ 	PROB: socat printed wrong verbose prefix for "right to left" packets
+ 	SOLVED: new parameter for xiotransfer() passes correct prefix
+ 
+ new features:
+ 	in debug mode, socat prints its command line arguments
+ 	in verbose mode, escape special characters and replace unprintables
+ 		with '.'. Patch from Adrian Thurston.
+ 
+ 
  ####################### V 1.0.4.0:
  
! solved problems and bugs:
  	Debug output for lstat and fstat said "stat"
  
  further corrections:
***************
*** 20,26 ****
  
  ####################### V 1.0.3.0:
  
! resolved problems and bugs:
  
  	PROB: test 9 of test.sh (echo via file) failed on some platforms,
  	socat exited without error message
--- 35,41 ----
  
  ####################### V 1.0.3.0:
  
! solved problems and bugs:
  
  	PROB: test 9 of test.sh (echo via file) failed on some platforms,
  	socat exited without error message
diff -r -C 3 socat-1.0.4.0/VERSION socat-1.0.4.1/VERSION
*** socat-1.0.4.0/VERSION	Mon Feb 11 09:37:29 2002
--- socat-1.0.4.1/VERSION	Wed Mar  6 09:38:02 2002
***************
*** 1 ****
! "1.0.4.0"
--- 1 ----
! "1.0.4.1"
diff -r -C 3 socat-1.0.4.0/socat.c socat-1.0.4.1/socat.c
*** socat-1.0.4.0/socat.c	Sat Dec 29 18:23:02 2001
--- socat-1.0.4.1/socat.c	Wed Mar  6 10:48:34 2002
***************
*** 1,4 ****
! static const char _rcsid_[]="$Id: socat.c,v 1.51 2001/12/28 14:10:28 gerhard Exp $";
  /* Copyright Gerhard Rieger 2001 */
  /* Published under the GNU General Public License V.2, see file COPYING */
  
--- 1,4 ----
! static const char _rcsid_[]="$Id: socat.c,v 1.55 2002/03/06 09:48:34 gerhard Exp $";
  /* Copyright Gerhard Rieger 2001 */
  /* Published under the GNU General Public License V.2, see file COPYING */
  
***************
*** 52,63 ****
     char buff[10];
     double rto;
     /*0 int signum;*/
!    int result;
  
     diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
     xiosetopt('p', "!!");
     xiosetopt('o', ":");
  
     arg1 = argv+1;  --argc;
     while (arg1[0] && (arg1[0][0] == '-')) {
        switch (arg1[0][1]) {
--- 52,64 ----
     char buff[10];
     double rto;
     /*0 int signum;*/
!    int i, argc0, result;
  
     diag_set('p', strchr(argv[0], '/') ? strrchr(argv[0], '/')+1 : argv[0]);
     xiosetopt('p', "!!");
     xiosetopt('o', ":");
  
+    argc0 = argc;	/* save for later use */
     arg1 = argv+1;  --argc;
     while (arg1[0] && (arg1[0][0] == '-')) {
        switch (arg1[0][1]) {
***************
*** 145,156 ****
     }
  
     Info(copyright);
     /* not sure what signal should print a message */
     Signal(SIGHUP, socat_signal);
     Signal(SIGINT, socat_signal);
     Signal(SIGQUIT, socat_signal);
     Signal(SIGILL, socat_signal);
!    Signal(SIGABRT, socat_signal);
     Signal(SIGBUS, socat_signal);
     Signal(SIGFPE, socat_signal);
     Signal(SIGSEGV, socat_signal);
--- 146,166 ----
     }
  
     Info(copyright);
+ 
+ #if WITH_MSGLEVEL <= E_DEBUG
+    for (i = 0; i < argc0; ++i) {
+       Debug2("argv[%d]: \"%s\"", i, argv[i]);
+    }
+ #endif /* WITH_MSGLEVEL <= E_DEBUG */
+ 
     /* not sure what signal should print a message */
     Signal(SIGHUP, socat_signal);
     Signal(SIGINT, socat_signal);
     Signal(SIGQUIT, socat_signal);
     Signal(SIGILL, socat_signal);
!    /* SIGABRT for assert; catching caused endless recursion on assert in libc
!       (tzfile.c:498: __tzfile_compute: Assertion 'num_types == 1' failed.) */
!    /*Signal(SIGABRT, socat_signal);*/
     Signal(SIGBUS, socat_signal);
     Signal(SIGFPE, socat_signal);
     Signal(SIGSEGV, socat_signal);
***************
*** 468,474 ****
  }
  
  int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
! 		unsigned char **buff, size_t bufsiz);
  
  int sleepon = 0;	/* if last select was not active, then sleep so long */
  
--- 478,484 ----
  }
  
  int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
! 		unsigned char **buff, size_t bufsiz, const char *prefix);
  
  int sleepon = 0;	/* if last select was not active, then sleep so long */
  
***************
*** 603,609 ****
        }
  
        if (XIO_GETRDFD(sock1) >= 0 && FD_ISSET(XIO_GETRDFD(sock1), &in)) {
! 	 if ((bytes = xiotransfer(sock1, sock2, &buff, socat_opts.bufsiz))
  	     < 0) {
  	    closing = 1;
  	 } else if (bytes == 0) {
--- 613,619 ----
        }
  
        if (XIO_GETRDFD(sock1) >= 0 && FD_ISSET(XIO_GETRDFD(sock1), &in)) {
! 	 if ((bytes = xiotransfer(sock1, sock2, &buff, socat_opts.bufsiz, "> "))
  	     < 0) {
  	    closing = 1;
  	 } else if (bytes == 0) {
***************
*** 620,626 ****
        }
  
        if (XIO_GETRDFD(sock2) >= 0 && FD_ISSET(XIO_GETRDFD(sock2), &in)) {
! 	 if ((bytes = xiotransfer(sock2, sock1, &buff, socat_opts.bufsiz))
  	     < 0) {
  	    closing = 1;
  	 } else if (bytes == 0) {
--- 630,636 ----
        }
  
        if (XIO_GETRDFD(sock2) >= 0 && FD_ISSET(XIO_GETRDFD(sock2), &in)) {
! 	 if ((bytes = xiotransfer(sock2, sock1, &buff, socat_opts.bufsiz, "< "))
  	     < 0) {
  	    closing = 1;
  	 } else if (bytes == 0) {
***************
*** 703,709 ****
     */
  /* inpipe, outpipe must be single descriptors (not dual!) */
  int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
! 		unsigned char **buff, size_t bufsiz) {
     ssize_t bytes, writt;
  
  	 bytes = xioread(inpipe, *buff, socat_opts.bufsiz);
--- 713,719 ----
     */
  /* inpipe, outpipe must be single descriptors (not dual!) */
  int xiotransfer(xiofile_t *inpipe, xiofile_t *outpipe,
! 		unsigned char **buff, size_t bufsiz, const char *prefix) {
     ssize_t bytes, writt;
  
  	 bytes = xioread(inpipe, *buff, socat_opts.bufsiz);
***************
*** 766,784 ****
  	       fprintf(stderr, "> %s", buff);
  #else
  	       size_t i = 0;
! 	       fputs("> ", stderr);
  	       while (i < bytes) {
! 		  if (i > 0 && (*buff)[i-1] == '\n')  fputs("> ", stderr);
! 		  switch ((*buff)[i]) {
  		  case '\r' : fputs("\\r", stderr); break;
! 		  default: fputc((*buff)[i], stderr); break;
  		  }
  		  ++i;
  	       }
  #endif
  	    } else if (socat_opts.verbhex) {
  	       int i;
! 	       fputc('>', stderr);
  	       for (i = 0; i < bytes; ++i) {
  		  fprintf(stderr, " %02x", (*buff)[i]);
  	       }
--- 776,806 ----
  	       fprintf(stderr, "> %s", buff);
  #else
  	       size_t i = 0;
! 	       fputs(prefix, stderr);
  	       while (i < bytes) {
! 		  int c = (*buff)[i];
! 		  if (i > 0 && (*buff)[i-1] == '\n')  fputs(prefix, stderr);
! 		  switch (c) {
! 		  case '\a' : fputs("\\a", stderr); break;
! 		  case '\b' : fputs("\\b", stderr); break;
! 		  case '\t' : fputs("\t", stderr); break;
! 		  case '\n' : fputs("\n", stderr); break;
! 		  case '\v' : fputs("\\v", stderr); break;
! 		  case '\f' : fputs("\\f", stderr); break;
  		  case '\r' : fputs("\\r", stderr); break;
! 		  case '\\' : fputs("\\\\", stderr); break;
! 		  default:
! 		     if (!isprint(c))
! 			c = '.';
! 		     fputc(c, stderr);
! 		     break;
  		  }
  		  ++i;
  	       }
  #endif
  	    } else if (socat_opts.verbhex) {
  	       int i;
! 	       fputs(prefix, stderr);
  	       for (i = 0; i < bytes; ++i) {
  		  fprintf(stderr, " %02x", (*buff)[i]);
  	       }
