{routine to load in a list of topic in the topic directory}

{Richard M. Marshall - 13-February-1985}

%external %string (255) Copyright %alias "NEW_TOPICS_(C)_RMM_85" = -
   "Copyright (C) 1985 Richard M. Marshall ad Frank D. Cringle"

%include "News.Inc"

%external %record (Topic fm) %map Read Topics
   %record (Topic fm) Topic Pattern
   %record (Topic fm) %name Top,
                            Current,
                            Last == Nil
   %string (255) Name
   %byte Ch

   %on 9 %start
      Close Input
      Select Host (Home Host)
      %result == Top
   %finish

   Select Host (News Host)
   Open Input (Seen Stream,  News Directory . "NEWS.INDEX")
   Select Input (Seen Stream)
   %cycle
      Name = ""
      %cycle
         Read Symbol (Ch)
         %exit %if Ch = NL
         Name = Name . To String (Ch)
      %repeat
      Current == New (Topic Pattern)
      Current_Next == Nil
      Current_Topic = Name
      %if Last == Nil %start
         Top == Current
         Current_Last == Nil
      %else
         Current_Last == Last
         Last_Next == Current
      %finish
      Last == Current
   %repeat
%end {Read Topics}
