program bbmail,1.0(10)

! Display captured text from the AMUS mail system


! Donated by:
!       John Baima
!       Eisenbrauns
!       PO Box 275
!       Winona Lake, IN 46590
!       (219) 269-2011
!       NONA/AM
!       8-17-85

! This program allows the display generated by the AMUS mail to be displayed
! in a (relatively) nice way.  The output from the AMUS mail system is
! one LONG string.  Vue does not like this very well and all the control
! codes makes things hard to read.
!
! This program, however, will print the text on screen (when not paying
! for a long distance call).  Simply give the program the name of the file
! containing the captured text.  The display should be the same as when you
! first saw it.  The display will stop and the bell will ring whenever the
! words "Next" or "Find" are encountered.  Simply press <CR> to continue.
! "Next" occurs 3 times at the end of each entry, if you are simply paging
! through the mail. DON'T press <CR> before the bell--it will wreck the
! screen.
!
! The variable big'line is big, but it may need to be bigger to get all
! of the text. The way to know if it is large enough is to do a dir/w on
! the file to be diplayed and multiply by 512. Also, make sure your memory
! partition is large enough!!!
!
! It is necessary to split the big'line into smaller ones because of
! the speed of display.  If you think this is slow, try it without
! breaking a 20 or 30k line!

map1 big'line,S,40000
map1 big'file,S,80
map1 split'length,f,,500        ! This must = the size of "little'line"
map1 little'line,S,500
map1 junk'input,s,10
map1 len'little'line,f
map1 pos,f

print tab(-1,0);

print tab(5,10);"When the bell sounds, press <RETURN> to continue.";
print tab(10,10);

input line "Input file name:  ", big'file

open #1, big'file, input

print tab(-1,0);

TOP:
       if eof(1) = 1 then goto bottom

       input line #1, big'line

PRINT'A'PART:

       if len(big'line) < split'length then little'line = big'line : &
                       call display'text : goto TOP

       little'line = big'line[1,split'length]
       call display'text

       big'line = big'line[split'length+1,LEN(big'line)]
goto PRINT'A'PART


display'text:
       len'little'line = len(little'line)
       pos = 1
top'text:
       print little'line[pos;1];
       if little'line[pos;4] = "Next" or &
          little'line[pos;4] = "Find" then call halt'screen
       pos = pos + 1
       if pos <= len'little'line then goto top'text
       return

halt'screen:
       print tab(23,4);chr(7);
       input line "", junk'input
       print tab(24,4);
       return

bottom:
       close #1
       print tab(24,1);chr(7);tab(-1,9);"BBMAIL IS FINISHED";CHR(7);

       end