!************************************************************************
!* *
!* WHATIS: Read database entry for a particular APM *
!* *
!* Version 1.2 8 Dec 1987 *
!* *
!************************************************************************
!1.2: uses modified NS recordformat (inon and room merged, new bootfs field)
include "managr:nsdefs.inc"
include "inc:fs.imp"
include "inc:util.imp"
include "managr:ns.inc"
conststring (31) array peripheral(0:25) = c
{A} "0.5Mb memory board",
{B} "68010 processor board",
{C} "8MHz processor board",
{D} "10MHz processor board",
{E} "2MHz Ethernet board",
{F} "10MHz Ethernet board",
{G} "Level 1 graphics",
{H} "Level 1.5 graphics",
{I} "?MHz processor board",
{J} "level 2 graphics",
{K} "K???",
{L} "2.0Mb memory board",
{M} "Mouse controller",
{N} "N???",
{O} "O???",
{P} "Laser Printer controller",
{Q} "QSART board",
{R} "RTS interface board",
{S} "Special board",
{T} "T???",
{U} "U???",
{V} "V???",
{W} "W???",
{X} "MIT graphics monitor",
{Y} "Unknown monitor",
{Z} "Twin Floppy-Dicks"
begin
integer xno,dte,i,j,tag
record (ns lfm) data
string (255) param
bytearray sname(0:8)
integerfn hex(string (*) name s)
integer i,no,a
no=0
for i=1,1,length(s) cycle
a=charno(s,i); a=a-' ' if 'a'<=a<='z'; a=a-'0'
a=a-7 if a>9
exit unless 0<=a<=15
no=no<<4+a
repeat
result =no
end
xno=0
param=cliparam
if param="" start
dte = etherstation
else
! %if charno(param,1) = '@' %start
! xno=open ns db
! dte = get ns dte(param)
! %else
dte = hex(param)
! %finish
finish
printline("Funny value ".param) and stop if dte<=0 or dte>=128
xno = open ns db if xno=0
i = read ns db(xno, dte!long, addr(data))
printline("No information on ".param.",".itos(i,-1)) and stop if i<0
sname(0) = read ns db(xno, dte, addr(sname(1)))
sname(0) = sname(0)-1 while sname(0) > 0 and sname(sname(0)) <= ' '
close ns db(xno)
printstring("Station "); phex2(dte)
printstring(" (")
if sname(0)>0 start
for i=1,1,sname(0) cycle ; printsymbol(sname(i)); repeat
finish
printstring("): ")
tag = data_inonrm>>4
if tag = ns in start
printstring("In ")
elseif tag = ns on
printstring("On ")
elseif tag = ns at
printstring("At ")
finish
tag = data_inonrm&15
printstring("the ") if tag = ns the
for j=31,-1,1 cycle ; exit if data_lname(j) > ' '; repeat
for i=1,1,j cycle ; printsymbol(data_lname(i)); repeat
printstring("'s room") if tag = ns room
newline
printstring("Inet address "); write(data_inet,-1)
printstring(" Inet name ")
for i=1,1,7 cycle ; printsymbol(data_iname(i)); repeat
newline
printstring(" Case"); write(data_case,3); newline
printstring(" Location ")
for i=1,1,4 cycle ; printsymbol(data_add(i)); repeat ; newline
printline(" Recorded Peripherals:")
for i=1,1,18 cycle
if data_bpmap(i) # '.' and data_bpmap(i) # '*' then C
printline(" ".peripheral(data_bpmap(i)-'A'))
repeat
endofprogram