Sat Aug 27 15:33:59 2011 UTC ()
Don't check for __attribute__ being defined, it won't. Check for GCC 3.x
or compatible and define BOZO_PRINTFLIKE / BOZO_DEAD. Fix fallout.
(joerg)
diff -r1.27 -r1.28 src/libexec/httpd/bozohttpd.c
diff -r1.18 -r1.19 src/libexec/httpd/bozohttpd.h
diff -r1.13 -r1.14 src/libexec/httpd/daemon-bozo.c
diff -r1.2 -r1.3 src/libexec/httpd/main.c
diff -r1.11 -r1.12 src/libexec/httpd/ssl-bozo.c
--- src/libexec/httpd/bozohttpd.c 2011/03/29 07:22:31 1.27
+++ src/libexec/httpd/bozohttpd.c 2011/08/27 15:33:59 1.28
@@ -1,4 +1,4 @@
-/* $NetBSD: bozohttpd.c,v 1.27 2011/03/29 07:22:31 jmmv Exp $ */
+/* $NetBSD: bozohttpd.c,v 1.28 2011/08/27 15:33:59 joerg Exp $ */
/* $eterna: bozohttpd.c,v 1.176 2010/09/20 22:26:28 mrg Exp $ */
@@ -154,10 +154,6 @@
#include <time.h>
#include <unistd.h>
-#ifndef __attribute__
-#define __attribute__(x)
-#endif /* __attribute__ */
-
#include "bozohttpd.h"
#ifndef MAX_WAIT_TIME
@@ -1412,9 +1408,10 @@
request->hr_first_byte_pos = 0;
request->hr_last_byte_pos = sb.st_size - 1;
}
- debug((httpd, DEBUG_FAT, "have_range %d first_pos %qd last_pos %qd",
+ debug((httpd, DEBUG_FAT, "have_range %d first_pos %lld last_pos %lld",
request->hr_have_range,
- request->hr_first_byte_pos, request->hr_last_byte_pos));
+ (long long)request->hr_first_byte_pos,
+ (long long)request->hr_last_byte_pos));
if (request->hr_have_range)
bozo_printf(httpd, "%s 206 Partial Content\r\n",
request->hr_proto);
@@ -1848,7 +1845,7 @@
}
httpd->getln_buffer[len] = '\0';
- debug((httpd, DEBUG_OBESE, "bozodgetln returns: ``%s'' with len %d",
+ debug((httpd, DEBUG_OBESE, "bozodgetln returns: ``%s'' with len %zd",
httpd->getln_buffer, len));
*lenp = len;
return httpd->getln_buffer;
--- src/libexec/httpd/bozohttpd.h 2011/03/29 07:22:31 1.18
+++ src/libexec/httpd/bozohttpd.h 2011/08/27 15:33:59 1.19
@@ -1,4 +1,4 @@
-/* $NetBSD: bozohttpd.h,v 1.18 2011/03/29 07:22:31 jmmv Exp $ */
+/* $NetBSD: bozohttpd.h,v 1.19 2011/08/27 15:33:59 joerg Exp $ */
/* $eterna: bozohttpd.h,v 1.37 2010/09/20 22:26:28 mrg Exp $ */
@@ -172,11 +172,16 @@
#define debug(x)
#endif /* NO_DEBUG */
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y)))
+#define BOZO_DEAD __attribute__((__noreturn__))
+#endif
+
void bozo_warn(bozohttpd_t *, const char *, ...)
- __attribute__((__format__(__printf__, 2, 3)));
+ BOZO_PRINTFLIKE(2, 3);
void bozo_err(bozohttpd_t *, int, const char *, ...)
- __attribute__((__format__(__printf__, 3, 4)))
- __attribute__((__noreturn__));
+ BOZO_PRINTFLIKE(3, 4)
+ BOZO_DEAD;
int bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
int bozo_check_special_files(bozo_httpreq_t *, const char *);
--- src/libexec/httpd/daemon-bozo.c 2011/03/29 07:22:31 1.13
+++ src/libexec/httpd/daemon-bozo.c 2011/08/27 15:33:59 1.14
@@ -1,4 +1,4 @@
-/* $NetBSD: daemon-bozo.c,v 1.13 2011/03/29 07:22:31 jmmv Exp $ */
+/* $NetBSD: daemon-bozo.c,v 1.14 2011/08/27 15:33:59 joerg Exp $ */
/* $eterna: daemon-bozo.c,v 1.22 2010/06/21 06:45:45 mrg Exp $ */
@@ -77,7 +77,7 @@
/* Signal handler to exit in a controlled manner. This ensures that
* any atexit(3) handlers are properly executed. */
/* ARGSUSED */
-static void
+BOZO_DEAD static void
controlled_exit(int signo)
{
--- src/libexec/httpd/main.c 2011/03/29 07:22:31 1.2
+++ src/libexec/httpd/main.c 2011/08/27 15:33:59 1.3
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.2 2011/03/29 07:22:31 jmmv Exp $ */
+/* $NetBSD: main.c,v 1.3 2011/08/27 15:33:59 joerg Exp $ */
/* $eterna: main.c,v 1.4 2010/07/11 00:34:28 mrg Exp $ */
/* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */
@@ -47,10 +47,6 @@
#include <time.h>
#include <unistd.h>
-#ifndef __attribute__
-#define __attribute__(x)
-#endif /* __attribute__ */
-
#include "bozohttpd.h"
/* variables and functions */
@@ -59,7 +55,7 @@
#endif
/* print a usage message, and then exit */
-static void
+BOZO_DEAD static void
usage(bozohttpd_t *httpd, char *progname)
{
bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]",
--- src/libexec/httpd/ssl-bozo.c 2011/08/21 10:45:33 1.11
+++ src/libexec/httpd/ssl-bozo.c 2011/08/27 15:33:59 1.12
@@ -1,4 +1,4 @@
-/* $NetBSD: ssl-bozo.c,v 1.11 2011/08/21 10:45:33 hannken Exp $ */
+/* $NetBSD: ssl-bozo.c,v 1.12 2011/08/27 15:33:59 joerg Exp $ */
/* $eterna: ssl-bozo.c,v 1.13 2010/05/12 12:24:58 rtr Exp $ */
@@ -64,7 +64,7 @@
* the error provided by the caller at the point of error it pops and
* prints all errors from the SSL error queue.
*/
-static void
+BOZO_DEAD static void
bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...)
{
va_list ap;