[BACK]Return to netcat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / nc

Diff for /src/usr.bin/nc/netcat.c between version 1.78 and 1.79

version 1.78, 2005/04/10 19:43:34 version 1.79, 2005/05/24 20:13:28
Line 50 
Line 50 
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
 #include <fcntl.h>  #include <fcntl.h>
   #include "atomicio.h"
   
 #ifndef SUN_LEN  #ifndef SUN_LEN
 #define SUN_LEN(su) \  #define SUN_LEN(su) \
Line 80 
Line 81 
 int family = AF_UNSPEC;  int family = AF_UNSPEC;
 char *portlist[PORT_MAX+1];  char *portlist[PORT_MAX+1];
   
 ssize_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);  
 void    atelnet(int, unsigned char *, unsigned int);  void    atelnet(int, unsigned char *, unsigned int);
 void    build_ports(char *);  void    build_ports(char *);
 void    help(void);  void    help(void);
Line 590 
Line 590 
 {  {
         struct pollfd pfd[2];          struct pollfd pfd[2];
         unsigned char buf[BUFSIZ];          unsigned char buf[BUFSIZ];
         int wfd = fileno(stdin), n;          int n, wfd = fileno(stdin);
         int lfd = fileno(stdout);          int lfd = fileno(stdout);
   
         /* Setup Network FD */          /* Setup Network FD */
Line 623 
Line 623 
                         } else {                          } else {
                                 if (tflag)                                  if (tflag)
                                         atelnet(nfd, buf, n);                                          atelnet(nfd, buf, n);
                                 if (atomicio((ssize_t (*)(int, void *, size_t))write,                                  if (atomicio(vwrite, lfd, buf, n) != n)
                                     lfd, buf, n) != n)  
                                         return;                                          return;
                         }                          }
                 }                  }
Line 637 
Line 636 
                                 pfd[1].fd = -1;                                  pfd[1].fd = -1;
                                 pfd[1].events = 0;                                  pfd[1].events = 0;
                         } else {                          } else {
                                 if (atomicio((ssize_t (*)(int, void *, size_t))write,                                  if (atomicio(vwrite, nfd, buf, n) != n)
                                     nfd, buf, n) != n)  
                                         return;                                          return;
                         }                          }
                 }                  }
Line 669 
Line 667 
                         p++;                          p++;
                         obuf[2] = *p;                          obuf[2] = *p;
                         obuf[3] = '\0';                          obuf[3] = '\0';
                         if (atomicio((ssize_t (*)(int, void *, size_t))write,                          if (atomicio(vwrite, nfd, obuf, 3) != 3)
                             nfd, obuf, 3) != 3)                                  warn("Write Error!");
                                 warnx("Write Error!");  
                         obuf[0] = '\0';                          obuf[0] = '\0';
                 }                  }
         }          }

Legend:
Removed from v.1.78  
changed lines
  Added in v.1.79