Added replacement for ether_ntoa() on hosts that don't have it.

This commit is contained in:
Eric J Korpela 2013-12-03 11:10:10 -08:00
parent 8f7e94ec5d
commit 8537d45bdf
1 changed files with 23 additions and 4 deletions

View File

@ -17,10 +17,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// 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 <vector>
#include <cstring>
#include <cerrno>
@ -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<char *> envstrings;
// In theory setenv() is posix, but some implementations of unix