From: wessels <> Date: Sun, 13 Oct 1996 12:19:36 +0000 (+0000) Subject: From: Markus Gyger X-Git-Tag: SQUID_3_0_PRE1~5669 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff8d0ea675b22592ec9d31d35e2996e177b1a06e;p=thirdparty%2Fsquid.git From: Markus Gyger here are some minor cosmetic changes for squid-1.1.beta6. BTW: configure doesn't reflect configure.in correctly right now. --- diff --git a/lib/getfullhostname.c b/lib/getfullhostname.c index 9031f835e6..2eabf34709 100644 --- a/lib/getfullhostname.c +++ b/lib/getfullhostname.c @@ -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 @@ -135,6 +135,9 @@ #define _SQUID_NETDB_H_ #include #endif +#if HAVE_UNISTD_H +#include +#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); diff --git a/src/acl.cc b/src/acl.cc index 6580e170ad..b3da1b4547 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -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)) diff --git a/src/client_side.cc b/src/client_side.cc index cd3e96292b..9a278fb501 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); diff --git a/src/comm.cc b/src/comm.cc index 4f000916a7..aff332984b 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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); diff --git a/src/dns.cc b/src/dns.cc index 7a1947e5d6..5b800c5e87 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -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; diff --git a/src/ftp.cc b/src/ftp.cc index 0382aa565e..424b0f3b4e 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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]; diff --git a/src/main.cc b/src/main.cc index ca4f084043..7d6116755c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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); diff --git a/src/redirect.cc b/src/redirect.cc index cd1dd57a11..31bf8b355f 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -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; diff --git a/src/squid.h b/src/squid.h index 33c409751e..9b8bfcb339 100644 --- a/src/squid.h +++ b/src/squid.h @@ -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 * @@ -158,8 +158,8 @@ #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 diff --git a/src/stat.cc b/src/stat.cc index bc32ae35cc..570ff042e5 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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. */ diff --git a/src/tools.cc b/src/tools.cc index 5a9690a98f..dc982a98a7 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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) {