Trailing-Edge
-
PDP-10 Archives
-
SRI_NIC_PERM_SRC_3_19910112
-
mm/hsttst.mac
There are 2 other files named hsttst.mac in the archive. Click here to see a list.
TITLE HSTTST -- test HSTNAM module
SUBTTL Mark Crispin 20-Apr-83
SEARCH MACSYM,MONSYM ; system definitions
SALL ; suppress macro expansions
.DIRECTIVE FLBLST ; sane listings for ASCIZ, etc.
.TEXT "/NOINITIAL" ; suppress loading of JOBDAT
.TEXT "HSTTST/SAVE" ; save as HSTTST.EXE
.TEXT "/SYMSEG:PSECT:CODE" ; put symbol table and patch w/ code
.REQUIRE HSTNAM ; host name routines
.REQUIRE SYS:MACREL ; macsym support routines
EXTERN $GTPRO,$GTNAM,$GTLCL ; routines invoked externally
; AC definitions
A=1 ; temporary, JSYS AC's
B=2
C=3
D=4
P=17 ; stack pointer
HSTNML==^D64 ; maximum number of characters in host name
HSTBFL==<HSTNML/5>+1 ; length of host buffer
PDLLEN==^D200 ; stack length
.PSECT DATA,1000 ; enter data area
CURREG: BLOCK 1 ; current registry start
HSTBUF: BLOCK HSTBFL ; host name buffers
HS2BUF: BLOCK HSTBFL
PDL: BLOCK PDLLEN ; stack
.ENDPS
.PSECT CODE,40000 ; enter code area
HSTTST: RESET% ; flush all I/O
MOVE P,[IOWD PDLLEN,PDL] ; load stack pointer
HRROI A,HSTBUF ; get local host name
CALL $GTLCL
IFNSK.
TMSG <?Unable to get local host name>
HALTF%
JRST HSTTST
ENDIF.
TMSG <Primary local name registry: >
HRROI A,HSTBUF ; output local name
PSOUT%
TMSG <
>
DO.
TMSG <Host name: > ; prompt for another host name
HRROI A,HSTBUF ; get another name
MOVX B,RD%BEL!RD%CRF!HSTNML ; break on end of line
HRROI C,[ASCIZ/Host name: /] ; prompt text
RDTTY% ; read the name
IFJER.
TMSG <?RDTTY% error>
HALTF%
JRST .-1
ENDIF.
SETZ B, ; tie off string with null
DPB B,A
SETOB C,CURREG ; initially try all registries
DO.
HRROI A,HSTBUF ; now, get its host address and registry
CALL $GTPRO
IFSKP.
SKIPL CURREG ; first time?
IFSKP.
TMSG <(Primary) >
ENDIF.
MOVEM C,CURREG ; save registry pointer
HRROI A,HS2BUF ; now get primary name
CALL $GTNAM
IFNSK.
TMSG <?Impossible $GTNAM failure>
HALTF%
JRST .-1
ENDIF.
HLRO A,(C) ; protocol name
PSOUT%
TMSG < registry is >
HRROI A,HS2BUF ; output primary registry name
PSOUT%
TMSG <, address >
MOVEI A,.PRIOU ; output address
MOVX C,NO%MAG!^D8 ; as an unsigned octal number
NOUT%
NOP
TMSG < (octal)
>
ELSE.
SKIPL CURREG ; any successful lookups?
IFSKP.
TMSG <?No such host registered
> ; no, complain
ENDIF.
ENDIF.
AOS C,CURREG ; start at next registry
SKIPE (C) ; end of list?
LOOP. ; no, try further
ENDDO.
LOOP.
ENDDO.
END HSTTST