]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Markus Gyger <mgyger@itr.ch>
authorwessels <>
Sun, 13 Oct 1996 12:19:36 +0000 (12:19 +0000)
committerwessels <>
Sun, 13 Oct 1996 12:19:36 +0000 (12:19 +0000)
here are some minor cosmetic changes for squid-1.1.beta6.
BTW: configure doesn't reflect configure.in correctly right now.

lib/getfullhostname.c
src/acl.cc
src/client_side.cc
src/comm.cc
src/dns.cc
src/ftp.cc
src/main.cc
src/redirect.cc
src/squid.h
src/stat.cc
src/tools.cc

index 9031f835e6212c3af90f5c5328797b2ea1b24ca0..2eabf3470950e1774341297333cdf4c70608343f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: getfullhostname.c,v 1.8 1996/09/17 16:53:56 wessels Exp $
+ * $Id: getfullhostname.c,v 1.9 1996/10/13 06:19:36 wessels Exp $
  *
  * DEBUG: 
  * AUTHOR: Harvest Derived
 #define _SQUID_NETDB_H_
 #include <netdb.h>
 #endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #include "ansiproto.h"
 #include "util.h"
@@ -149,7 +152,6 @@ getfullhostname(void)
 {
     struct hostent *hp = NULL;
     static char buf[SQUIDHOSTNAMELEN + 1];
-    extern int gethostname();  /* UNIX system call */
 
     if (gethostname(buf, SQUIDHOSTNAMELEN) < 0)
        return (NULL);
index 6580e170adbb7b666edebb865a09d73f9aee6cb2..b3da1b454723b28f05150ec71bfd052dd2737c3a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: acl.cc,v 1.48 1996/10/09 22:49:27 wessels Exp $
+ * $Id: acl.cc,v 1.49 1996/10/13 06:19:42 wessels Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -214,7 +214,7 @@ decode_addr(char *asc, struct in_addr *addr, struct in_addr *mask)
 
     switch (sscanf(asc, "%d.%d.%d.%d", &a1, &a2, &a3, &a4)) {
     case 4:                    /* a dotted quad */
-       if ((a = inet_addr(asc)) != INADDR_NONE ||
+       if ((a = (u_num32) inet_addr(asc)) != INADDR_NONE ||
            !strcmp(asc, "255.255.255.255")) {
            addr->s_addr = a;
            /* inet_addr() outputs in network byte order */
@@ -239,7 +239,7 @@ decode_addr(char *asc, struct in_addr *addr, struct in_addr *mask)
     if (mask != NULL) {                /* mask == NULL if called to decode a netmask */
 
        /* Guess netmask */
-       a = ntohl(addr->s_addr);
+       a = (u_num32) ntohl(addr->s_addr);
        if (!(a & 0xFFFFFFFFul))
            mask->s_addr = htonl(0x00000000ul);
        else if (!(a & 0x00FFFFFF))
index cd3e96292becfe032d89d9e811b372109d2d49a7..9a278fb501721d69ca291148794c975135f9b6b7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.41 1996/10/11 23:11:06 wessels Exp $
+ * $Id: client_side.cc,v 1.42 1996/10/13 06:19:42 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -305,7 +305,7 @@ proxyAuthenticate(char *headers)
 
                passwords = xmalloc((size_t) buf.st_size + 2);
                f = fopen(Config.proxyAuthFile, "r");
-               fread(passwords, buf.st_size, 1, f);
+               fread(passwords, (size_t) buf.st_size, 1, f);
                *(passwords + buf.st_size) = '\0';
                strcat(passwords, "\n");
                fclose(f);
index 4f000916a7e4ddb90da06d8cfb99c6a3d674816a..aff332984b4922724dab54f9785850c81a43b23f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.89 1996/10/11 23:11:52 wessels Exp $
+ * $Id: comm.cc,v 1.90 1996/10/13 06:19:43 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -611,7 +611,7 @@ comm_select_incoming(void)
     int fds[3];
     int N = 0;
     int i = 0;
-    void (*tmp) () = NULL;
+    PF hdl = NULL;
 
     FD_ZERO(&read_mask);
     FD_ZERO(&write_mask);
@@ -643,14 +643,14 @@ comm_select_incoming(void)
        for (i = 0; i < N; i++) {
            fd = fds[i];
            if (FD_ISSET(fd, &read_mask)) {
-               tmp = fd_table[fd].read_handler;
+               hdl = fd_table[fd].read_handler;
                fd_table[fd].read_handler = 0;
-               tmp(fd, fd_table[fd].read_data);
+               hdl(fd, fd_table[fd].read_data);
            }
            if (FD_ISSET(fd, &write_mask)) {
-               tmp = fd_table[fd].write_handler;
+               hdl = fd_table[fd].write_handler;
                fd_table[fd].write_handler = 0;
-               tmp(fd, fd_table[fd].write_data);
+               hdl(fd, fd_table[fd].write_data);
            }
        }
     }
@@ -664,7 +664,7 @@ comm_select(time_t sec)
     fd_set exceptfds;
     fd_set readfds;
     fd_set writefds;
-    void (*tmp) () = NULL;
+    PF hdl = NULL;
     int fd;
     int i;
     int maxfd;
@@ -790,31 +790,25 @@ comm_select(time_t sec)
            if (FD_ISSET(fd, &readfds)) {
                debug(5, 6, "comm_select: FD %d ready for reading\n", fd);
                if (fd_table[fd].read_handler) {
-                   tmp = fd_table[fd].read_handler;
+                   hdl = fd_table[fd].read_handler;
                    fd_table[fd].read_handler = 0;
-                   debug(5, 10, "calling read handler %p(%d,%p)\n",
-                       tmp, fd, fd_table[fd].read_data);
-                   tmp(fd, fd_table[fd].read_data);
+                   hdl(fd, fd_table[fd].read_data);
                }
            }
            if (FD_ISSET(fd, &writefds)) {
                debug(5, 5, "comm_select: FD %d ready for writing\n", fd);
                if (fd_table[fd].write_handler) {
-                   tmp = fd_table[fd].write_handler;
+                   hdl = fd_table[fd].write_handler;
                    fd_table[fd].write_handler = 0;
-                   debug(5, 10, "calling write handler %p(%d,%p)\n",
-                       tmp, fd, fd_table[fd].write_data);
-                   tmp(fd, fd_table[fd].write_data);
+                   hdl(fd, fd_table[fd].write_data);
                }
            }
            if (FD_ISSET(fd, &exceptfds)) {
                debug(5, 5, "comm_select: FD %d has an exception\n", fd);
                if (fd_table[fd].except_handler) {
-                   tmp = fd_table[fd].except_handler;
+                   hdl = fd_table[fd].except_handler;
                    fd_table[fd].except_handler = 0;
-                   debug(5, 10, "calling except handler %p(%d,%p)\n",
-                       tmp, fd, fd_table[fd].except_data);
-                   tmp(fd, fd_table[fd].except_data);
+                   hdl(fd, fd_table[fd].except_data);
                }
            }
        }
@@ -939,9 +933,8 @@ comm_join_mcast_groups(int fd)
     wordlist *s = NULL;
 
     for (s = Config.mcast_group_list; s; s = s->next) {
-       debug(5, 10,
-           "comm_join_mcast_groups: joining group %s on FD %d\n", s->key, fd);
-
+       debug(5, 10, "comm_join_mcast_groups: joining group %s on FD %d\n",
+               s->key, fd);
        mr.imr_multiaddr.s_addr = inet_addr(s->key);
        mr.imr_interface.s_addr = INADDR_ANY;
        if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
@@ -959,7 +952,6 @@ commSetNoLinger(int fd)
     struct linger L;
     L.l_onoff = 0;             /* off */
     L.l_linger = 0;
-    debug(5, 10, "commSetNoLinger: turning off SO_LINGER on FD %d\n", fd);
     if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &L, sizeof(L)) < 0)
        debug(5, 0, "commSetNoLinger: FD %d: %s\n", fd, xstrerror());
 }
@@ -968,7 +960,6 @@ static void
 commSetReuseAddr(int fd)
 {
     int on = 1;
-    debug(5, 10, "commSetReuseAddr: turning on SO_REUSEADDR on FD %d\n", fd);
     if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0)
        debug(5, 1, "commSetReuseAddr: FD %d: %s\n", fd, xstrerror());
 }
@@ -1151,7 +1142,7 @@ static void
 checkTimeouts(void)
 {
     int fd;
-    void (*hdl) () = NULL;
+    PF hdl = NULL;
     FD_ENTRY *f = NULL;
     void *data;
     /* scan for timeout */
@@ -1176,7 +1167,7 @@ checkLifetimes(void)
     time_t lft;
     FD_ENTRY *fde = NULL;
 
-    void (*func) () = NULL;
+    PF hdl = NULL;
 
     for (fd = 0; fd < FD_SETSIZE; fd++) {
        if ((lft = comm_get_fd_lifetime(fd)) == -1)
@@ -1185,17 +1176,17 @@ checkLifetimes(void)
            continue;
        debug(5, 5, "checkLifetimes: FD %d Expired\n", fd);
        fde = &fd_table[fd];
-       if ((func = fde->lifetime_handler) != NULL) {
+       if ((hdl = fde->lifetime_handler) != NULL) {
            debug(5, 5, "checkLifetimes: FD %d: Calling lifetime handler\n", fd);
-           func(fd, fde->lifetime_data);
+           hdl(fd, fde->lifetime_data);
            fde->lifetime_handler = NULL;
-       } else if ((func = fde->read_handler) != NULL) {
+       } else if ((hdl = fde->read_handler) != NULL) {
            debug(5, 5, "checkLifetimes: FD %d: Calling read handler\n", fd);
-           func(fd, fd_table[fd].read_data);
+           hdl(fd, fd_table[fd].read_data);
            fd_table[fd].read_handler = NULL;
-       } else if ((func = fd_table[fd].write_handler)) {
+       } else if ((hdl = fd_table[fd].write_handler)) {
            debug(5, 5, "checkLifetimes: FD %d: Calling write handler\n", fd);
-           func(fd, fde->write_data);
+           hdl(fd, fde->write_data);
            fde->write_handler = NULL;
        } else {
            debug(5, 5, "checkLifetimes: FD %d: No handlers, calling comm_close()\n", fd);
index 7a1947e5d65a0ada35c4698fcf1d7af23338569d..5b800c5e8716f5b3ed74c184e02496e5b43b187d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dns.cc,v 1.19 1996/10/09 22:49:31 wessels Exp $
+ * $Id: dns.cc,v 1.20 1996/10/13 06:19:44 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -121,7 +121,7 @@ struct _dnsStats DnsStats;
 static int
 dnsOpenServer(char *command)
 {
-    int pid;
+    pid_t pid;
     struct sockaddr_in S;
     int cfd;
     int sfd;
index 0382aa565ecac882abd4b3457b11018bd2b5585e..424b0f3b4e3d7a6ce474bb0af492612e9362cb9f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.64 1996/10/11 23:11:10 wessels Exp $
+ * $Id: ftp.cc,v 1.65 1996/10/13 06:19:44 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -140,14 +140,6 @@ static void ftpSendRequest _PARAMS((int, FtpStateData *));
 static void ftpServerClosed _PARAMS((int, void *));
 static void ftp_login_parser _PARAMS((char *, FtpStateData *));
 
-/* Global functions not declared in ftp.h */
-void ftpLifetimeExpire(int fd, FtpStateData * data);
-int ftpReadReply(int fd, FtpStateData * data);
-void ftpSendComplete(int fd, char *buf, int size, int errflag, void *ftpData);
-void ftpSendRequest(int fd, FtpStateData * data);
-void ftpConnInProgress(int fd, FtpStateData * data);
-void ftpServerClose(void);
-
 /* External functions */
 extern char *base64_decode _PARAMS((char *coded));
 
@@ -696,7 +688,7 @@ ftpServerClose(void)
 int
 ftpInitialize(void)
 {
-    int pid;
+    pid_t pid;
     int cfd;
     int squid_to_ftpget[2];
     int ftpget_to_squid[2];
index ca4f0840438cb13017b75212189960c9945ab67f..7d6116755c2e84332c9814cdf7bf0436f839b038 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.cc,v 1.92 1996/10/11 23:11:16 wessels Exp $
+ * $Id: main.cc,v 1.93 1996/10/13 06:19:48 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -704,7 +704,7 @@ main(int argc, char **argv)
 static void
 sendSignal(void)
 {
-    int pid;
+    pid_t pid;
     debug_log = stderr;
     if (ConfigFile == NULL)
        ConfigFile = xstrdup(DefaultConfigFile);
index cd1dd57a1188f3f8b86fcb5515fdbbe6b3ea51e4..31bf8b355fbddcd0ead80fabc6617f5922456e3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: redirect.cc,v 1.25 1996/10/11 23:11:17 wessels Exp $
+ * $Id: redirect.cc,v 1.26 1996/10/13 06:19:49 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -86,7 +86,7 @@ static struct redirectQueueData **redirectQueueTailP = &redirectQueueHead;
 static int
 redirectCreateRedirector(char *command)
 {
-    int pid;
+    pid_t pid;
     struct sockaddr_in S;
     static int n_redirector = 0;
     int cfd;
index 33c409751e1c096d9092d8e629301364c46242fb..9b8bfcb33926301e90cf80fd79fbaca8c99b0759 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.58 1996/10/09 15:34:36 wessels Exp $
+ * $Id: squid.h,v 1.59 1996/10/13 06:19:50 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
 #define INADDR_NONE ((unsigned long) -1)
 #endif
 
-#if !defined(HAVE_RUSAGE) && defined(_SQUID_HPUX_)
-#define HAVE_RUSAGE
+#if !defined(HAVE_GETRUSAGE) && defined(_SQUID_HPUX_)
+#define HAVE_GETRUSAGE
 #define getrusage(a, b)  syscall(SYS_GETRUSAGE, a, b)
 #endif
 
index bc32ae35cc1b45e5c4e4dc1af97d2045e013af10..570ff042e58112ddcbdd8707400c4b6f59a1178e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.83 1996/10/10 22:21:00 wessels Exp $
+ * $Id: stat.cc,v 1.84 1996/10/13 06:19:51 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -931,7 +931,6 @@ parameter_get(cacheinfo * obj, StoreEntry * sentry)
 
 #if LOG_FULL_HEADERS
 static char c2x[] =
-{
     "000102030405060708090a0b0c0d0e0f"
     "101112131415161718191a1b1c1d1e1f"
     "202122232425262728292a2b2c2d2e2f"
@@ -947,8 +946,7 @@ static char c2x[] =
     "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
     "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
     "e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
-    "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
-};
+    "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
 
 /* log_quote -- URL-style encoding on MIME headers. */
 
index 5a9690a98fa554f362d94cb9a16fe6751a8bc675..dc982a98a7ee8d68e134e04612516082680eb8a1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.71 1996/10/11 18:04:57 wessels Exp $
+ * $Id: tools.cc,v 1.72 1996/10/13 06:19:52 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -203,7 +203,7 @@ dumpMallocStats(FILE * f)
 }
 
 static int
-PrintRusage(void (*f) (), FILE * lf)
+PrintRusage(void (*f) (void), FILE * lf)
 {
 #if HAVE_GETRUSAGE && defined(RUSAGE_SELF)
     struct rusage rusage;
@@ -217,7 +217,7 @@ PrintRusage(void (*f) (), FILE * lf)
 #endif
     dumpMallocStats(lf);
     if (f)
-       f(0);
+       f();
     return 0;
 }
 
@@ -368,7 +368,7 @@ sig_child(int sig)
 #else
     int status;
 #endif
-    int pid;
+    pid_t pid;
 
     do {
 #ifdef _SQUID_NEXT_
@@ -510,12 +510,13 @@ writePidFile(void)
 }
 
 
-int
+pid_t
 readPidFile(void)
 {
     FILE *pid_fp = NULL;
     char *f = NULL;
-    int pid = -1;
+    pid_t pid = -1;
+    int i;
 
     if ((f = Config.pidFilename) == NULL) {
        fprintf(stderr, "%s: ERROR: No pid file name defined\n", appname);
@@ -523,8 +524,9 @@ readPidFile(void)
     }
     pid_fp = fopen(f, "r");
     if (pid_fp != NULL) {
-       if (fscanf(pid_fp, "%d", &pid) != 1)
-           pid = 0;
+       pid = 0;
+       if (fscanf(pid_fp, "%d", &i) == 1)
+           pid = (pid_t) i;
        fclose(pid_fp);
     } else {
        if (errno != ENOENT) {