home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0950.lha / BBDoors / BBDoors65.lha / rexxDoors / FilmFlubs.rexx < prev    next >
OS/2 REXX Batch file  |  1991-10-15  |  1KB  |  54 lines

  1. /*  $VER: 1.0  FilmFlubs.rexx  15 October 1991  (15.10.91)
  2.             copyright 1991 Richard Lee Stockton
  3.                   FREELY DISTRIBUTABLE
  4. */
  5.  
  6. FF='0C'x  /* FormFeed */
  7. CR='0D'x  /* Carraige Return */
  8. SIGNAL ON BREAK_C
  9. SIGNAL ON BREAK_E
  10.  
  11. ARG name .
  12.  
  13. bbspath=GETCLIP('BBS_path')
  14. filename=bbspath'rexxDoors/Data/FilmFlubs.txt'  /* Formfeed separated text */
  15. size=WORD(STATEF(filename),2)
  16. fragment=size/3000
  17.  
  18. x=OPEN(f,'RAM:DUMMY','W')                /* write to a dummy file */
  19. IF x=0 THEN EXIT(20);
  20. CALL WRITELN(f,'dummy')
  21. CALL CLOSE(f)
  22. micros=WORD(STATEF('RAM:DUMMY'),7)        /*  0 >= micros < 3000  */
  23. location=fragment*micros
  24. IF fragment>1000 THEN
  25.   location=location+fragment*RIGHT(TIME('S'),2)/100
  26. ELSE IF fragment>100 THEN
  27.   location=location+fragment*RIGHT(TIME('S'),1)/10
  28. location=TRUNC(location)
  29. IF location>size THEN location=micros
  30.  
  31. x=OPEN(f,filename,'R')
  32. IF x=0 THEN RETURN(10);
  33. CALL SEEK(f,location,'B')            /* point to the random place */
  34. line=''
  35. DO WHILE line~=FF & ~EOF(f)        /* find the start (a formfeed) */
  36.   line=READLN(f)
  37. END
  38. count=0
  39. line=''
  40. IF ~EOF(f) THEN      /* if EOF then must be right at end. missed! */
  41.   DO WHILE line~=FF & ~EOF(f)         /* otherwise, show the page */
  42.     line=READLN(f)
  43.     IF ~EOF(f) & line~=FF THEN
  44.       DO
  45.         SAY line||CR
  46.         count=count+1
  47.       END
  48.   END
  49. BREAK_C:
  50. BREAK_E:
  51. CALL CLOSE(f)
  52. RETURN(count);
  53. EXIT;                           /* a little redundant, so sue me! */
  54.