]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - test-suite/tcp-banger3.c
SourceFormat Enforcement
[thirdparty/squid.git] / test-suite / tcp-banger3.c
index 72b8d8fd5508f8960df5af950873c9d177e105e6..1fec98e47a44a575f0b992b482712c900582208a 100644 (file)
@@ -1,4 +1,4 @@
-#include "config.h"
+#include "squid.h"
 
 /*
  * On some systems, FD_SETSIZE is set to something lower than the
@@ -9,7 +9,7 @@
 #define CHANGE_FD_SETSIZE 1
 
 /* Cannot increase FD_SETSIZE on Linux */
-#if defined(_SQUID_LINUX_)
+#if _SQUID_LINUX_
 #undef CHANGE_FD_SETSIZE
 #define CHANGE_FD_SETSIZE 0
 #endif
@@ -18,7 +18,7 @@
  * to return EINVAL. */
 /* Marian Durkovic <marian@svf.stuba.sk> */
 /* Peter Wemm <peter@spinner.DIALix.COM> */
-#if defined(_SQUID_FREEBSD_)
+#if _SQUID_FREEBSD_
 #include <osreldate.h>
 #if __FreeBSD_version < 220000
 #undef CHANGE_FD_SETSIZE
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
 #if HAVE_STDIO_H
 #include <stdio.h>
 #endif
 #if HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef HAVE_STRING_H
+#if HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
 #include <strings.h>
 #endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
 #if HAVE_SIGNAL_H
 #include <signal.h>
 #endif
 #if HAVE_TIME_H
 #include <time.h>
 #endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
 #if HAVE_ASSERT_H
 #include <assert.h>
 #endif
+#if HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#if HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
 
 #define READ_BUF_SZ 4096
 #define URL_BUF_SZ 4096
@@ -149,8 +141,10 @@ get_url(const char *url)
     memcpy(&S.sin_addr.s_addr, h->h_addr_list[0], sizeof(S.sin_addr.s_addr));
     S.sin_port = htons(port);
     S.sin_family = AF_INET;
-    if (debug)
-        fprintf(stderr, "%s (%s) %d %s\n", host, inet_ntoa(S.sin_addr), (int) port, path);
+    if (debug) {
+        char tmp[16];
+        fprintf(stderr, "%s (%s) %d %s\n", host, inet_ntop(AF_INET, &S.sin_addr,tmp,sizeof(tmp)), (int) port, path);
+    }
     s = socket(PF_INET, SOCK_STREAM, 0);
     if (s < 0) {
         perror("socket");
@@ -374,7 +368,6 @@ sig_child(int sig)
     signal(sig, sig_child);
 }
 
-
 int
 main(int argc, char *argv[])
 {