Viewing contents of file '../idllib/deutsch/local/mkmsgslist.pro'

  print,'Generating new msgs archive'

  infile='/host/mimas/net/www/deutsch/local/MSGS.archive'
  hdrfile='/host/bluemoon/usr2/idllib/deutsch/local/mkmsgslist.header'
  outfile='/host/mimas/net/www/deutsch/local/msgslist.html'

  files=findfile("/pub/msgs/*",count=nfiles)
  ifiles=intarr(nfiles) & ptr=0
  for i=0,nfiles-1 do begin
    fil=strmid(files(i),10,99)
    if (strnumber(fil,value) eq 1) then begin
      ifiles(ptr)=fix(fil)
      ptr=ptr+1
      endif
    endfor
  ifiles=ifiles(0:ptr-1)
  ifiles=ifiles(sort(ifiles))

  openw,2,infile
  for i=0,ptr-1 do begin
    openr,1,'/pub/msgs/'+strn(ifiles(i))
    while not EOF(1) do begin
      readf,1,lin & printf,2,lin
      endwhile
    close,1
    printf,2,''
    endfor
  close,2


  openw,2,outfile
  openr,3,hdrfile
  lin=''
  while (not EOF(3)) do begin
    readf,3,lin
    printf,2,lin
    endwhile
  close,3

  openr,1,infile
  fileptr=0L

  while (not EOF(1)) do begin
    while (not EOF(1)) and (strmid(lin,0,5) ne 'From ') do begin
      pfileptr=fileptr
      readf,1,lin
      fileptr=fileptr+strlen(lin)+1
      endwhile

    if (not EOF(1)) then begin
      i=5 & flag1=0
      while (flag1 lt 2) do begin
        if (strmid(lin,i,1) eq '@') then flag1=1
        if (strmid(lin,i,1) eq '.') and (flag1 eq 1) then flag1=2
        if (strmid(lin,i,1) eq ' ') then flag1=2
        if (strmid(lin,i,1) eq '') then flag1=999
        i=i+1
        endwhile
      sender=strmid(lin,5,i-6)
      i=i-1
      while (strmid(lin,i,1) ne ' ') do i=i+1
      datestr=strmid(lin,i+2,11)+strmid(lin,i+13+9,4)
;      print,datestr
      while (strmid(lin,0,8) ne 'Subject:') and (strn(lin) ne '') and $
        (not EOF(1)) do begin
        readf,1,lin & fileptr=fileptr+strlen(lin)+1
        endwhile
      if (strmid(lin,0,8) ne 'Subject:') then lin='Subject: none specified'
      subj=strmid(lin,9,99)
      iauc=strmid(subj,strpos(subj,' ')+1,4)
      printf,2,'<LI>'+datestr+' - '+sender+' - '+ $
        '<A HREF="http://www.astro.washington.edu/deutsch-bin/msgsget?'+ $
        strn(pfileptr)+'">'+subj+'</A>'
      endif
    endwhile

  printf,2,'</UL><P>'
  printf,2,''

  printf,2,'<HR SIZE=5>'
  printf,2,'<ADDRESS> Eric Deutsch: deutsch@astro.washington.edu </ADRESS> <BR>'
  printf,2,'Back to <A HREF="http://www.astro.washington.edu/deutsch/">My Home Page</A> <BR>'
  printf,2,'Back to <A HREF="http://www.astro.washington.edu/">UW Astronomy Home Page</A> <BR>'

  close,/all

end