patch-socket_c 928 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. $OpenBSD: patch-socket_c,v 1.2 2004/01/05 00:08:35 espie Exp $
  2. --- socket.c.orig 1995-08-14 20:36:48.000000000 +0200
  3. +++ socket.c 2004-01-05 01:06:02.000000000 +0100
  4. @@ -71,7 +71,7 @@
  5. #include <unistd.h>
  6. #endif
  7. #include <stdlib.h>
  8. -#include <varargs.h>
  9. +#include <stdarg.h>
  10. #include "bzero.h"
  11. #include "socket.h"
  12. @@ -102,7 +102,7 @@ int clientPort;
  13. {
  14. hp = gethostbyname(host);
  15. if (hp == NULL)
  16. - return -1;
  17. + return -2;
  18. memcpy(&ad.sin_addr, hp->h_addr, hp->h_length);
  19. }
  20. ad.sin_port = htons(clientPort);
  21. @@ -225,15 +225,13 @@ int len;
  22. }
  23. -int SockPrintf(socket,format,va_alist)
  24. -int socket;
  25. -char *format;
  26. -va_dcl {
  27. +int SockPrintf(int socket,char *format, ...)
  28. +{
  29. va_list ap;
  30. char buf[8192];
  31. - va_start(ap);
  32. + va_start(ap, format);
  33. vsprintf(buf, format, ap);
  34. va_end(ap);
  35. return SockWrite(socket, buf, strlen(buf));