From f9e5a344e8cfef6e20e2bbacb23bc4653525ca82 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 19 Jul 1997 13:19:59 +0000 Subject: [PATCH] gindent --- lib/snprintf.c | 2 +- src/cache_cf.cc | 4 +- src/client.cc | 3 +- src/defines.h | 2 +- src/main.cc | 3 +- src/mime.cc | 98 +++++++++++++++++++++++----------------------- src/peer_select.cc | 25 ++++++------ 7 files changed, 69 insertions(+), 68 deletions(-) diff --git a/lib/snprintf.c b/lib/snprintf.c index 75bb686127..219244acd4 100644 --- a/lib/snprintf.c +++ b/lib/snprintf.c @@ -13,7 +13,7 @@ **************************************************************/ /* Original RCS tag: - Id: snprintf.c,v 1.1 1995/08/19 20:36:09 papowell Exp */ + * Id: snprintf.c,v 1.1 1995/08/19 20:36:09 papowell Exp */ static void dopr(); static char *end; diff --git a/src/cache_cf.cc b/src/cache_cf.cc index edba0ae04b..11578cde4f 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.215 1997/07/19 02:56:35 wessels Exp $ + * $Id: cache_cf.cc,v 1.216 1997/07/19 07:20:00 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -490,7 +490,7 @@ parse_peer(peer ** head) peer *p; int i; ushortlist *u; - const char *me = null_string; /* XXX */ + const char *me = null_string; /* XXX */ p = xcalloc(1, sizeof(peer)); p->http_port = CACHE_HTTP_PORT; p->icp_port = CACHE_ICP_PORT; diff --git a/src/client.cc b/src/client.cc index b0931a3085..7c128b88f5 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,8 +1,9 @@ + /* - * $Id: client.cc,v 1.21 1997/07/16 22:58:23 wessels Exp $ + * $Id: client.cc,v 1.22 1997/07/19 07:20:01 wessels Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived diff --git a/src/defines.h b/src/defines.h index 780c0df698..659945d39c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -97,7 +97,7 @@ #undef HASH_SIZE 65357 /* prime number < 65536 */ #endif -#define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */ +#define DEFAULT_HASH_SIZE 7951 /* prime number < 8192 */ #define HTTP_REPLY_FIELD_SZ 128 diff --git a/src/main.cc b/src/main.cc index cc6fc605d9..4dccdf3e05 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.166 1997/07/19 02:56:38 wessels Exp $ + * $Id: main.cc,v 1.167 1997/07/19 07:20:02 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -593,7 +593,6 @@ main(int argc, char **argv) sendSignal(); /* NOTREACHED */ } - setMaxFD(); if (opt_catch_signals) diff --git a/src/mime.cc b/src/mime.cc index bf306124a6..0413bcdd18 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -1,5 +1,5 @@ /* - * $Id: mime.cc,v 1.34 1997/07/19 07:18:01 wessels Exp $ + * $Id: mime.cc,v 1.35 1997/07/19 07:20:03 wessels Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -384,52 +384,52 @@ mimeInit(char *filename) static void mimeLoadIconFile(const char *icon) { - int fd; - int n; - int l; - struct stat sb; - StoreEntry *e; - LOCAL_ARRAY(char, path, MAXPATHLEN); - LOCAL_ARRAY(char, url, MAX_URL); - char *buf; - snprintf(url, MAX_URL, "http://internal.squid/icons/%s", icon); - if (storeGet(url)) - return; - snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon); - fd = file_open(path, O_RDONLY, NULL, NULL); - if (fd < 0) { - debug(25,0)("mimeLoadIconFile: %s: %s\n", path, xstrerror()); - return; - } - if (fstat(fd, &sb) < 0) { - debug(50,0)("mimeLoadIconFile: FD %d: fstat: %s\n", fd, xstrerror()); - return; - } - e = storeCreateEntry(url, - url, - REQ_CACHABLE, - METHOD_GET); - assert(e != NULL); - e->mem_obj->request = requestLink(urlParse(METHOD_GET, url)); - buf = get_free_4k_page(); - l = 0; - l += snprintf(buf+l, SM_PAGE_SIZE-l, "HTTP/1.0 200 OK\r\n"); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Date: %s\r\n", mkrfc1123(squid_curtime)); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Server: Squid/%s\r\n", version_string); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Content-Type: %s\r\n", Config.icons.content_type); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Content-Length: %d\r\n", (int) sb.st_size); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Last-Modified: %s\r\n", mkrfc1123(sb.st_mtime)); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "Expires: %s\r\n", mkrfc1123(squid_curtime + 86400)); - l += snprintf(buf+l, SM_PAGE_SIZE-l, "\r\n"); - httpParseReplyHeaders(buf, e->mem_obj->reply); - storeAppend(e, buf, l); - while ((n = read(fd, buf, SM_PAGE_SIZE)) > 0) - storeAppend(e, buf, n); - file_close(fd); - storeSetPublicKey(e); - storeComplete(e); - storeTimestampsSet(e); - BIT_SET(e->flag, ENTRY_SPECIAL); - debug(25,1)("Loaded icon %s\n", url); - put_free_4k_page(buf); + int fd; + int n; + int l; + struct stat sb; + StoreEntry *e; + LOCAL_ARRAY(char, path, MAXPATHLEN); + LOCAL_ARRAY(char, url, MAX_URL); + char *buf; + snprintf(url, MAX_URL, "http://internal.squid/icons/%s", icon); + if (storeGet(url)) + return; + snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon); + fd = file_open(path, O_RDONLY, NULL, NULL); + if (fd < 0) { + debug(25, 0) ("mimeLoadIconFile: %s: %s\n", path, xstrerror()); + return; + } + if (fstat(fd, &sb) < 0) { + debug(50, 0) ("mimeLoadIconFile: FD %d: fstat: %s\n", fd, xstrerror()); + return; + } + e = storeCreateEntry(url, + url, + REQ_CACHABLE, + METHOD_GET); + assert(e != NULL); + e->mem_obj->request = requestLink(urlParse(METHOD_GET, url)); + buf = get_free_4k_page(); + l = 0; + l += snprintf(buf + l, SM_PAGE_SIZE - l, "HTTP/1.0 200 OK\r\n"); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Date: %s\r\n", mkrfc1123(squid_curtime)); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Server: Squid/%s\r\n", version_string); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Type: %s\r\n", Config.icons.content_type); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Length: %d\r\n", (int) sb.st_size); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Last-Modified: %s\r\n", mkrfc1123(sb.st_mtime)); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "Expires: %s\r\n", mkrfc1123(squid_curtime + 86400)); + l += snprintf(buf + l, SM_PAGE_SIZE - l, "\r\n"); + httpParseReplyHeaders(buf, e->mem_obj->reply); + storeAppend(e, buf, l); + while ((n = read(fd, buf, SM_PAGE_SIZE)) > 0) + storeAppend(e, buf, n); + file_close(fd); + storeSetPublicKey(e); + storeComplete(e); + storeTimestampsSet(e); + BIT_SET(e->flag, ENTRY_SPECIAL); + debug(25, 1) ("Loaded icon %s\n", url); + put_free_4k_page(buf); } diff --git a/src/peer_select.cc b/src/peer_select.cc index 91d315b647..4ab113309e 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.22 1997/07/19 04:01:24 wessels Exp $ + * $Id: peer_select.cc,v 1.23 1997/07/19 07:20:04 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -58,10 +58,11 @@ static struct { int timeouts; } PeerStats; -static char *DirectStr[] = { - "DIRECT_NO", - "DIRECT_MAYBE", - "DIRECT_YES" +static char *DirectStr[] = +{ + "DIRECT_NO", + "DIRECT_MAYBE", + "DIRECT_YES" }; static void peerSelectFoo _PARAMS((ps_state *)); @@ -88,7 +89,7 @@ peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry) int n; if (entry == NULL) return 0; - debug(44,3)("peerSelectIcpPing: %s\n", entry->url); + debug(44, 3) ("peerSelectIcpPing: %s\n", entry->url); if (entry->ping_status != PING_NONE) return 0; if (direct == DIRECT_YES) @@ -102,7 +103,7 @@ peerSelectIcpPing(request_t * request, int direct, StoreEntry * entry) if (direct != DIRECT_NO) return 0; n = neighborsCount(request); - debug(44,3)("peerSelectIcpPing: counted %d neighbors\n", n); + debug(44, 3) ("peerSelectIcpPing: counted %d neighbors\n", n); return n; } @@ -139,9 +140,9 @@ peerSelect(request_t * request, { ps_state *psstate = xcalloc(1, sizeof(ps_state)); if (entry) - debug(44,3)("peerSelect: %s\n", entry->url); + debug(44, 3) ("peerSelect: %s\n", entry->url); else - debug(44,3)("peerSelect: %s\n", RequestMethodStr[request->method]); + debug(44, 3) ("peerSelect: %s\n", RequestMethodStr[request->method]); cbdataAdd(psstate); psstate->request = requestLink(request); psstate->entry = entry; @@ -179,7 +180,7 @@ peerSelectCallback(ps_state * psstate, peer * p) StoreEntry *entry = psstate->entry; void *data = psstate->callback_data; if (entry) { - debug(44, 3) ("peerSelectCallback: %s\n", entry->url); + debug(44, 3) ("peerSelectCallback: %s\n", entry->url); if (entry->ping_status == PING_WAITING) eventDelete(peerPingTimeout, psstate); entry->ping_status = PING_DONE; @@ -300,7 +301,7 @@ peerPingTimeout(void *data) ps_state *psstate = data; StoreEntry *entry = psstate->entry; if (entry) - debug(44, 3) ("peerPingTimeout: '%s'\n", entry->url); + debug(44, 3) ("peerPingTimeout: '%s'\n", entry->url); entry->ping_status = PING_TIMEOUT; PeerStats.timeouts++; psstate->icp.timeout = 1; @@ -320,7 +321,7 @@ peerHandleIcpReply(peer * p, peer_t type, icp_opcode op, void *data) ps_state *psstate = data; int w_rtt; request_t *request = psstate->request; - debug(44,3)("peerHandleIcpReply: %s %s\n", + debug(44, 3) ("peerHandleIcpReply: %s %s\n", IcpOpcodeStr[op], psstate->entry->url); psstate->icp.n_recv++; -- 2.47.2