]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove diff-reducer hack in rev10754
authorAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 19 Aug 2010 02:24:47 +0000 (20:24 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 19 Aug 2010 02:24:47 +0000 (20:24 -0600)
14 files changed:
configure.in
lib/Makefile.am
src/HttpMsg.cc
tools/Makefile.am
tools/purge/Makefile [deleted file]
tools/purge/convert.cc
tools/purge/copyout.cc
tools/purge/hexd.c [deleted file]
tools/purge/hexd.cc [new file with mode: 0644]
tools/purge/purge.cc
tools/purge/signal.cc
tools/purge/signal.hh
tools/purge/socket.cc
tools/purge/squid-tlv.cc

index 591c7f7a73814009f9b9a41a5c8d0ab90a0116b1..d05efe5f1b1f360547476b153c28fdcf49459f83 100644 (file)
@@ -2125,6 +2125,7 @@ AC_CHECK_HEADERS( \
   regex.h \
   sched.h \
   security/pam_appl.h \
+  siginfo.h \
   signal.h \
   sstream \
   stdarg.h \
@@ -2145,7 +2146,7 @@ AC_CHECK_HEADERS( \
   sys/md5.h \
   sys/msg.h \
   sys/resource.h \
-  sys/select.h\
+  sys/select.h \
   sys/socket.h \
   sys/stat.h \
   sys/statvfs.h \
@@ -2917,6 +2918,7 @@ AC_REPLACE_FUNCS(\
        initgroups \
        getaddrinfo \
        getnameinfo \
+       psignal \
        strerror \
        strsep \
        strtoll \
@@ -3238,6 +3240,7 @@ AC_CONFIG_FILES([\
        helpers/url_rewrite/Makefile \
        helpers/url_rewrite/fake/Makefile \
        tools/Makefile
+       tools/purge/Makefile
 ])
 
 AC_CONFIG_SUBDIRS(lib/libTrie)
index f474316568fd6c068c1975793f509cba37dac2c2..a1fcf15c3726b24a2b72ea3be8d79ee5fda870f5 100644 (file)
@@ -46,6 +46,7 @@ EXTRA_libmiscutil_a_SOURCES = \
        md5.c \
        Profiler.c \
        win32lib.c
+
 libmiscutil_a_SOURCES = \
        MemPool.cc \
        MemPoolChunked.cc \
index cd5d5cca89341b5f93ae6d0cfff3c3d8fdbd13f6..cb190001bededeca4c55aa164424e2c57df1485c 100644 (file)
@@ -319,22 +319,21 @@ HttpMsg::setContentLength(int64_t clen)
 bool
 HttpMsg::persistent() const
 {
-    const HttpHeader *hdr = &header; // XXX: diff-minimizer; remove on commit
     if ((http_ver.major >= 1) && (http_ver.minor >= 1)) {
         /*
          * for modern versions of HTTP: persistent unless there is
          * a "Connection: close" header.
          */
-        return !httpHeaderHasConnDir(hdr, "close");
+        return !httpHeaderHasConnDir(&header, "close");
     } else {
         /*
          * Persistent connections in Netscape 3.x are allegedly broken,
          * return false if it is a browser connection.  If there is a
          * VIA header, then we assume this is NOT a browser connection.
          */
-        const char *agent = hdr->getStr(HDR_USER_AGENT);
+        const char *agent = header.getStr(HDR_USER_AGENT);
 
-        if (agent && !hdr->has(HDR_VIA)) {
+        if (agent && !header.has(HDR_VIA)) {
             if (!strncasecmp(agent, "Mozilla/3.", 10))
                 return 0;
 
@@ -343,7 +342,7 @@ HttpMsg::persistent() const
         }
 
         /* for old versions of HTTP: persistent if has "keep-alive" */
-        return httpHeaderHasConnDir(hdr, "keep-alive");
+        return httpHeaderHasConnDir(&header, "keep-alive");
     }
 }
 
index 5efe2628e1b5c3b53ed4fe6e214e873627dfbef5..8d0d18234756bd0f349cf8fe09c265f584169160 100644 (file)
@@ -11,7 +11,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 ## we need our local files too (but avoid -I. at all costs)
 INCLUDES += -I$(srcdir)
 
-SUBDIRS = 
+SUBDIRS = purge
 EXTRA_DIST = 
 man_MANS = 
 DISTCLEANFILES = 
diff --git a/tools/purge/Makefile b/tools/purge/Makefile
deleted file mode 100644 (file)
index a9cbf8e..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#
-# Makefile
-#
-# The Makefile is divided into three sections, the "generic section", the
-# "host section" and the "rules section". The generics section defines
-# defaults which you should not change. Changes should solely be made to
-# the rules section.
-#
-# You will need to select several parameters befitting your compiler/system:
-#
-# -DHAS_BOOL   - set, if your C++ compiler knows about the 'bool' type.
-# -DHAS_PSIGNAL - set, if your libc supports psignal(int,const char*).
-# -fno-exceptions - may not be recognized by all variants of g++
-# -ffor-scope  - the new ANSI C++ scoping of for() variables is used...
-#
-# === [1] ==================================================== generics section
-#
-CXX    = g++ -ffor-scope -DHAS_BOOL -DHAS_PSIGNAL
-CC     = gcc
-LD     = $(CC)         # yes, I do mean gcc and not g++
-CXXFLAGS = # -pg -g # -fprofile-arcs -ftest-coverage
-SYSTEM  = $(shell uname -s | tr '[a-z]' '[A-Z]' | tr -d '_ -/')
-CPU    = $(shell uname -p)
-VERSION = $(shell uname -r)
-HOST   = $(shell uname -n)
-MAJOR   = $(firstword $(subst ., ,$(VERSION)))
-MINOR   = $(strip $(word 2,$(subst ., ,$(VERSION))))
-LOADLIBES =
-SOCKLEN        = int # default except for glibc2?
-
-# optimization levels - Do *not* use levels above -O1 with g++,
-# if -fprofile-arcs or -ftest-coverage is selected! Set to different
-# values in the host specific section below.
-#
-# - OPT_NORM for normal level optimization, O2 is a good choice.
-#
-OPT_NORM = -O2
-
-# electric fence library, for test purposes only (helps w/ memory leaks)
-# (developers only)
-EFENCE = -L/usr/local/lib -lefence
-
-#
-# === [2] ======================================================= hosts section
-#
-
-ifeq (SUNOS,${SYSTEM})
-ifeq (5,${MAJOR})
-# use these for the SUN CC compiler (for STL, see below or above)
-# You must define this for Solaris 2.x: CXXFLAGS = -DSOLARIS 
-CC     = cc
-#CXX   = CC -DHAS_BOOL -DHAS_PSIGNAL -DHAS_MUTABLE
-#CXXFLAGS = -DSOLARIS  '-library=%none,Cstd,Crun' 
-#CXXFLAGS += -dalign -ftrap=%none -fsimple -xlibmil
-#OPT_NORM = -xtarget=ultra2 -xO4
-#EXTRALIB += -lnsl -lsocket
-#LD    = CC
-#
-## g++ settings for Solaris on Ultra Sparcs (comment out all of above):
-CXXFLAGS += -DSOLARIS # -ggdb
-OPT_NORM = -O2 # -mcpu=supersparc
-LD     = $(CC)
-##
-#EXTRALIB += -lnsl -lsocket -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
-else
-# old SunOS 4.1.x, not supported!
-CXXFLAGS += -DSUN
-endif
-endif
-
-ifeq (IRIX64,${SYSTEM})
-# The regular 64bit Irix stuff is just too slow, use n32!
-SYSTEM        := IRIX
-endif
-
-ifeq (FREEBSD,${SYSTEM})
-SOCKLEN        = socklen_t
-endif
-
-ifeq (IRIX,${SYSTEM})
-CXX     = CC -n32 -mips3 -r4000 -DEFAULT:abi=n32:isa=mips3:proc=r4k
-CXX    += -LANG:ansi-for-init-scope=on -LANG:bool=on
-CXX    += -LANG:exceptions=off -LANG:explicit=off -LANG:wchar_t=off
-CXX    += -LANG:mutable=on -LANG:namespaces=on -LANG:std
-CC     = cc -n32 -mips3 -r4000
-CXXFLAGS = -woff 1174 -LANG:exceptions=off -DHAS_BOOL -DHAS_PSIGNAL
-LD     = $(CXX)
-OPT_NORM = -O3 -IPA -LNO:opt=1
-# for g++
-#CXXFLAGS += -mips3 -mcpu=r4000 
-endif
-
-ifeq (AIX,${SYSTEM})
-ifeq (,${MINOR})
-MINOR  := ${MAJOR}
-MAJOR  = 4
-endif
-CXX    = xlC -UHAS_BOOL -UHAS_PSIGNAL
-CC     = xlc
-CXXFLAGS = -qtune=pwr # -qdbxextra -g
-#CXX   = g++ -ffor-scope -DHAS_BOOL -UHAS_PSIGNAL
-SOCKLEN        = size_t
-LD     = $(CXX)
-endif
-
-ifeq (LINUX,${SYSTEM})
-# determine highest version of all installed libc's.
-LIBCVER = $(shell /bin/ls /lib/libc.so.? | \
-       awk -F'.' '{ if (m<$$3) m=$$3;} END { print m} ')
-ifeq (6,${LIBCVER})
-SOCKLEN        = socklen_t
-endif
-CXXFLAGS += -DHAS_PSIGNAL -DLIBCVERSION=$(LIBCVER) -pipe # -Wall -pedantic
-OPT_NORM = -O2
-# if your g++ balks (e.g. SuSE still uses 2.7.2.3)
-#CXXFLAGS += -DHAS_PSIGNAL -DLIBCVERSION=$(LIBCVER) -m486
-LD     = $(CC)
-EXTRALIB = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
-endif
-
-#
-# === [3] ======================================================= rules section
-# There is no need to change things below this line.
-CXXFLAGS += -D${SYSTEM} -DMAJOR=${MAJOR} -DMINOR=${MINOR} -DSOCKLEN=${SOCKLEN}
-CFLAGS = $(CXXFLAGS)
-LDFLAGS += $(OPT_NORM)
-
-%.o:%.cc
-       $(CXX) $(CXXFLAGS) $(OPT_NORM) -c $< -o $@
-
-OBJS   = convert.o socket.o signal.o squid-tlv.o copyout.o conffile.o
-SRCS   = $(OBJS:.o=.cc)
-HDRS   = $(OBJS:.o=.hh)
-FILES  = $(SRCS) $(HDRS) Makefile purge.cc hexd.c
-DIST   = $(addprefix purge/,$(FILES) README)
-
-all: purge
-
-purge: $(OBJS) purge.o 
-       $(LD) $(OPT_NORM) $(LDFLAGS) $^ -o $@ $(LOADLIBES) $(EXTRALIB)
-hexd: hexd.o
-       $(CC) $(OPT_NORM) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
-#
-# object file rules, generated with "g++ -MM -E *.cc"
-#
-purge.o: purge.cc $(HDRS)
-       $(CXX) $(CXXFLAGS) $(OPT_NORM) -c $< -o $@
-convert.o: convert.cc convert.hh
-conffile.o: conffile.cc conffile.hh
-signal.o: signal.cc signal.hh
-socket.o: socket.cc socket.hh convert.hh
-squid-tlv.o: squid-tlv.cc squid-tlv.hh
-copyout.o: copyout.cc copyout.hh
-hexd.o: hexd.c
-
-clean:
-       $(RM) *.o
-       if [ "${SYSTEM}" = "IRIX"  ]; then rm -rf ii_files; fi
-       if [ "${SYSTEM}" = "SUNOS" ]; then rm -rf Templates.DB; fi
-       if [ "${SYSTEM}" = "SUNOS" ]; then rm -rf SunWS_cache; fi
-
-distclean: clean
-       $(RM) purge hexd
-
-realclean: distclean
-clobber: distclean
-
-co-all:        $(FILES)
-       echo all checked out
-co-all-lock:
-       co -l $(FILES)
-ci-all:
-       for i in $(FILES); do \
-               test -w $$i && ci $$i; \
-               rm -f $$i; \
-       done
-
-dist: distclean co-all
-       ( cd .. ; gtar cvzf purge-`date +"%Y%m%d"`-src.tar.gz $(DIST) )
-tar: distclean ci-all
-       ( cd .. ; gtar cvzf purge-`date +"%Y%m%d"`-all.tar.gz purge )
index 189d896b917a120364dfd922533cf98c01f59c64..64238121ce00049fed5a9701ff318dc51e74c8e2 100644 (file)
@@ -57,9 +57,6 @@
 #define SA struct sockaddr
 #endif
 
-static const char* RCS_ID =
-    "$Id$";
-
 const char*
 my_inet_ntoa( const struct in_addr& a, HostAddress output )
 // purpose: thread-safely convert IPv4 address -> ASCII representation
@@ -107,7 +104,7 @@ my_sock_fd2a( int fd, SockAddress buffer, bool peer )
 //          Refer to errno in case of error (usually unconnected fd...)
 {
     struct sockaddr_in socket;
-    SOCKLEN len = sizeof(socket);
+    socklen_t len = sizeof(socket);
 
     if ( (peer ? getpeername( fd, (SA*) &socket, &len ) :
             getsockname( fd, (SA*) &socket, &len )) == -1 )
index 525094e7466cd6a920b6916a894612bcd30f73a0..53419c80fca6d96f9a0e16c94e9a0e180741bde0 100644 (file)
 #pragma implementation
 #endif
 
-#include <assert.h>
-#include <sys/types.h>
+#include "config.h"
+#include "copyout.hh"
+
+//#include <assert.h>
+//#include <sys/types.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <unistd.h>
-
 #include <sys/mman.h>
+
 #ifndef MAP_FILE
 #define MAP_FILE 0
 #endif // MAP_FILE
 
-#include "copyout.hh"
-
-static const char* RCS_ID =
-    "$Id$";
-
 int
 assert_copydir( const char* copydir )
 // purpose: check, if copydir is a directory and that we can write into it.
diff --git a/tools/purge/hexd.c b/tools/purge/hexd.c
deleted file mode 100644 (file)
index af7f8ef..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <ctype.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-
-unsigned char
-xlate( unsigned char ch )
-{
-    return (isprint(ch & 0x7f) ? ch : '.');
-}
-
-typedef struct {
-    int fd, rsize, cursor;
-    size_t bufsize;
-    unsigned char* buffer;
-} InputByByte;
-
-int
-in_open( InputByByte* this, const char* fn, size_t size )
-{
-    if ( (this->fd = open( fn, O_RDONLY )) == -1 ) return -1;
-    if ( (this->buffer=(unsigned char*) malloc(size)) == 0 ) {
-        close(this->fd);
-        return -1;
-    }
-    this->bufsize = size;
-    this->rsize = this->cursor = 0;
-    return 0;
-}
-
-int
-in_get( InputByByte* this )
-/*
- * purpose: read next character
- * returns: 0..255 as valid character, -1 for error, -2 for EOF
- */
-{
-    if ( this->cursor >= this->rsize ) {
-        do {
-            this->rsize = read( this->fd, this->buffer, this->bufsize );
-        } while ( this->rsize == -1 && errno == EINTR );
-        if ( this->rsize > 0 ) this->cursor = 0;
-        else return ((-2) - this->rsize);
-    }
-
-    return this->buffer[this->cursor++];
-}
-
-int
-in_close( InputByByte* this )
-{
-    free((void*) this->buffer);
-    return close(this->fd);
-}
-
-int
-main( int argc, char* argv[] )
-{
-    int ch, i;
-    unsigned line = 0;
-    InputByByte in;
-    char b2[20];
-
-    if ( argc != 2 ) {
-        fprintf( stderr, "Usage: %s filename\n", argv[0] );
-        return 1;
-    }
-
-    if ( in_open(&in,argv[1],32768) == -1 ) {
-        perror( "open" );
-        return 1;
-    }
-
-    for ( ch = in_get(&in); ch >= 0; ) {
-        printf( "%08X: ", line );
-        memset( b2, 0, sizeof(b2) );
-        for ( i=0; i < 16 && ch >= 0; i++ ) {
-            printf( "%02X%c", ch, ((i==7) ? '-' : ' ' ) );
-            b2[i] = xlate(ch);
-            ch = in_get(&in);
-        }
-        line += i;
-        for ( ; i<16; i++ ) fputs("   ",stdout);
-        printf( " %s\n", b2 );
-    }
-
-    return in_close(&in);
-}
-
-
diff --git a/tools/purge/hexd.cc b/tools/purge/hexd.cc
new file mode 100644 (file)
index 0000000..1756067
--- /dev/null
@@ -0,0 +1,93 @@
+#include "config.h"
+
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+
+class InputByByte
+{
+public:
+    int open(const char* fn, const size_t size);
+    int get();
+    int close();
+
+private:
+    int fd, rsize, cursor;
+    size_t bufsize;
+    unsigned char* buffer;
+};
+
+int
+InputByByte::open(const char* fn, const size_t size )
+{
+    if ( (fd = open( fn, O_RDONLY )) == -1 ) return -1;
+    if ( (buffer=(unsigned char*) malloc(size)) == 0 ) {
+        ::close(fd);
+        return -1;
+    }
+    bufsize = size;
+    rsize = cursor = 0;
+    return 0;
+}
+
+int
+InputByByte::get()
+/*
+ * purpose: read next character
+ * returns: 0..255 as valid character, -1 for error, -2 for EOF
+ */
+{
+    if ( cursor >= rsize ) {
+        do {
+            rsize = read(fd, buffer, bufsize );
+        } while ( rsize == -1 && errno == EINTR );
+        if ( rsize > 0 ) cursor = 0;
+        else return ((-2) - rsize);
+    }
+
+    return buffer[cursor++];
+}
+
+int
+InputByByte::close()
+{
+    free((void*) buffer);
+    return close(fd);
+}
+
+int
+main( int argc, char* argv[] )
+{
+    int ch, i;
+    unsigned line = 0;
+    InputByByte in;
+    char b2[20];
+
+    if ( argc != 2 ) {
+        fprintf( stderr, "Usage: %s filename\n", argv[0] );
+        return 1;
+    }
+
+    if ( in.open(argv[1],32768) == -1 ) {
+        perror( "open" );
+        return 1;
+    }
+
+    for ( ch = in.get(); ch >= 0; ) {
+        printf( "%08X: ", line );
+        memset( b2, 0, sizeof(b2) );
+        for ( i=0; i < 16 && ch >= 0; i++ ) {
+            printf( "%02X%c", ch, ((i==7) ? '-' : ' ' ) );
+            b2[i] = (isprint(ch & 0x7f) ? ch : '.');
+            ch = in.get();
+        }
+        line += i;
+        for ( ; i<16; i++ ) fputs("   ",stdout);
+        printf( " %s\n", b2 );
+    }
+
+    return in.close();
+}
index 4031e933c42bdf3301774b16eb72515e4ce628ef..0ba6fcdd9e9ae490c3e897fa1de818b01c14e807 100644 (file)
 //
 #if defined(__GNUC__) || defined(__GNUG__)
 #pragma implementation
-#else
-#ifndef HAS_BOOL
-#define HAS_BOOL
-typedef int bool;
-#define false 0
-#define true  1
-#endif
 #endif
 
-#include <assert.h>
+#include "config.h"
+// for xstrdup
+#include "util.h"
+
+//#include <assert.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <dirent.h>
-#include <ctype.h>
+//#include <ctype.h>
 #include <string.h>
-#include <sys/types.h>
+//#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <fcntl.h>
@@ -120,9 +117,9 @@ typedef int bool;
 #include <signal.h>
 #include <errno.h>
 
-#if defined(HAS_PSIGNAL) && !defined(LINUX) && !defined(FREEBSD)
+#if HAVE_SIGINFO_H
 #include <siginfo.h>
-#endif // HAS_PSIGNAL
+#endif
 
 #include <netinet/in.h>
 #include <netinet/tcp.h>  // TCP_NODELAY
@@ -157,8 +154,7 @@ static bool verbose  = false;
 static bool envelope = false;
 static bool no_fork  = false;
 static const char* programname = 0;
-static const char* RCS_ID =
-    "$Id$";
+static const char* RCS_ID = "$Id$";
 
 // ----------------------------------------------------------------------
 
@@ -173,7 +169,7 @@ struct REList {
 };
 
 REList::REList( const char* what, bool doCase )
-        :next(0),data(strdup(what))
+        :next(0),data(xstrdup(what))
 {
     int result = regcomp( &rexp, what,
                           REG_EXTENDED | REG_NOSUB | (doCase ? 0 : REG_ICASE) );
@@ -635,13 +631,13 @@ parseCommandline( int argc, char* argv[], REList*& head,
         case 'C':
             if ( optarg && *optarg ) {
                 if ( copydir ) free( (void*) copydir );
-                assert( (copydir = strdup(optarg)) );
+                assert( (copydir = xstrdup(optarg)) );
             }
             break;
         case 'c':
             if ( optarg && *optarg ) {
                 if ( *conffile ) free((void*) conffile );
-                assert( (conffile = strdup(optarg)) );
+                assert( (conffile = xstrdup(optarg)) );
             }
             break;
 
@@ -846,7 +842,7 @@ main( int argc, char* argv[] )
 {
     // setup variables
     REList* list = 0;
-    char* conffile = strdup( DEFAULT_SQUID_CONF );
+    char* conffile = xstrdup( DEFAULT_SQUID_CONF );
     serverPort = htons(DEFAULTPORT);
     if ( convertHostname(DEFAULTHOST,serverHost) == -1 ) {
         fprintf( stderr, "unable to resolve host %s!\n", DEFAULTHOST );
@@ -907,7 +903,7 @@ main( int argc, char* argv[] )
                 ::iamalive = false;
             }
 
-            for ( int i=0; i < cdv.size(); ++i ) {
+            for ( size_t i=0; i < cdv.size(); ++i ) {
                 if ( getpid() == getpgrp() ) {
                     // only parent == group leader may fork off new processes
                     if ( (child[i]=fork()) < 0 ) {
@@ -933,7 +929,7 @@ main( int argc, char* argv[] )
             // collect the garbase
             pid_t temp;
             int status;
-            for ( int i=0; i < cdv.size(); ++i ) {
+            for ( size_t i=0; i < cdv.size(); ++i ) {
                 while ( (temp=waitpid( (pid_t)-1, &status, 0 )) == -1 )
                     if ( errno == EINTR ) continue;
                 if ( ::debug ) printf( "collected child %d\n", (int) temp );
index 3f302d2657ce3dfd157cf4a59799898e8b58e8fb..5eb91e3df1eb807cc3c629d4f12d0211f80805b6 100644 (file)
 #pragma implementation
 #endif
 
-#include <sys/types.h>
+#include "config.h"
+#include "signal.hh"
+
+//#include <sys/types.h>
 #include <errno.h>
 #include <string.h>
 #include <memory.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/wait.h>
-#include <signal.h>
-
-#include "signal.hh"
-
-static const char* RCS_ID =
-    "$Id$";
-
-#ifndef HAS_PSIGNAL
-#ifdef AIX
-extern const char* const sys_siglist[];
-#define _sys_nsig 64
-#define _sys_siglist sys_siglist
-#endif // AIX
-
-void
-psignal( int sig, const char* msg )
-// purpose: print message, colon, space, signal name and LF.
-// paramtr: sig (IN): signal number
-//          msg (IN): message to prepend
-{
-    if ( msg && *msg ) fprintf( stderr, "%s: ", msg );
-    if ( sig > 0 && sig < _sys_nsig )
-        fprintf( stderr, "%s\n", _sys_siglist[sig] );
-    else
-        fputs( "(unknown)\n", stderr );
-}
-#endif // !HAS_PSIGNAL
+//#include <signal.h>
 
 SigFunc*
 Signal( int signo, SigFunc* newhandler, bool doInterrupt )
@@ -138,10 +115,10 @@ sigChild( int signo )
     int saveerr = errno;
     while ( (pid = waitpid( -1, &status, WNOHANG )) > 0 ) {
         if ( WIFEXITED(status) ) {
-            sprintf( line, "child (pid=%ld) reaped, status %d\n%c",
+            snprintf( line, 128, "child (pid=%ld) reaped, status %d\n%c",
                      (long) pid, WEXITSTATUS(status), 0 );
         } else if ( WIFSIGNALED(status) ) {
-            sprintf( line, "child (pid=%ld) died on signal %d%s\n%c",
+            snprintf( line, 128, "child (pid=%ld) died on signal %d%s\n%c",
                      (long) pid, WTERMSIG(status),
 #ifdef WCOREDUMP
                      WCOREDUMP(status) ? " (core generated)" : "",
@@ -150,7 +127,7 @@ sigChild( int signo )
 #endif
                      0 );
         } else {
-            sprintf( line, "detected dead child (pid=%ld), status %d\n%c",
+            snprintf( line, 128, "detected dead child (pid=%ld), status %d\n%c",
                      (long) pid, status, 0 );
         }
         write( STDERR_FILENO, line, strlen(line) );
index b923b740ce771d523409ff2d454d92b840b66da1..73d1cdfadfee05455a7dd35897a6766a95d49c61 100644 (file)
 // Initial revision
 //
 //
+
 #ifndef _SIGNAL_HH
 #define _SIGNAL_HH
 
+#include "config.h"
+
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
 #if defined(__GNUC__) || defined(__GNUG__)
 #pragma interface
 #else
@@ -77,14 +84,6 @@ extern "C" {
   typedef SIGRETTYPE SigFunc( SIGPARAM );
 }
 
-#ifndef HAS_PSIGNAL
-void
-psignal( int sig, const char* msg );
-  // purpose: print message, colon, space, signal name and LF.
-  // paramtr: sig (IN): signal number
-  //          msg (IN): message to prepend
-#endif // ! HAS_PSIGNAL
-
 SigFunc*
 Signal( int signo, SigFunc* newhandler, bool doInterrupt );
   // purpose: install reliable signals
index 033ffe7adb4b2b8ad9efcce01c6142c1529d5bcd..129e6d1c2d4e3132f7323c0dd1e398b19226de52 100644 (file)
@@ -60,9 +60,6 @@
 
 #include "convert.hh"
 
-static const char* RCS_ID =
-    "$Id$";
-
 int
 setSocketBuffers( int sockfd, int size )
 // purpose: set socket buffers for both directions to the specified size
@@ -95,7 +92,7 @@ getSocketNoDelay( int sockfd )
 //         -1, if an error occurred (e.g. datagram socket)
 {
     int delay = 0;
-    SOCKLEN len = sizeof(delay);
+    socklen_t len = sizeof(delay);
     if ( getsockopt( sockfd, IPPROTO_TCP, TCP_NODELAY,
                      (char*) &delay, &len ) == -1 ) {
         perror( "# getsockopt( TCP_NODELAY ) failed" );
index 55fca054341791d29d2032228a2744bc3c5efc0b..29a53d116890f5211ea07ccc3eb695fb2276c78c 100644 (file)
 #pragma implementation
 #endif
 
-#include <assert.h>
+#include "config.h"
+//#include <assert.h>
 #include "squid-tlv.hh"
 
-static const char* RCS_ID =
-    "$Id$";
-
 SquidTLV::SquidTLV( SquidMetaType _type, size_t _size, void* _data )
         :next(0),size(_size)
 {