-- Copyright (C) 1983, 1985  by Xerox Corporation. All rights reserved. 
-- EthernetOneStarter.mesa, HGM,  5-Oct-85 19:32:11

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

EthernetOneStarter: PROGRAM
  IMPORTS Driver, EthernetOneFace, 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
    [] ← Driver.CreateDefaultEthernetOneDrivers[];
    END;

  MaybeGetEthernetHostNumber[];
  SetupEthernetOneDriver[];

  END..