]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix compile issues in rev.13288
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 20 Feb 2014 23:33:29 +0000 (12:33 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 20 Feb 2014 23:33:29 +0000 (12:33 +1300)
tools/squidclient/Ping.cc
tools/squidclient/squidclient.cc

index 286a8a513529c04ce6ab1a2790153898d230e4dd..46e5a4c828c6fdacbf26ac66ae744d1cdea7cdf6 100644 (file)
@@ -3,14 +3,13 @@
 #include "tools/squidclient/Parameters.h"
 #include "tools/squidclient/Ping.h"
 
+#include <climits>
+#include <csignal>
 #include <iostream>
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
 #endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
 
 namespace Ping
 {
@@ -101,7 +100,7 @@ Ping::TimerStop(size_t fsize)
     t2s = tv2.tv_sec;
     tmp = localtime(&t2s);
     char tbuf[4096];
-    snprintf(tbuf, sizeof(tbuf)-1, "%d-%02d-%02d %02d:%02d:%02d [%d]: %ld.%03ld secs, %f KB/s",
+    snprintf(tbuf, sizeof(tbuf)-1, "%d-%02d-%02d %02d:%02d:%02d [%ld]: %ld.%03ld secs, %f KB/s",
              tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
              tmp->tm_hour, tmp->tm_min, tmp->tm_sec, stats.counted + 1,
              elapsed_msec / 1000, elapsed_msec % 1000,
@@ -135,7 +134,8 @@ Ping::DisplayStats()
 {
     if (Ping::Config.enable && stats.counted) {
         long mean = stats.sum / stats.counted;
-        std::cerr << stats.counted << " requests, round-trip (secs) min/avg/max = "
+        std::cerr << std::endl
+                  << stats.counted << " requests, round-trip (secs) min/avg/max = "
                   << (stats.pMin/1000) << "." << (stats.pMin%1000)
                   << "/" << (mean/1000) << "." << (mean%1000)
                   << "/" << (stats.pMax/1000) << "." << (stats.pMax%1000)
index 414f97dcfb86948772fc924a563b06ba3669fae6..dfcdbe851ce706a33bc2f7c44fffb25e2abebdd6 100644 (file)
@@ -44,6 +44,7 @@ using namespace Squid;
 /** \endcond */
 #endif
 
+#include <csignal>
 #include <cstdio>
 #include <iostream>
 
@@ -62,9 +63,6 @@ using namespace Squid;
 #if HAVE_NETDB_H
 #include <netdb.h>
 #endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -129,8 +127,7 @@ static int client_comm_bind(int, const Ip::Address &);
 static int client_comm_connect(int, const Ip::Address &);
 static void usage(const char *progname);
 
-typedef void SIGHDLR(int sig);
-SIGHDLR pipe_handler;
+void pipe_handler(int sig);
 static void set_our_signal(void);
 static ssize_t myread(int fd, void *buf, size_t len);
 static ssize_t mywrite(int fd, void *buf, size_t len);
@@ -229,7 +226,6 @@ main(int argc, char *argv[])
     time_t ims = 0;
     int max_forwards = -1;
 
-    int i = 0;
     const char *proxy_user = NULL;
     const char *proxy_password = NULL;
     const char *www_user = NULL;
@@ -565,7 +561,7 @@ main(int argc, char *argv[])
 
     uint32_t loops = Ping::Init();
 
-    for (i = 0; loops == 0 || i < loops; ++i) {
+    for (uint32_t i = 0; loops == 0 || i < loops; ++i) {
         size_t fsize = 0;
         struct addrinfo *AI = NULL;