From 8537d45bdfd2b5dc7fdf097071a6fd04c82a2bcd Mon Sep 17 00:00:00 2001 From: Eric J Korpela Date: Tue, 3 Dec 2013 11:10:10 -0800 Subject: [PATCH] Added replacement for ether_ntoa() on hosts that don't have it. --- lib/unix_util.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/unix_util.cpp b/lib/unix_util.cpp index 8c628c9862..76f71f8c6f 100644 --- a/lib/unix_util.cpp +++ b/lib/unix_util.cpp @@ -17,10 +17,6 @@ // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see . -// Note. This already has an ifdef around it. If it is causing problem -// then HAVE_SETENV should be defined in your configuration files. -#ifndef HAVE_SETENV - #include #include #include @@ -29,6 +25,29 @@ #include "unix_util.h" +// Note. This already has an ifdef around it. If it is causing problem +// then HAVE_ETHER_NTOA should be defined in your configuration files. +#ifndef HAVE_ETHER_NTOA +extern "C" { +static char ether_ntoa_buffer[18]; + +char *ether_ntoa(const struct ether_addr *addr) { + int i; + for (i=0;i<5;i++) { + sprintf(ether_ntoa_buffer+i*3,"%0.2x:",addr->ether_addr_octet[i]); + } + sprintf(ether_ntoa_buffer+15,"%0.2x",addr->ether_addr_octet[i]); + return ether_ntoa_buffer; +} +} +#endif + +// Note. This already has an ifdef around it. If it is causing problem +// then HAVE_SETENV should be defined in your configuration files. +#ifndef HAVE_SETENV + + + static std::vector envstrings; // In theory setenv() is posix, but some implementations of unix