-- File: EthernetOneStarter.mesa - last edit:
-- AOF                  4-Feb-88 18:52:51
-- HGM                  5-Oct-85 19:32:11
-- Copyright (C) 1983, 1985, 1988 by Xerox Corporation. All rights reserved. 

DIRECTORY
  Environment USING [Byte],
  EthernetOneFace USING [
    DeviceHandle, GetEthernet1Address, GetNextDevice, nullDeviceHandle],
  NS3MBit USING [CreateDefaultEthernetOneDrivers],
  PupDefs USING [PupPackageMake, SmashMyHostNumber];

EthernetOneStarter: PROGRAM
  IMPORTS EthernetOneFace, NS3MBit, PupDefs =
  BEGIN

 MaybeGetEthernetHostNumber: PROCEDURE =
    BEGIN
    ether: EthernetOneFace.DeviceHandle;
    ether ← EthernetOneFace.GetNextDevice[EthernetOneFace.nullDeviceHandle];
    IF ether#EthernetOneFace.nullDeviceHandle THEN
      BEGIN
      net, host: Environment.Byte;
      [net, host] ← EthernetOneFace.GetEthernet1Address[ether];
      PupDefs.SmashMyHostNumber[host];
      END;
    END;

  SetupEthernetOneDriver: PROCEDURE =
    BEGIN
    ether: EthernetOneFace.DeviceHandle;
    ether ← EthernetOneFace.GetNextDevice[EthernetOneFace.nullDeviceHandle];
    IF ether = EthernetOneFace.nullDeviceHandle THEN RETURN; -- DLion: Beware of 981
    [] ← PupDefs.PupPackageMake[]; -- One for free
    [] ← NS3MBit.CreateDefaultEthernetOneDrivers[];
    END;

  MaybeGetEthernetHostNumber[];
  SetupEthernetOneDriver[];

  END..