/*   PYTHON EXEC rewritten by Joel Yang SY '88 <JoelYan@YaleVM> 1/87
 
For use with Malcolm (CLARINET@YALEVM) Dickinson's PYTHON DATA file, some of
which was received from
Jonathan Partington (JRP1%CAM.PHX%UK.AC.CAM.ENG-ICF@AC.UK).
 
     Earlier versions by
       Josh Trupin '88    <TRUJOSE@YALEVMX> 9/86
       Michael Barnes '88 <BARMICB@YALEVMX> 8/85
       Larry Stone '83    <STOLAUC@YALEVMX> 4/82
*/
 
FILE = 'PYTHON DATA'
arg A
if A='?' then do
  say 'The PYTHON EXEC makes Pythy statements.'
  say 'May take an argument:  The number of lines you want generated.'
  say 'Messages can be optionally echoed to other users.'
  say 'Syntax:  PYTHON [n] [TO user/s]'
end
else do
  parse var A N 'TO' W
  'L 'FILE' *(D STACK NOH'                    /* finds last line */
  if RC=0 then do
    if N<1 then N=1
    if N>99 then N=99
    parse pull . . M . . L .
    do queued(); pull; end                    /* discard extra copies */
    do N
      R = random(1,L)
      'EXECIO 1 DISKR' FILE M R
      parse pull A
      say A
      if W<>'' then do
        'S' W A
        if RC<>0 then W=''
      end
    end
  end
  else say 'What''s this??  Data file not found!  Nearly Fatal Error #697.3!'
end
exit 0
