(DEFINE-FILE-INFO PACKAGE "IL" READTABLE "INTERLISP") (FILECREATED "12-Jun-90 17:31:06" {DSK}local>lde>lispcore>library>TCPHTE.;3 5753 changes to%: (VARS TCPHTECOMS) previous date%: "11-Feb-89 11:06:54" {DSK}local>lde>lispcore>library>TCPHTE.;2) (* ; " Copyright (c) 1985, 1987, 1988, 1989, 1990 by Venue & Xerox Corporation. All rights reserved. ") (PRETTYCOMPRINT TCPHTECOMS) (RPAQQ TCPHTECOMS ((PROP MAKEFILE-ENVIRONMENT TCPHTE) (RECORDS HOSTS.TXT.ENTRY) (FNS \HTE.PARSE.ENTRY \HTE.READ.FILE \HTE.READ; \HTE.READLINE) (INITVARS (HOSTS.TEXT.DIRECTORIES) (\HTE.RDTBL)) (DECLARE%: EVAL@COMPILE DONTCOPY (GLOBALVARS \HTE.RDTBL \IP.HOSTNAMES) (RECORDS HTELINE)))) (PUTPROPS TCPHTE MAKEFILE-ENVIRONMENT (:PACKAGE "IL" :READTABLE "INTERLISP")) (DECLARE%: EVAL@COMPILE (DATATYPE HOSTS.TXT.ENTRY (HTE.TYPE HTE.ADDRESSES HTE.NAMES HTE.MACHINE.TYPE HTE.OS.TYPE HTE.PROTOCOLS)) ) (/DECLAREDATATYPE 'HOSTS.TXT.ENTRY '(POINTER POINTER POINTER POINTER POINTER POINTER) '((HOSTS.TXT.ENTRY 0 POINTER) (HOSTS.TXT.ENTRY 2 POINTER) (HOSTS.TXT.ENTRY 4 POINTER) (HOSTS.TXT.ENTRY 6 POINTER) (HOSTS.TXT.ENTRY 8 POINTER) (HOSTS.TXT.ENTRY 10 POINTER)) '12) (DEFINEQ (\HTE.PARSE.ENTRY [LAMBDA (ENTRY) (* ; "Edited 11-Feb-89 11:04 by akw:") (DECLARE (GLOBALVARS NETWORKOSTYPES)) (LET* [[NAMES (for NAME in (fetch (HTELINE NAMES) of ENTRY) collect (MKATOM (U-CASE NAME] (OSTYPE (CAR (fetch (HTELINE OS.TYPE) of ENTRY)) (MKATOM (U-CASE))) (HTE.ENTRY (create HOSTS.TXT.ENTRY HTE.TYPE _ (CAR (fetch (HTELINE TYPE) of ENTRY)) HTE.ADDRESSES _ (for X in (fetch (HTELINE ADDRESSES) of ENTRY) collect (\IP.READ.STRING.ADDRESS X)) HTE.NAMES _ NAMES HTE.MACHINE.TYPE _ [MKATOM (U-CASE (CAR (fetch (HTELINE MACHINE.TYPE ) of ENTRY] HTE.OS.TYPE _ [AND OSTYPE (SETQ OSTYPE (MKATOM (U-CASE OSTYPE] HTE.PROTOCOLS _ (for PROTOENTRY in (fetch (HTELINE PROTOCOLS ) of ENTRY) bind SLASH when (SETQ SLASH (STRPOS '/ PROTOENTRY)) collect (CONS (SUBATOM PROTOENTRY 1 (SUB1 SLASH)) (SUBATOM PROTOENTRY (ADD1 SLASH] (for NAME in NAMES do (PUTHASH NAME HTE.ENTRY \IP.HOSTNAMES]) (\HTE.READ.FILE (LAMBDA (FILE WANTEDTYPES) (* ; "Edited 24-May-88 16:57 by bvm") (DECLARE (GLOBALVARS \IP.HOSTNAMES \TCP.LAST.HOSTS.FILE.DATE \TCP.LAST.HOSTS.FILE.READ)) (OR WANTEDTYPES (SETQ WANTEDTYPES (QUOTE (HOST)))) (CL:WITH-OPEN-FILE (STREAM FILE) (LET ((FILENAME (FULLNAME STREAM)) (DATE (GETFILEINFO STREAM (QUOTE ICREATIONDATE))) ENTRY) (PRINTOUT PROMPTWINDOW T "Reading " FILENAME " of " (GDATE DATE (DATEFORMAT NO.SECONDS))) (CLRHASH \IP.HOSTNAMES) (until (EOFP STREAM) when (AND (SETQ ENTRY (\HTE.READLINE STREAM WANTEDTYPES)) (FMEMB (CAR (fetch (HTELINE TYPE) of ENTRY)) WANTEDTYPES)) do (\HTE.PARSE.ENTRY ENTRY)) (SETQ \TCP.LAST.HOSTS.FILE.DATE DATE) (SETQ \TCP.LAST.HOSTS.FILE.READ FILENAME)))) ) (\HTE.READ; (LAMBDA (FL RDTBL) (* ; "Edited 24-May-88 14:45 by bvm") (until (SELCHARQ (READCCODE FL) ((CR LF EOL) T) NIL)) NIL) ) (\HTE.READLINE (LAMBDA (STREAM WANTEDTYPES) (* ; "Edited 24-May-88 16:57 by bvm") (while (EQ (PEEKCCODE STREAM T) (CHARCODE ";")) do (\HTE.READ; STREAM)) (AND (NOT (EOFP STREAM)) (for FIELD# from 1 bind FIELDCONTENTS DONE (RDTBL _ (COND (\HTE.RDTBL) (T (SETQ \HTE.RDTBL (COPYREADTABLE (QUOTE ORIG))) (SETSEPR (CHARCODE (SPACE TAB %,)) NIL \HTE.RDTBL) (SETBRK (CHARCODE (":" ";" CR LF)) NIL \HTE.RDTBL) (READTABLEPROP \HTE.RDTBL (QUOTE CASEINSENSITIVE) T) \HTE.RDTBL))) until DONE collect (SETQ FIELDCONTENTS (until (SELCHARQ (SKIPSEPRCODES STREAM RDTBL) (":" (* ; "End of field") (READCCODE STREAM) T) (";" (* ; "end of line") (\HTE.READ; STREAM) (SETQ DONE T)) ((CR LF) (* ; "end of line--consume the terminator") (READCCODE STREAM) (SETQ DONE T)) (NIL (* ; "Eof") (SETQ DONE T)) NIL) collect (* ; "Read up to the next field delimiter") (if (EQ FIELD# 1) then (* ; "Canonicalize the type field") (READ STREAM RDTBL) else (RSTRING STREAM RDTBL)))) (if (AND (EQ FIELD# 1) WANTEDTYPES (NOT (FMEMB (CAR FIELDCONTENTS) WANTEDTYPES))) then (* ; "Don't care about this line") (OR DONE (\HTE.READ; STREAM)) (RETURN NIL)) FIELDCONTENTS))) ) ) (RPAQ? HOSTS.TEXT.DIRECTORIES ) (RPAQ? \HTE.RDTBL ) (DECLARE%: EVAL@COMPILE DONTCOPY (DECLARE%: DOEVAL@COMPILE DONTCOPY (GLOBALVARS \HTE.RDTBL \IP.HOSTNAMES) ) (DECLARE%: EVAL@COMPILE (RECORD HTELINE (TYPE ADDRESSES NAMES MACHINE.TYPE OS.TYPE PROTOCOLS)) ) ) (PUTPROPS TCPHTE COPYRIGHT ("Venue & Xerox Corporation" 1985 1987 1988 1989 1990)) (DECLARE%: DONTCOPY (FILEMAP (NIL (1360 5370 (\HTE.PARSE.ENTRY 1370 . 3378) (\HTE.READ.FILE 3380 . 4095) (\HTE.READ; 4097 . 4230) (\HTE.READLINE 4232 . 5368))))) STOP