DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦9c34794de⟧ TextFile

    Length: 4292 (0x10c4)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Socket_System_Interface;
with Unchecked_Conversion;
with Unix_Base_Types;
with System;

with String_Utilities;

with Text_Io;
use Text_Io;

-- use Socket_System_Interface;
-- use Unix_Base_Types;
package body Transport_Name is

    Prototype_Error : exception;


    package Ssi renames Socket_System_Interface;
    package Ubt renames Unix_Base_Types;

    function Address_To_Char_Ptr is
       new Unchecked_Conversion
              (Source => System.Address, Target => Ubt.Char_Ptr);

    function Char_Ptr_To_Address is
       new Unchecked_Conversion (Source => Ubt.Char_Ptr,
                                 Target => System.Address);


    function Host_To_Host_Id (Host_Name : String)
                             return Transport_Defs.Host_Id is

        Uhn : constant String := String_Utilities.Upper_Case (Host_Name);
    begin
        if Uhn = "BELLADONE" then
            --Put_Line ("host_to_host_id: belladone");
            return (192, 5, 60, 40);
        elsif Uhn = "ANCOLIE" then
            --Put_Line ("host_to_host_id: ancolie");
            return (192, 5, 60, 20);
        elsif Uhn = "ACONIT" then
            --Put_Line ("host_to_host_id: aconit");
            return (192, 5, 60, 21);
        else
            Put_Line ("host_to_host_id: *" & Host_Name & "*");
            raise Prototype_Error;
        end if;

    end Host_To_Host_Id;




    -- function Host_To_Host_Id (Host_Name : String)
    --                          return Transport_Defs.Host_Id is
    --
    --     Host_Name_C : constant String := Host_Name & Ascii.Nul;
    --
    --     Host_Name_Ptr : Ubt.Char_Ptr :=
    --        Address_To_Char_Ptr (Host_Name_C'Address);
    --
    --     H_Ptr : Ssi.Hostent_Ptr;
    --
    -- begin
    --     New_Line;
    --     Put_Line ("host_name => " & Host_Name);
    --
    --     H_Ptr := Ssi.Gethostbyname (Host => Host_Name_Ptr);
    --
    --     declare
    --         Host : String (1 .. 80);
    --         for Host use at Char_Ptr_To_Address (H_Ptr.H_Name);
    --         Terminator : Integer := Host'First;
    --     begin
    --         for I in Host'Range loop
    --             exit when Host (I) = Ascii.Nul;
    --             Terminator := Terminator + 1;
    --         end loop;
    --
    --         Put_Line ("h_name => " & Host);
    --     end;
    --
    --     if H_Ptr.H_Addr_List = null then
    --         Put_Line ("H_Ptr.H_Addr_List is null");
    --     else
    --         Put_Line ("H_Ptr.H_Addr_List is not null");
    --     end if;
    --
    --     Put_Line ("H_Ptr.H_Addr_List.all'length => " &
    --               Integer'Image (H_Ptr.H_Addr_List.all'Length));
    --
    --     declare
    --         Tab : Unix_Base_Types.Char_Ptrs (1 .. 1) := H_Ptr.H_Addr_List.all;
    --     begin
    --         Put_Line ("tab'length => " & Integer'Image (Tab'Length));
    --
    --         if Tab (Tab'First) = null then
    --             Put_Line ("first of tab is null");
    --         else
    --             Put_Line ("first of tab is not null");
    --
    --         end if;
    --
    --         declare
    --             C1 : Character := Tab (0).all;
    --         begin
    --             Put_Line ("c1 => " & C1);
    --         end;
    --     end;
    --
    --
    --
    --
    --     return Transport_Defs.Null_Host_Id;
    -- end Host_To_Host_Id;
    --
    --
    --

    function Local_Host_Name
                (Network : Transport_Defs.Network_Name) return String is

        function Get_Host_Name
                    (Host : in Unix_Base_Types.Char_Ptr; Length : Integer)
                    return Integer;

        pragma Interface (C, Get_Host_Name);
        pragma Interface_Information (Get_Host_Name, ".gethostname");

        Host : String (1 .. 80);
        Terminator : Integer := Host'First;
    begin

        if Get_Host_Name (Address_To_Char_Ptr (Host'Address), Host'Length) /=
           0 then
            Put_Line
               ("local_host_name: unknown host, will return empty string ");

            return "";
        end if;

        for I in Host'Range loop
            exit when Host (I) = Ascii.Nul;
            Terminator := Terminator + 1;
        end loop;

        return Host (Host'First .. Terminator - 1);

    end Local_Host_Name;


end Transport_Name;