Module Name:    src
Committed By:   mrg
Date:           Mon Dec 28 07:37:59 UTC 2015

Modified Files:
        src/libexec/httpd: bozohttpd.c bozohttpd.h cgi-bozo.c content-bozo.c
            daemon-bozo.c dir-index-bozo.c lua-bozo.c main.c ssl-bozo.c
            tilde-luzah-bozo.c

Log Message:
rename bozo_err/bozo_warn/bozo_asprintf to bozoerr/etc.
new rule is that function that mirror libc-style functions get no underscore.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/libexec/httpd/bozohttpd.c
cvs rdiff -u -r1.41 -r1.42 src/libexec/httpd/bozohttpd.h
cvs rdiff -u -r1.29 -r1.30 src/libexec/httpd/cgi-bozo.c
cvs rdiff -u -r1.12 -r1.13 src/libexec/httpd/content-bozo.c \
    src/libexec/httpd/main.c
cvs rdiff -u -r1.16 -r1.17 src/libexec/httpd/daemon-bozo.c
cvs rdiff -u -r1.23 -r1.24 src/libexec/httpd/dir-index-bozo.c
cvs rdiff -u -r1.13 -r1.14 src/libexec/httpd/lua-bozo.c \
    src/libexec/httpd/tilde-luzah-bozo.c
cvs rdiff -u -r1.21 -r1.22 src/libexec/httpd/ssl-bozo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.73 src/libexec/httpd/bozohttpd.c:1.74
--- src/libexec/httpd/bozohttpd.c:1.73	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/bozohttpd.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.73 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.74 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -597,7 +597,7 @@ bozo_read_request(bozohttpd_t *httpd)
 	sigemptyset(&sa.sa_mask);
 	sigaddset(&sa.sa_mask, SIGALRM);
 	sa.sa_flags = 0;
-	sigaction(SIGALRM, &sa, NULL);	/* XXX */
+	sigaction(SIGALRM, &sa, NULL);
 
 	alarm(MAX_WAIT_TIME);
 	while ((str = bozodgetln(httpd, STDIN_FILENO, &len, bozo_read)) != NULL) {
@@ -616,7 +616,7 @@ bozo_read_request(bozohttpd_t *httpd)
 						"null method");
 				goto cleanup;
 			}
-			bozo_warn(httpd,
+			bozowarn(httpd,
 				  "got request ``%s'' from host %s to port %s",
 				  str,
 				  host ? host : addr ? addr : "<local>",
@@ -800,7 +800,7 @@ mmap_and_write_part(bozohttpd_t *httpd, 
 
 	addr = mmap(0, mappedsz, PROT_READ, MAP_SHARED, fd, mappedoffset);
 	if (addr == (char *)-1) {
-		bozo_warn(httpd, "mmap failed: %s", strerror(errno));
+		bozowarn(httpd, "mmap failed: %s", strerror(errno));
 		return -1;
 	}
 	mappedaddr = addr;
@@ -811,7 +811,7 @@ mmap_and_write_part(bozohttpd_t *httpd, 
 	while (sz > BOZO_WRSZ) {
 		if (bozo_write(httpd, STDOUT_FILENO, addr + wroffset,
 				BOZO_WRSZ) != BOZO_WRSZ) {
-			bozo_warn(httpd, "write failed: %s", strerror(errno));
+			bozowarn(httpd, "write failed: %s", strerror(errno));
 			goto out;
 		}
 		debug((httpd, DEBUG_OBESE, "wrote %d bytes", BOZO_WRSZ));
@@ -820,13 +820,13 @@ mmap_and_write_part(bozohttpd_t *httpd, 
 	}
 	if (sz && (size_t)bozo_write(httpd, STDOUT_FILENO, addr + wroffset,
 				sz) != sz) {
-		bozo_warn(httpd, "final write failed: %s", strerror(errno));
+		bozowarn(httpd, "final write failed: %s", strerror(errno));
 		goto out;
 	}
 	debug((httpd, DEBUG_OBESE, "wrote %d bytes", (int)sz));
  out:
 	if (munmap(mappedaddr, mappedsz) < 0) {
-		bozo_warn(httpd, "munmap failed");
+		bozowarn(httpd, "munmap failed");
 		return -1;
 	}
 
@@ -922,8 +922,7 @@ bozo_escape_rfc3986(bozohttpd_t *httpd, 
  * the URL we will tack these on to the new (redirected) URL.
  */
 static void
-handle_redirect(bozo_httpreq_t *request,
-		const char *url, int absolute)
+handle_redirect(bozo_httpreq_t *request, const char *url, int absolute)
 {
 	bozohttpd_t *httpd = request->hr_httpd;
 	char *finalurl, *urlbuf;
@@ -938,14 +937,14 @@ handle_redirect(bozo_httpreq_t *request,
 			   * eg. https:// */
 
 	if (url == NULL) {
-		bozo_asprintf(httpd, &urlbuf, "/%s/", request->hr_file);
+		bozoasprintf(httpd, &urlbuf, "/%s/", request->hr_file);
 		url = urlbuf;
 	} else
 		urlbuf = NULL;
 
 #ifndef NO_USER_SUPPORT
 	if (request->hr_user && !absolute) {
-		bozo_asprintf(httpd, &userbuf, "/~%s%s", request->hr_user, url);
+		bozoasprintf(httpd, &userbuf, "/~%s%s", request->hr_user, url);
 		url = userbuf;
 	} else
 		userbuf = NULL;
@@ -1024,7 +1023,7 @@ handle_redirect(bozo_httpreq_t *request,
 		strlcat(finalurl, request->hr_query, finalurl_len);
 	}
 
-	bozo_warn(httpd, "redirecting %s", finalurl);
+	bozowarn(httpd, "redirecting %s", finalurl);
 	debug((httpd, DEBUG_FAT, "redirecting %s", finalurl));
 
 	bozo_printf(httpd, "%s 301 Document Moved\r\n", request->hr_proto);
@@ -1144,7 +1143,7 @@ check_virtual(bozo_httpreq_t *request)
 					debug((httpd, DEBUG_OBESE, "found it punch it"));
 					request->hr_virthostname =
 					    bozostrdup(httpd, request, d->d_name);
-					bozo_asprintf(httpd, &s, "%s/%s",
+					bozoasprintf(httpd, &s, "%s/%s",
 					    httpd->virtbase,
 					    request->hr_virthostname);
 					break;
@@ -1396,7 +1395,7 @@ transform_request(bozo_httpreq_t *reques
 		}
 		if (strchr(file + 2, '/') == NULL) {
 			char *userredirecturl;
-			bozo_asprintf(httpd, &userredirecturl, "%s/", file);
+			bozoasprintf(httpd, &userredirecturl, "%s/", file);
 			handle_redirect(request, userredirecturl, 0);
 			free(userredirecturl);
 			return 0;
@@ -1557,7 +1556,7 @@ bozo_process_request(bozo_httpreq_t *req
 	fd = -1;
 	encoding = NULL;
 	if (can_gzip(request)) {
-		bozo_asprintf(httpd, &file, "%s.gz", request->hr_file);
+		bozoasprintf(httpd, &file, "%s.gz", request->hr_file);
 		fd = open(file, O_RDONLY);
 		if (fd >= 0)
 			encoding = "gzip";
@@ -1761,7 +1760,7 @@ debug__(bozohttpd_t *httpd, int level, c
 
 /* these are like warn() and err(), except for syslog not stderr */
 void
-bozo_warn(bozohttpd_t *httpd, const char *fmt, ...)
+bozowarn(bozohttpd_t *httpd, const char *fmt, ...)
 {
 	va_list ap;
 
@@ -1776,7 +1775,7 @@ bozo_warn(bozohttpd_t *httpd, const char
 }
 
 void
-bozo_err(bozohttpd_t *httpd, int code, const char *fmt, ...)
+bozoerr(bozohttpd_t *httpd, int code, const char *fmt, ...)
 {
 	va_list ap;
 
@@ -1792,7 +1791,7 @@ bozo_err(bozohttpd_t *httpd, int code, c
 }
 
 void
-bozo_asprintf(bozohttpd_t *httpd, char **str, const char *fmt, ...)
+bozoasprintf(bozohttpd_t *httpd, char **str, const char *fmt, ...)
 {
 	va_list ap;
 	int e;
@@ -1802,7 +1801,7 @@ bozo_asprintf(bozohttpd_t *httpd, char *
 	va_end(ap);
 
 	if (e < 0)
-		bozo_err(httpd, EXIT_FAILURE, "asprintf");
+		bozoerr(httpd, EXIT_FAILURE, "asprintf");
 }
 
 /*
@@ -1925,7 +1924,7 @@ bozo_http_error(bozohttpd_t *httpd, int 
 
 	debug((httpd, DEBUG_FAT, "bozo_http_error %d: %s", code, msg));
 	if (header == NULL || reason == NULL) {
-		bozo_err(httpd, 1,
+		bozoerr(httpd, 1,
 			"bozo_http_error() failed (short = %p, long = %p)",
 			header, reason);
 		return code;
@@ -1956,7 +1955,7 @@ bozo_http_error(bozohttpd_t *httpd, int 
 			if (user_escaped == NULL)
 				user_escaped = request->hr_user;
 			/* expand username to ~user/ */
-			bozo_asprintf(httpd, &user, "~%s/", user_escaped);
+			bozoasprintf(httpd, &user, "~%s/", user_escaped);
 			if (user_escaped != request->hr_user)
 				free(user_escaped);
 		}
@@ -1973,7 +1972,7 @@ bozo_http_error(bozohttpd_t *httpd, int 
 		    reason, hostname, portbuf, hostname, portbuf);
 		free(user);
 		if (size >= (int)BUFSIZ) {
-			bozo_warn(httpd,
+			bozowarn(httpd,
 				"bozo_http_error buffer too small, truncated");
 			size = (int)BUFSIZ;
 		}
@@ -2148,7 +2147,7 @@ bozostrdup(bozohttpd_t *httpd, bozo_http
 		return p;
 
 	if (!request)
-		bozo_err(httpd, EXIT_FAILURE, "strdup");
+		bozoerr(httpd, EXIT_FAILURE, "strdup");
 
 	(void)bozo_http_error(httpd, 500, request, "memory allocation failure");
 	exit(EXIT_FAILURE);
@@ -2226,7 +2225,7 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs
 		httpd->virthostname = bozomalloc(httpd, MAXHOSTNAMELEN+1);
 		/* XXX we do not check for FQDN here */
 		if (gethostname(httpd->virthostname, MAXHOSTNAMELEN+1) < 0)
-			bozo_err(httpd, 1, "gethostname");
+			bozoerr(httpd, 1, "gethostname");
 		httpd->virthostname[MAXHOSTNAMELEN] = '\0';
 	} else {
 		httpd->virthostname = bozostrdup(httpd, NULL, vhost);
@@ -2301,17 +2300,17 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs
 
 	if ((username = bozo_get_pref(prefs, "username")) == NULL) {
 		if ((pw = getpwuid(uid = 0)) == NULL)
-			bozo_err(httpd, 1, "getpwuid(0): %s", strerror(errno));
+			bozoerr(httpd, 1, "getpwuid(0): %s", strerror(errno));
 		httpd->username = bozostrdup(httpd, NULL, pw->pw_name);
 	} else {
 		httpd->username = bozostrdup(httpd, NULL, username);
 		if ((pw = getpwnam(httpd->username)) == NULL)
-			bozo_err(httpd, 1, "getpwnam(%s): %s", httpd->username,
+			bozoerr(httpd, 1, "getpwnam(%s): %s", httpd->username,
 					strerror(errno));
 		if (initgroups(pw->pw_name, pw->pw_gid) == -1)
-			bozo_err(httpd, 1, "initgroups: %s", strerror(errno));
+			bozoerr(httpd, 1, "initgroups: %s", strerror(errno));
 		if (setgid(pw->pw_gid) == -1)
-			bozo_err(httpd, 1, "setgid(%u): %s", pw->pw_gid,
+			bozoerr(httpd, 1, "setgid(%u): %s", pw->pw_gid,
 					strerror(errno));
 		uid = pw->pw_uid;
 	}
@@ -2321,16 +2320,16 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs
 	if ((chrootdir = bozo_get_pref(prefs, "chroot dir")) != NULL) {
 		httpd->rootdir = bozostrdup(httpd, NULL, chrootdir);
 		if (chdir(httpd->rootdir) == -1)
-			bozo_err(httpd, 1, "chdir(%s): %s", httpd->rootdir,
+			bozoerr(httpd, 1, "chdir(%s): %s", httpd->rootdir,
 				strerror(errno));
 		if (chroot(httpd->rootdir) == -1)
-			bozo_err(httpd, 1, "chroot(%s): %s", httpd->rootdir,
+			bozoerr(httpd, 1, "chroot(%s): %s", httpd->rootdir,
 				strerror(errno));
 	}
 
 	if (username != NULL)
 		if (setuid(uid) == -1)
-			bozo_err(httpd, 1, "setuid(%d): %s", uid,
+			bozoerr(httpd, 1, "setuid(%d): %s", uid,
 					strerror(errno));
 
 	/*

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.41 src/libexec/httpd/bozohttpd.h:1.42
--- src/libexec/httpd/bozohttpd.h:1.41	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/bozohttpd.h	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.41 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.42 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -218,14 +218,6 @@ void	debug__(bozohttpd_t *, int, const c
 #define	debug(x)
 #endif /* NO_DEBUG */
 
-void	bozo_warn(bozohttpd_t *, const char *, ...)
-		BOZO_PRINTFLIKE(2, 3);
-void	bozo_err(bozohttpd_t *, int, const char *, ...)
-		BOZO_PRINTFLIKE(3, 4)
-		BOZO_DEAD;
-void	bozo_asprintf(bozohttpd_t *, char **, const char *, ...)
-		BOZO_PRINTFLIKE(3, 4);
-
 int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
 
 int	bozo_check_special_files(bozo_httpreq_t *, const char *);
@@ -235,10 +227,17 @@ void	bozo_print_header(bozo_httpreq_t *,
 char	*bozo_escape_rfc3986(bozohttpd_t *httpd, const char *url, int absolute);
 char	*bozo_escape_html(bozohttpd_t *httpd, const char *url);
 
+/* these are similar to libc functions, no underscore here */
+void	bozowarn(bozohttpd_t *, const char *, ...)
+		BOZO_PRINTFLIKE(2, 3);
+void	bozoerr(bozohttpd_t *, int, const char *, ...)
+		BOZO_PRINTFLIKE(3, 4)
+		BOZO_DEAD;
+void	bozoasprintf(bozohttpd_t *, char **, const char *, ...)
+		BOZO_PRINTFLIKE(3, 4);
 char	*bozodgetln(bozohttpd_t *, int, ssize_t *, ssize_t (*)(bozohttpd_t *,
 		    int, void *, size_t));
 char	*bozostrnsep(char **, const char *, ssize_t *);
-
 void	*bozomalloc(bozohttpd_t *, size_t);
 void	*bozorealloc(bozohttpd_t *, void *, size_t);
 char	*bozostrdup(bozohttpd_t *, bozo_httpreq_t *, const char *);

Index: src/libexec/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.29 src/libexec/httpd/cgi-bozo.c:1.30
--- src/libexec/httpd/cgi-bozo.c:1.29	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/cgi-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgi-bozo.c,v 1.29 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: cgi-bozo.c,v 1.30 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -195,7 +195,7 @@ finish_cgi_output(bozohttpd_t *httpd, bo
 				rbytes -= wbytes;
 				bp += wbytes;
 			} else
-				bozo_err(httpd, 1,
+				bozoerr(httpd, 1,
 					"cgi output write failed: %s",
 					strerror(errno));
 		}		
@@ -262,7 +262,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 		return 0;
 
 #ifndef NO_USER_SUPPORT
-    if (request->hr_user && !httpd->enable_cgi_users)
+	if (request->hr_user && !httpd->enable_cgi_users)
 		return 0;
 #endif /* !NO_USER_SUPPORT */
 
@@ -434,7 +434,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	    path, argv[0], strornull(argv[1]), strornull(argv[2])));
 
 	if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sv) == -1)
-		bozo_err(httpd, 1, "child socketpair failed: %s",
+		bozoerr(httpd, 1, "child socketpair failed: %s",
 				strerror(errno));
 
 	/*
@@ -445,7 +445,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	 */
 	switch (fork()) {
 	case -1: /* eep, failure */
-		bozo_err(httpd, 1, "child fork failed: %s", strerror(errno));
+		bozoerr(httpd, 1, "child fork failed: %s", strerror(errno));
 		/*NOTREACHED*/
 	case 0:
 		close(sv[0]);
@@ -457,10 +457,10 @@ bozo_process_cgi(bozo_httpreq_t *request
 		bozo_daemon_closefds(httpd);
 
 		if (-1 == execve(path, argv, envp))
-			bozo_err(httpd, 1, "child exec failed: %s: %s",
+			bozoerr(httpd, 1, "child exec failed: %s: %s",
 			      path, strerror(errno));
 		/* NOT REACHED */
-		bozo_err(httpd, 1, "child execve returned?!");
+		bozoerr(httpd, 1, "child execve returned?!");
 	}
 
 	close(sv[1]);
@@ -469,7 +469,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	/* child: read from sv[0] (bozo_write()) write to stdout */
 	pid = fork();
 	if (pid == -1)
-		bozo_err(httpd, 1, "io child fork failed: %s", strerror(errno));
+		bozoerr(httpd, 1, "io child fork failed: %s", strerror(errno));
 	else if (pid == 0) {
 		/* child reader/writer */
 		close(STDIN_FILENO);
@@ -493,7 +493,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 				rbytes -= wbytes;
 				bp += wbytes;
 			} else
-				bozo_err(httpd, 1, "write failed: %s",
+				bozoerr(httpd, 1, "write failed: %s",
 					strerror(errno));
 		}		
 	}

Index: src/libexec/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.12 src/libexec/httpd/content-bozo.c:1.13
--- src/libexec/httpd/content-bozo.c:1.12	Sat May  2 11:35:48 2015
+++ src/libexec/httpd/content-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: content-bozo.c,v 1.12 2015/05/02 11:35:48 mrg Exp $	*/
+/*	$NetBSD: content-bozo.c,v 1.13 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -258,7 +258,7 @@ bozo_get_content_map(bozohttpd_t *httpd,
 		httpd->dynamic_content_map,
 		(httpd->dynamic_content_map_size + 1) * sizeof *map);
 	if (httpd->dynamic_content_map == NULL)
-		bozo_err(httpd, 1, "out of memory allocating content map");
+		bozoerr(httpd, 1, "out of memory allocating content map");
 	map = &httpd->dynamic_content_map[httpd->dynamic_content_map_size];
 	map->name = map->type = map->encoding = map->encoding11 =
 		map->cgihandler = NULL;
Index: src/libexec/httpd/main.c
diff -u src/libexec/httpd/main.c:1.12 src/libexec/httpd/main.c:1.13
--- src/libexec/httpd/main.c:1.12	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/main.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.12 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: main.c,v 1.13 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: main.c,v 1.6 2011/11/18 09:21:15 mrg Exp $	*/
 /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp 	*/
@@ -58,67 +58,67 @@
 BOZO_DEAD static void
 usage(bozohttpd_t *httpd, char *progname)
 {
-	bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]",
+	bozowarn(httpd, "usage: %s [options] slashdir [virtualhostname]",
 			progname);
-	bozo_warn(httpd, "options:");
+	bozowarn(httpd, "options:");
 #ifndef NO_DEBUG
-	bozo_warn(httpd, "   -d\t\t\tenable debug support");
+	bozowarn(httpd, "   -d\t\t\tenable debug support");
 #endif
-	bozo_warn(httpd, "   -s\t\t\talways log to stderr");
+	bozowarn(httpd, "   -s\t\t\talways log to stderr");
 #ifndef NO_DYNAMIC_CONTENT
-	bozo_warn(httpd, "   -M arg t c c11\tadd this mime extenstion");
+	bozowarn(httpd, "   -M arg t c c11\tadd this mime extenstion");
 #endif
 #ifndef NO_USER_SUPPORT
-	bozo_warn(httpd, "   -u\t\t\tenable ~user/public_html support");
-	bozo_warn(httpd, "   -p dir\t\tchange `public_html' directory name");
+	bozowarn(httpd, "   -u\t\t\tenable ~user/public_html support");
+	bozowarn(httpd, "   -p dir\t\tchange `public_html' directory name");
 #ifndef NO_CGIBIN_SUPPORT
-	bozo_warn(httpd, "   -E\t\t\tenable CGI support for user dirs");
+	bozowarn(httpd, "   -E\t\t\tenable CGI support for user dirs");
 #endif
 #endif
 #ifndef NO_CGIBIN_SUPPORT
 #ifndef NO_DYNAMIC_CONTENT
-	bozo_warn(httpd, "   -C arg prog\t\tadd this CGI handler");
+	bozowarn(httpd, "   -C arg prog\t\tadd this CGI handler");
 #endif
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -c cgibin\t\tenable cgi-bin support in this directory");
 #endif
 #ifndef NO_LUA_SUPPORT
-	bozo_warn(httpd, "   -L arg script\tadd this Lua script");
+	bozowarn(httpd, "   -L arg script\tadd this Lua script");
 #endif
-	bozo_warn(httpd, "   -I port\t\tbind or use on this port");
+	bozowarn(httpd, "   -I port\t\tbind or use on this port");
 #ifndef NO_DAEMON_MODE
-	bozo_warn(httpd, "   -b\t\t\tbackground and go into daemon mode");
-	bozo_warn(httpd, "   -f\t\t\tkeep daemon mode in the foreground");
-	bozo_warn(httpd,
+	bozowarn(httpd, "   -b\t\t\tbackground and go into daemon mode");
+	bozowarn(httpd, "   -f\t\t\tkeep daemon mode in the foreground");
+	bozowarn(httpd,
 		"   -i address\t\tbind on this address (daemon mode only)");
-	bozo_warn(httpd, "   -P pidfile\t\tpath to the pid file to create");
+	bozowarn(httpd, "   -P pidfile\t\tpath to the pid file to create");
 #endif
-	bozo_warn(httpd, "   -S version\t\tset server version string");
-	bozo_warn(httpd, "   -t dir\t\tchroot to `dir'");
-	bozo_warn(httpd, "   -U username\t\tchange user to `user'");
-	bozo_warn(httpd,
+	bozowarn(httpd, "   -S version\t\tset server version string");
+	bozowarn(httpd, "   -t dir\t\tchroot to `dir'");
+	bozowarn(httpd, "   -U username\t\tchange user to `user'");
+	bozowarn(httpd,
 		"   -e\t\t\tdon't clean the environment (-t and -U only)");
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -v virtualroot\tenable virtual host support "
 		"in this directory");
 #ifndef NO_DIRINDEX_SUPPORT
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -X\t\t\tenable automatic directory index support");
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -H\t\t\thide files starting with a period (.)"
 		" in index mode");
 #endif
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -x index\t\tchange default `index.html' file name");
 #ifndef NO_SSL_SUPPORT
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -z ciphers\t\tspecify SSL ciphers");
-	bozo_warn(httpd,
+	bozowarn(httpd,
 		"   -Z cert privkey\tspecify path to server certificate"
 			" and private key file\n"
 		"\t\t\tin pem format and enable bozohttpd in SSL mode");
 #endif /* NO_SSL_SUPPORT */
-	bozo_err(httpd, 1, "%s failed to start", progname);
+	bozoerr(httpd, 1, "%s failed to start", progname);
 }
 
 int
@@ -153,7 +153,7 @@ main(int argc, char **argv)
 
 		case 'L':
 #ifdef NO_LUA_SUPPORT
-			bozo_err(&httpd, 1,
+			bozoerr(&httpd, 1,
 				"Lua support is not enabled");
 			/* NOTREACHED */
 #else
@@ -166,7 +166,7 @@ main(int argc, char **argv)
 #endif /* NO_LUA_SUPPORT */
 		case 'M':
 #ifdef NO_DYNAMIC_CONTENT
-			bozo_err(&httpd, 1,
+			bozoerr(&httpd, 1,
 				"dynamic mime content support is not enabled");
 			/* NOTREACHED */
 #else
@@ -193,7 +193,7 @@ main(int argc, char **argv)
 			break;
 		case 'Z':
 #ifdef NO_SSL_SUPPORT
-			bozo_err(&httpd, 1, "ssl support is not enabled");
+			bozoerr(&httpd, 1, "ssl support is not enabled");
 			/* NOT REACHED */
 #else
 			/* make sure there's two arguments */
@@ -205,7 +205,7 @@ main(int argc, char **argv)
 
 		case 'z':
 #ifdef NO_SSL_SUPPORT
-			bozo_err(&httpd, 1, "ssl support is not enabled");
+			bozoerr(&httpd, 1, "ssl support is not enabled");
 			/* NOT REACHED */
 #else
 			bozo_ssl_set_ciphers(&httpd, optarg);
@@ -238,7 +238,7 @@ main(int argc, char **argv)
 		case 'f':
 		case 'i':
 		case 'P':
-			bozo_err(&httpd, 1, "Daemon mode is not enabled");
+			bozoerr(&httpd, 1, "Daemon mode is not enabled");
 			/* NOTREACHED */
 #else
 		case 'b':
@@ -273,7 +273,7 @@ main(int argc, char **argv)
 #ifdef NO_CGIBIN_SUPPORT
 		case 'c':
 		case 'C':
-			bozo_err(&httpd, 1, "CGI is not enabled");
+			bozoerr(&httpd, 1, "CGI is not enabled");
 			/* NOTREACHED */
 #else
 		case 'c':
@@ -282,7 +282,7 @@ main(int argc, char **argv)
 
 		case 'C':
 #  ifdef NO_DYNAMIC_CONTENT
-			bozo_err(&httpd, 1,
+			bozoerr(&httpd, 1,
 				"dynamic CGI handler support is not enabled");
 			/* NOTREACHED */
 #  else
@@ -299,7 +299,7 @@ main(int argc, char **argv)
 			httpd.debug++;
 #ifdef NO_DEBUG
 			if (httpd.debug == 1)
-				bozo_warn(&httpd, "Debugging is not enabled");
+				bozowarn(&httpd, "Debugging is not enabled");
 #endif /* NO_DEBUG */
 			break;
 
@@ -311,7 +311,7 @@ main(int argc, char **argv)
 		case 'p':
 		case 'u':
 		case 'E':
-			bozo_err(&httpd, 1, "User support is not enabled");
+			bozoerr(&httpd, 1, "User support is not enabled");
 			/* NOTREACHED */
 #else
 		case 'p':
@@ -328,7 +328,7 @@ main(int argc, char **argv)
 			break;
 #else
 		case 'E':
-			bozo_err(&httpd, 1, "CGI is not enabled");
+			bozoerr(&httpd, 1, "CGI is not enabled");
 			/* NOTREACHED */
 #endif /* NO_CGIBIN_SPPORT */
 #endif /* NO_USER_SUPPORT */
@@ -336,7 +336,7 @@ main(int argc, char **argv)
 #ifdef NO_DIRINDEX_SUPPORT
 		case 'H':
 		case 'X':
-			bozo_err(&httpd, 1,
+			bozoerr(&httpd, 1,
 				"directory indexing is not enabled");
 			/* NOTREACHED */
 #else

Index: src/libexec/httpd/daemon-bozo.c
diff -u src/libexec/httpd/daemon-bozo.c:1.16 src/libexec/httpd/daemon-bozo.c:1.17
--- src/libexec/httpd/daemon-bozo.c:1.16	Thu Jan  2 08:21:38 2014
+++ src/libexec/httpd/daemon-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: daemon-bozo.c,v 1.16 2014/01/02 08:21:38 mrg Exp $	*/
+/*	$NetBSD: daemon-bozo.c,v 1.17 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: daemon-bozo.c,v 1.24 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -105,10 +105,10 @@ create_pidfile(bozohttpd_t *httpd)
 		return;
 
 	if (atexit(remove_pidfile) == -1)
-		bozo_err(httpd, 1, "Failed to install pidfile handler");
+		bozoerr(httpd, 1, "Failed to install pidfile handler");
 
 	if ((file = fopen(httpd->pidfile, "w")) == NULL)
-		bozo_err(httpd, 1, "Failed to create pidfile '%s'",
+		bozoerr(httpd, 1, "Failed to create pidfile '%s'",
 		    httpd->pidfile);
 	(void)fprintf(file, "%d\n", getpid());
 	(void)fclose(file);
@@ -138,7 +138,7 @@ bozo_daemon_init(bozohttpd_t *httpd)
 	h.ai_flags = AI_PASSIVE;
 	e = getaddrinfo(httpd->bindaddress, portnum, &h, &r0);
 	if (e)
-		bozo_err(httpd, 1, "getaddrinfo([%s]:%s): %s",
+		bozoerr(httpd, 1, "getaddrinfo([%s]:%s): %s",
 		    httpd->bindaddress ? httpd->bindaddress : "*",
 		    portnum, gai_strerror(e));
 	for (r = r0; r != NULL; r = r->ai_next)
@@ -151,7 +151,7 @@ bozo_daemon_init(bozohttpd_t *httpd)
 			continue;
 		if (setsockopt(httpd->sock[i], SOL_SOCKET, SO_REUSEADDR, &on,
 		    sizeof(on)) == -1)
-			bozo_warn(httpd, "setsockopt SO_REUSEADDR: %s",
+			bozowarn(httpd, "setsockopt SO_REUSEADDR: %s",
 			    strerror(errno));
 		if (bind(httpd->sock[i], r->ai_addr, r->ai_addrlen) == -1)
 			continue;
@@ -163,7 +163,7 @@ bozo_daemon_init(bozohttpd_t *httpd)
 		i++;
 	}
 	if (i == 0)
-		bozo_err(httpd, 1, "could not find any addresses to bind");
+		bozoerr(httpd, 1, "could not find any addresses to bind");
 	httpd->nsock = i;
 	freeaddrinfo(r0);
 
@@ -172,7 +172,7 @@ bozo_daemon_init(bozohttpd_t *httpd)
 
 	create_pidfile(httpd);
 
-	bozo_warn(httpd, "started in daemon mode as `%s' port `%s' root `%s'",
+	bozowarn(httpd, "started in daemon mode as `%s' port `%s' root `%s'",
 	    httpd->virthostname, portnum, httpd->slashdir);
 
 	signal(SIGHUP, controlled_exit);
@@ -209,13 +209,13 @@ daemon_poll_err(bozohttpd_t *httpd, int 
 	if ((httpd->fds[idx].revents & (POLLNVAL|POLLERR|POLLHUP)) == 0)
 		return 0;
 
-	bozo_warn(httpd, "poll on fd %d pid %d revents %d: %s",
+	bozowarn(httpd, "poll on fd %d pid %d revents %d: %s",
 	    httpd->fds[idx].fd, getpid(), httpd->fds[idx].revents,
 	    strerror(errno));
-	bozo_warn(httpd, "nsock = %d", httpd->nsock);
+	bozowarn(httpd, "nsock = %d", httpd->nsock);
 	close(httpd->sock[idx]);
 	httpd->nsock--;
-	bozo_warn(httpd, "nsock now = %d", httpd->nsock);
+	bozowarn(httpd, "nsock now = %d", httpd->nsock);
 	/* no sockets left */
 	if (httpd->nsock == 0)
 		exit(0);
@@ -271,7 +271,7 @@ again:
 			/* fail on programmer errors */
 			if (errno == EFAULT ||
 			    errno == EINVAL)
-				bozo_err(httpd, 1, "poll: %s",
+				bozoerr(httpd, 1, "poll: %s",
 					strerror(errno));
 
 			/* sleep on some temporary kernel failures */
@@ -294,7 +294,7 @@ again:
 			if (fd == -1) {
 				if (errno == EFAULT ||
 				    errno == EINVAL)
-					bozo_err(httpd, 1, "accept: %s",
+					bozoerr(httpd, 1, "accept: %s",
 						strerror(errno));
 
 				if (errno == ENOMEM ||
@@ -317,7 +317,7 @@ again:
 
 			switch (fork()) {
 			case -1: /* eep, failure */
-				bozo_warn(httpd, "fork() failed, sleeping for "
+				bozowarn(httpd, "fork() failed, sleeping for "
 					"10 seconds: %s", strerror(errno));
 				close(fd);
 				sleep(10);

Index: src/libexec/httpd/dir-index-bozo.c
diff -u src/libexec/httpd/dir-index-bozo.c:1.23 src/libexec/httpd/dir-index-bozo.c:1.24
--- src/libexec/httpd/dir-index-bozo.c:1.23	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/dir-index-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir-index-bozo.c,v 1.23 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: dir-index-bozo.c,v 1.24 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: dir-index-bozo.c,v 1.20 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -112,7 +112,7 @@ bozo_dir_index(bozo_httpreq_t *request, 
 	if (request->hr_user) {
 		if (asprintf(&printname, "~%s/%s", request->hr_user,
 		  request->hr_file) < 0)
-			bozo_err(httpd, 1, "asprintf");
+			bozoerr(httpd, 1, "asprintf");
 	} else
 		printname = bozostrdup(httpd, request, request->hr_file);
 #else

Index: src/libexec/httpd/lua-bozo.c
diff -u src/libexec/httpd/lua-bozo.c:1.13 src/libexec/httpd/lua-bozo.c:1.14
--- src/libexec/httpd/lua-bozo.c:1.13	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/lua-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua-bozo.c,v 1.13 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: lua-bozo.c,v 1.14 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*
  * Copyright (c) 2013 Marc Balmer <m...@msys.ch>
@@ -191,12 +191,12 @@ bozo_add_lua_map(bozohttpd_t *httpd, con
 		char cwd[MAXPATHLEN], *path;
 
 		getcwd(cwd, sizeof(cwd) - 1);
-		asprintf(&path, "%s/%s", cwd, script);
+		bozoasprintf(httpd, &path, "%s/%s", cwd, script);
 		map->script = path;
 	}
 	map->L = luaL_newstate();
 	if (map->L == NULL)
-		bozo_err(httpd, 1, "can't create Lua state");
+		bozoerr(httpd, 1, "can't create Lua state");
 	SIMPLEQ_INIT(&map->handlers);
 
 #if LUA_VERSION_NUM >= 502
@@ -225,10 +225,10 @@ bozo_add_lua_map(bozohttpd_t *httpd, con
 	lua_settable(map->L, LUA_REGISTRYINDEX);
 
 	if (luaL_loadfile(map->L, script))
-		bozo_err(httpd, 1, "failed to load script %s: %s", script,
+		bozoerr(httpd, 1, "failed to load script %s: %s", script,
 		    lua_tostring(map->L, -1));
 	if (lua_pcall(map->L, 0, 0, 0))
-		bozo_err(httpd, 1, "failed to execute script %s: %s", script,
+		bozoerr(httpd, 1, "failed to execute script %s: %s", script,
 		    lua_tostring(map->L, -1));
 	SIMPLEQ_INSERT_TAIL(&httpd->lua_states, map, s_next);
 }
Index: src/libexec/httpd/tilde-luzah-bozo.c
diff -u src/libexec/httpd/tilde-luzah-bozo.c:1.13 src/libexec/httpd/tilde-luzah-bozo.c:1.14
--- src/libexec/httpd/tilde-luzah-bozo.c:1.13	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/tilde-luzah-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tilde-luzah-bozo.c,v 1.13 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: tilde-luzah-bozo.c,v 1.14 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: tilde-luzah-bozo.c,v 1.16 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -99,14 +99,14 @@ bozo_user_transform(bozo_httpreq_t *requ
 	      pw->pw_uid, pw->pw_gid));
 
 	if (chdir(pw->pw_dir) < 0) {
-		bozo_warn(httpd, "chdir1 error: %s: %s", pw->pw_dir,
+		bozowarn(httpd, "chdir1 error: %s: %s", pw->pw_dir,
 			strerror(errno));
 		(void)bozo_http_error(httpd, 404, request,
 			"can't chdir to homedir");
 		return 0;
 	}
 	if (chdir(httpd->public_html) < 0) {
-		bozo_warn(httpd, "chdir2 error: %s: %s", httpd->public_html,
+		bozowarn(httpd, "chdir2 error: %s: %s", httpd->public_html,
 			strerror(errno));
 		(void)bozo_http_error(httpd, 404, request,
 			"can't chdir to public_html");

Index: src/libexec/httpd/ssl-bozo.c
diff -u src/libexec/httpd/ssl-bozo.c:1.21 src/libexec/httpd/ssl-bozo.c:1.22
--- src/libexec/httpd/ssl-bozo.c:1.21	Sun Dec 27 10:21:35 2015
+++ src/libexec/httpd/ssl-bozo.c	Mon Dec 28 07:37:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssl-bozo.c,v 1.21 2015/12/27 10:21:35 mrg Exp $	*/
+/*	$NetBSD: ssl-bozo.c,v 1.22 2015/12/28 07:37:59 mrg Exp $	*/
 
 /*	$eterna: ssl-bozo.c,v 1.15 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -103,7 +103,7 @@ bozo_clear_ssl_queue(bozohttpd_t *httpd)
 }
 
 /*
- * bozo_ssl_warn works just like bozo_warn, plus the SSL error queue
+ * bozo_ssl_warn works just like bozowarn, plus the SSL error queue
  */
 BOZO_PRINTFLIKE(2, 3) static void
 bozo_ssl_warn(bozohttpd_t *httpd, const char *fmt, ...)
@@ -123,7 +123,7 @@ bozo_ssl_warn(bozohttpd_t *httpd, const 
 
 
 /*
- * bozo_ssl_err works just like bozo_err, plus the SSL error queue
+ * bozo_ssl_err works just like bozoerr, plus the SSL error queue
  */
 BOZO_PRINTFLIKE(3, 4) BOZO_DEAD static void
 bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...)
@@ -264,7 +264,7 @@ bozo_ssl_accept(bozohttpd_t *httpd)
 
 	sslinfo->bozossl = SSL_new(sslinfo->ssl_context);
 	if (sslinfo->bozossl == NULL)
-		bozo_err(httpd, 1, "SSL_new failed");
+		bozoerr(httpd, 1, "SSL_new failed");
 
 	SSL_set_rfd(sslinfo->bozossl, 0);
 	SSL_set_wfd(sslinfo->bozossl, 1);
@@ -292,7 +292,7 @@ bozo_get_sslinfo(bozohttpd_t *httpd)
 		return httpd->sslinfo;
 	sslinfo = bozomalloc(httpd, sizeof(*sslinfo));
 	if (sslinfo == NULL)
-		bozo_err(httpd, 1, "sslinfo allocation failed");
+		bozoerr(httpd, 1, "sslinfo allocation failed");
 	memset(sslinfo, 0, sizeof(*sslinfo));
 	return httpd->sslinfo = sslinfo;
 }

Reply via email to