home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / bbs / fix_last / fix_last.lst next >
File List  |  1991-03-06  |  2KB  |  74 lines

  1. ON ERROR GOSUB slut
  2. init
  3. open_user
  4. open_lastread
  5. IF antal_user%<>antal_lastread%
  6.   PRINT "Lastread Error!!!"
  7.   FOR i%=1 TO 5
  8.     PRINT "◆✓";
  9.     PAUSE 5
  10.   NEXT i%
  11.   PRINT "Users: ";antal_user%;" Lastread:";antal_lastread%
  12.   PRINT "Restoring lastread.bbs... ";
  13.   fix_lastread
  14.   PRINT "Renamed old lastread to lastread.old"
  15. ELSE
  16.   PRINT "Everything is OK! (Phew....)"
  17.   PAUSE 50
  18. ENDIF
  19. CLOSE
  20. EDIT
  21. > PROCEDURE slut
  22.   PRINT " Sorry, Someting BAD happened... Quitting."
  23.   CLOSE
  24.   EDIT
  25. RETURN
  26. > PROCEDURE init
  27.   DIM lastread&(200),area&(200),area$(200),nom&(200)
  28. RETURN
  29. > PROCEDURE open_user
  30.   PRINT "Open User.bbs..."
  31.   OPEN "I",#1,"USERS.BBS"
  32.   l%=LOF(#1)
  33.   CLOSE #1
  34.   antal_user%=l%/158
  35. RETURN
  36. > PROCEDURE open_lastread
  37.   PRINT "Open Lastread.bbs..."
  38.   OPEN "I",#1,"Lastread.bbs"
  39.   l%=LOF(#1)
  40.   CLOSE #1
  41.   antal_lastread%=l%/400
  42.   '
  43.   OPEN "R",#99,"LASTREAD.BBS",400
  44.   FOR i%=1 TO 200
  45.     FIELD #99,2 AT(V:lastread&(i%))
  46.   NEXT i%
  47. RETURN
  48. > PROCEDURE fix_lastread
  49.   IF antal_user%>antal_lastread%
  50.     IF EXIST("Lastread.new")
  51.       KILL "lastread.new"
  52.     ENDIF
  53.     OPEN "R",#89,"LASTREAD.NEW",400
  54.     FOR i%=1 TO 200
  55.       FIELD #89,2 AT(V:lastread&(i%))
  56.     NEXT i%
  57.     FOR i%=1 TO antal_lastread%
  58.       GET #99,i%
  59.       PUT #89,i%
  60.     NEXT i%
  61.     FOR i%=antal_lastread% TO antal_user%
  62.       FOR j%=1 TO 200
  63.         lastread&(j%)=0
  64.       NEXT j%
  65.       PUT #89,i%
  66.     NEXT i%
  67.     PRINT "Done"
  68.     RENAME "lastread.bbs" AS "lastread.old"
  69.     RENAME "lastread.new" AS "lastread.bbs"
  70.   ELSE
  71.     PRINT "Sorry, I couldn't fix it..."
  72.   ENDIF
  73. RETURN
  74.