{Routine write NEWS.SEEN files} {Richard M. Marshall 13-February-85} %external %string (255) Copyright %alias "NEWS_SEEN_(C)_RMM_85" = - "Copyright (C) 1985 Richard M. Marshall" %include "News.Inc" %include "IE:Terminal.Inc" %include "Inc:SSI.Imp" {-WRITE SEEN FILE-} %external %routine Write Seen File (%string (255) File Name, %record (Seen fm) %name Topics) {PRINT RANGES} %routine Print Ranges (%record (Range fm) %name R) Space %while R ## Nil %cycle Write (R_From, 0) %if R_To > R_From %start Print Symbol ('-') Write (R_To, 0) %finish Print String (", ") %unless R_Next == Nil R == R_Next %repeat %end {Print Ranges} {PASSWORD OFFERED} %predicate Password Offered %byte Ch %string (80) P Clear Screen Feature Put String - ("Cannot write out Seen File, do you want to quote a password?") Normal Right %cycle Ch = Get Key %if Ch = 'y' %or - Ch = 'Y' %or - Ch = ' ' %start %exit %else %if Ch = 'N' %or - Ch = 'n' %false %else %if Ch = '?' Cursor (0, 2) Feature Put String ("Y, SPACE quote; N continue") Normal Cursor (62, 0) %else Put Symbol (BEL) %finish %repeat Clear Line Feature Put String ("Password: ") Normal P = "" %cycle Ch = Get Key %if Ch = CR %start %exit %else %if Ch = CAN %or - Ch = BS P = "" %else %if Ch = DEL Length (P) = Length (P) - 1 %if P # "" %else P = P . To String (Ch) %finish %repeat Quote (P) %true %end {Password Offered} {-MAIN CODE OF WRITE SEEN FILE-} %record (Seen fm) %name T %on 3 %start {Cannot write out the file} %unless Event_Message = " No authority" %and - Password Offered %start %signal 15, 0, 0, Event_Message %finish %finish Open Output (Seen Stream, File Name) Select Output (Seen Stream) T == Topics %while T ## Nil %cycle Print String (T_Topic) %if T_Subscribed = No %start Print Symbol ('!') %else Print Symbol (':') %finish Print Ranges (T_Ranges) New Line T == T_Next %repeat Close Output %end {Write Seen File} %end %of %file