Distributed Name Service (DNS) Management Programming Manual

DNS Programming Example, TAL
G–10 46958 Tandem Computers Incorporated
IF NOT error THEN
IF (status := ssputtkn(req^buf, zspi^tkn^maxresp, maxresp)) THEN
result := dns^spierr(status);
WHILE NOT (done OR error) DO
BEGIN
!
! Send the request to the name manager.
!
result := dns^send(fno, req^buf, resp^buf, more);
!
! Look for (next) data list.
!
WHILE NOT (error OR
(status := ssgettkn(resp^buf, zspi^tkn^datalist)))
DO
BEGIN
!
! We found one; get RETCODE.
!
IF (status := ssgettkn(resp^buf, zspi^tkn^retcode, retcode))
THEN result := dns^spierr(status);
IF retcode = zdns^err^nomore THEN
!
! No more responses; we're finished.
!
done := true
ELSE
IF retcode THEN
result := dns^dnserr(retcode);
IF NOT (error OR done) THEN
IF have^response THEN
BEGIN
!
! We already have a response; set AMBIGUOUS flag and
! signal that we're finished.
!
done := true;
ambiguous := true;
END
ELSE
BEGIN
!
! Retrieve response tokens.
!