summaryrefslogtreecommitdiffstats
path: root/usr.sbin/relayd/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/relayd/log.c')
-rw-r--r--usr.sbin/relayd/log.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/relayd/log.c b/usr.sbin/relayd/log.c
index 4fc3f35fb8c..0da3432ca88 100644
--- a/usr.sbin/relayd/log.c
+++ b/usr.sbin/relayd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 2007/02/07 15:17:46 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.4 2007/02/22 03:32:39 reyk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -20,6 +20,7 @@
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
+#include <sys/tree.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
@@ -199,3 +200,15 @@ table_check(enum table_check check)
/* NOTREACHED */
return ("invalid");
}
+
+const char *
+print_availability(u_long cnt, u_long up)
+{
+ static char buf[BUFSIZ];
+
+ if (cnt == 0)
+ return ("");
+ bzero(buf, sizeof(buf));
+ snprintf(buf, sizeof(buf), "%.2f%%", (double)up / cnt * 100);
+ return (buf);
+}