1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-04 23:44:42 +00:00

Cleanup USE_DPLI usage (#378)

Until now, the only differentiation between using DLPI and using NIT for
the ethernet interface was expressed as a function of USE_DLPI.

This commit makes explicit when code is for the DLPI interface or the NIT
interface, with USE_DLPI and USE_NIT.  This is setup for using the BPF
interface to the ethernet as an alternative.
This commit is contained in:
Nick Briggs
2021-04-07 20:51:28 -07:00
committed by GitHub
parent 5ce292ed32
commit a5410ef93d
6 changed files with 40 additions and 45 deletions

View File

@@ -19,9 +19,9 @@
#include <unistd.h>
#include <limits.h>
#ifdef MAIKO_ENABLE_ETHERNET
#ifndef USE_DLPI
#if defined(USE_NIT)
#include <net/nit.h> /* needed for Ethernet stuff below */
#endif /* USE_DLPI */
#endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -92,9 +92,9 @@ extern int sysout_size, for_makeinit, please_fork;
#ifdef MAIKO_ENABLE_ETHERNET
extern int ether_fd;
extern u_char ether_host[6];
#ifndef USE_DLPI
#if defined(USE_NIT)
extern struct sockaddr_nit snit;
#endif /* USE_DLPI */
#endif /* USE_NIT */
#endif /* MAIKO_ENABLE_ETHERNET */
/************************************************************************/
@@ -297,12 +297,12 @@ void read_Xoption(int *argc, char *argv[])
if (XrmGetResource(rDB, "ldex.EtherNet", "Ldex.EtherNet", str_type, &value) == True) {
int b0, b1, b2, b3, b4, b5;
(void)strncpy(tmp, value.addr, (int)value.size);
#ifdef USE_DLPI
#if defined(USE_DLPI)
if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5) == 7)
#else
#elif defined(USE_NIT)
if (sscanf(tmp, "%d:%x:%x:%x:%x:%x:%x:%s", &ether_fd, &b0, &b1, &b2, &b3, &b4, &b5,
snit.snit_ifname) == 8)
#endif /* USE_DLPI */
#endif /* USE_NIT */
{
ether_host[0] = b0;
ether_host[1] = b1;