[inherit('SYS$LIBRARY:STARLET','SYS$DISK:[]TCPIP$INETDEF')] Program DNS_TRANS (input, output); { Look up the IP address for a given host name } type IO_Status_Block = [quad] packed record sts : [word] 0..65535; count : [word] 0..65535; bufaddr : [unsafe] unsigned; end; Descriptor = [quad] packed record dsc$w_length : [word] 0..65535; dsc$b_dtype : [byte] 0..255; dsc$b_class : [byte] 0..255; dsc$a_pointer : [unsafe] pointer; end; var ret_status, n : integer; chan : [word] 0..65535; IOSB : IO_Status_Block; name : varying [1024] of char; dummy_len : [word] 0..65535; trans : [long] packed array [1..4] of 0..255; trans_descr : Descriptor value ZERO; io_subfunc_trans : unsigned value INETACP_FUNC$C_GETHOSTBYNAME + (INETACP$C_TRANS*256); subfunc_descr : Descriptor value ZERO; begin subfunc_descr.dsc$w_length := 4; subfunc_descr.dsc$b_dtype := DSC$K_DTYPE_T; subfunc_descr.dsc$b_class := DSC$K_CLASS_S; subfunc_descr.dsc$a_pointer := iaddress(io_subfunc_trans); trans_descr.dsc$w_length := 4; trans_descr.dsc$a_pointer := iaddress(trans); ret_status := $ASSIGN ('TCPIP$DEVICE:', chan); if not odd(ret_status) then $EXIT (ret_status); write ('Enter host name: '); while not eof do begin readln (name); trans := ZERO; ret_status := $QIOW (EFN$C_ENF ,chan ,IO$_ACPCONTROL ,IOSB , { astaddr } , { astparam } , %ref subfunc_descr , %stdescr name , %ref dummy_len , %ref trans_descr ); writeln('$QIOW status = ', ret_status:1); writeln('IOSB status = ', IOSB.sts:1); writeln(' IP Address : ', trans[1]:1, '.', trans[2]:1, '.', trans[3]:1, '.', trans[4]:1); write('Enter host name: '); end; end.