$NetBSD: patch-ab,v 1.2 2011/09/12 16:46:45 taca Exp $ * Avoid using function name "getline" which conflict with system defined one. * Fix parameter to setsockopt(2). --- request.c.orig 2004-12-31 17:59:54.000000000 +0900 +++ request.c 2010-01-29 16:46:16.000000000 +0900 @@ -49,7 +49,7 @@ static int read_header(int, struct req *); static char sgetc(int); -static size_t getline(int, char[], int); +static size_t get_line(int, char[], int); static int do_request(int, struct req *); void @@ -63,7 +63,7 @@ (void) memset(&r, 0, sizeof(r)); r.cl = clinfo; - if (getline(cl, buf, sizeof(buf)) < 1) + if (get_line(cl, buf, sizeof(buf)) < 1) *buf = '\0'; if ((http_url(&r, buf)) == 0) { @@ -189,7 +189,7 @@ char *b, *p; i = 0; - while ((len = getline(cl, buf, sizeof(buf))) > 0 && i < sizeof(r->header) - 1) { + while ((len = get_line(cl, buf, sizeof(buf))) > 0 && i < sizeof(r->header) - 1) { b = buf; while (isspace((int) *b) && *(b++) != '\0'); if (*b == '\0') @@ -228,7 +228,7 @@ } static size_t -getline(int s, char buf[], int len) +get_line(int s, char buf[], int len) { int c; size_t i; @@ -288,7 +288,7 @@ extern struct cfg config; unsigned long ip; int s; - void *foo; + int val = 1; size_t len, i; char buf[4096]; @@ -371,7 +371,7 @@ if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) { DEBUG(("do_request() => socket() failed for %s port %d", r->host, r->port)); return E_CON; - } else if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &foo, sizeof(foo)) != 0) { + } else if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) != 0) { DEBUG(("do_request() => setsockopt() failed for %s port %d", r->host, r->port)); return E_CON; } else if (connect(s, (struct sockaddr *) & addr, sizeof(addr)) == -1) { @@ -493,7 +493,7 @@ } if (r->type != CONNECT) { i = 0; - while ((len = getline(s, buf, sizeof(buf))) > 0 && i < sizeof(r->header) - 1) { + while ((len = get_line(s, buf, sizeof(buf))) > 0 && i < sizeof(r->header) - 1) { DEBUG(("do_request() => got remote header line: (%s)", buf)); r->header[i] = (char *) my_alloc(len + 1); (void) strcpy(r->header[i++], buf);