home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / comm / bbbbs-7.2.lha / BBBBS / BBBBS72.lha / rexx / bbsDoors.rexx < prev    next >
OS/2 REXX Batch file  |  1993-12-10  |  5KB  |  209 lines

  1. /* $VER: bbsDoors.rexx 6.6 (10.12.93)
  2. Originally called Jump.rexx by Matt English 9-30-92
  3. Alterations by Richard Lee Stockton 5 Aug, 17 Sep, and 10 Dec 93
  4.  
  5. This is a utility for BBBBS sysops to use rexxDoors offline.
  6. FREELY DISTRIBUTABLE as long as no-one makes any money on it,
  7. this notice remains, and the credits at the main menu remain.
  8. */
  9.  
  10. OPTIONS FAILAT 999999
  11.  
  12. /* Open the support library if it is not already open. */
  13. if ~show('L',"rexxsupport.library") THEN
  14.     CALL addlib('rexxsupport.library',0,-30,0)
  15.  
  16. if ~showlist('p','QuickSortPort') then do
  17.    ADDRESS COMMAND "run quicksort >NIL:"
  18.    do i=1 to 10
  19.       if ~showlist('p','QuickSortPort') then CALL delay 20
  20.       else leave i
  21.    END
  22.    if showlist('p','QuickSortPort') then CALL addlib('QuickSortPort',-30)   
  23. END
  24.  
  25. name=''
  26. figarg='s:CONFIG.BBS'
  27. IF ~EXISTS(figarg) THEN figarg='BBS:BBS_TEXT/CONFIG.BBS'
  28. x=OPEN(f,figarg,'R')
  29. IF x=0 THEN
  30.   DO
  31.     SAY 's:CONFIG.BBS and BBS:BBS/CONFIG.BBS are both missing!'
  32.     EXIT(20)
  33.   END
  34. lynes.=''
  35. DO i=1 TO 6
  36.   lynes.i=READLN(f)
  37. END
  38. CALL CLOSE(f)
  39.  
  40. compos=POS('/*',lynes.1)
  41. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  42. bbsname=STRIP(lynes.1)
  43. sysop  =WORD(lynes.2,1)
  44. bbspath=WORD(lynes.6,1)
  45. IF ~EXISTS(bbspath) THEN
  46.   DO
  47.     SAY bbspath 'does not exist!'
  48.     CALL SETCLIP('BBS_STAT')
  49.     EXIT(20)
  50.   END
  51. testchar=RIGHT(bbspath,1)
  52. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  53. CALL SETCLIP('BBS_path',bbspath)
  54. CALL PRAGMA('D',bbspath'rexxDoors')
  55.  
  56. def='';  /* default */
  57. pen0='';  pen1='';  pen2='';  pen3=''
  58. pen4='';  pen5='';  pen6='';  pen7=''
  59. bak0='';  bak1='';  bak2='';  bak3=''
  60. bak4='';  bak5='';  bak6='';  bak7=''
  61.  
  62. SAY
  63. SAY'                       bbsDoors.rexx'
  64. SAY'               Original by Matt English 9-30-92'
  65. SAY'            Alterations by RLS through 12-10-93'
  66. SAY
  67. SAY
  68. options prompt' Are you 'sysop' ? Y or n > '
  69. pull answer
  70. if answer='Y' | answer='' then name=sysop
  71. else DO
  72.   SAY
  73.   options prompt' Please enter your name > '
  74.   pull name
  75.   name=strip(name)
  76.   name=translate(name,'_',' ')
  77.   if name='' then CALL bye
  78.   file=bbspath'Users/'name
  79.   IF EXISTS(file) THEN match=1
  80.   ELSE match=0
  81. END
  82.  
  83. OK:
  84. SAY
  85. if match=0 then
  86.   DO
  87.     SAY' I can''t find' name 'on the users list!'
  88.     SAY' You should log on to the BBS before you try this!'
  89.     CALL delay(100)
  90.     CALL bye
  91.   END
  92.  
  93. userfile=bbspath'Users/'name
  94. CALL open(data,userfile,'r')
  95. DO i=1 TO 18
  96.   line=readln(data)
  97.   IF i=5 THEN password=WORD(line,1)
  98. END
  99. CALL close(data)
  100. winnings=WORD(line,1)
  101. IF ~DATATYPE(winnings,'N') THEN winnings=0
  102.  
  103. passprompt=' 'pen3'Please Enter Password: '
  104. DO tries=1 TO 3
  105.   OPTIONS PROMPT passprompt
  106.   PULL newpassword
  107.   SAY ''
  108.   IF(password=newpassword) THEN LEAVE tries; /* correct password */
  109.   IF tries=3 THEN
  110.     DO
  111.       SAY 
  112.       SAY 'Access terminated.'
  113.       line='*** Bad password ***' newpassword '***'
  114.       SAY line
  115.       CALL bye
  116.     END
  117.   passprompt='Incorrect.  Password: ' /* ask again */
  118. END
  119. SAY
  120. SAY' OK, 'name' here we go....'
  121. SAY
  122.  
  123. CALL sortdoors()
  124. temp=1
  125. readcount=-1
  126. DO doorloop=1
  127.   IF temp=0 THEN
  128.     DO
  129.       IF readcount~=-1 THEN
  130.         DO
  131.           doors.0=''
  132.           CALL sortdoors()
  133.         END
  134.       SAY
  135.       SAY CENTER('- Number of accesses per file -',75)
  136.     END
  137.   SAY pen3||LEFT('-',75,'-')||def
  138.   DO jd=1 TO jdoors.0
  139.     IF temp=0 THEN SAY jdoors.jd.0
  140.     ELSE SAY jdoors.jd
  141.   END
  142.   IF temp=0 THEN
  143.     DO
  144.       SAY
  145.       OPTIONS PROMPT '                                 'pen3'Press RETURN 'def
  146.       PULL junk
  147.       temp=1
  148.       SAY
  149.       ITERATE doorloop
  150.     END
  151.   options prompt' 'pen3'Select Application Number (0=Stats) or hit 'pen2'Return to Quit' pen3'> 'def
  152.   pull temp
  153.   IF temp=0 THEN ITERATE doorloop
  154.   IF ~DATATYPE(temp,'N') | temp<1 | temp>doors.0 THEN RETURN
  155.   arg=doors.temp
  156.   IF GETCLIP('BBS_door')=arg THEN
  157.     DO
  158.       SAY 'That door is in use!  Try again in a few minutes...'
  159.       ITERATE doorloop
  160.     END
  161.   CALL SETCLIP('BBS_localdoor',arg)
  162.   readcount=WORD(STATEF(bbspath'rexxDoors/'arg),8)
  163.   IF ~DATATYPE(readcount,'W') THEN readcount=0
  164.   ADDRESS COMMAND 'C:filenote' bbspath'rexxDoors/'arg readcount+1
  165.   comm='CALL' doors.temp'('name winnings 0 1 6000')'
  166.   INTERPRET comm
  167.   CALL SETCLIP('BBS_localdoor')
  168. END
  169.  
  170. bye:
  171. CALL SETCLIP('BBS_localdoor')
  172. SAY
  173. SAY' Now leaving bbsDoors....'
  174. SAY
  175. EXIT
  176.  
  177.  
  178. sortdoors:
  179. IF ~DATATYPE(jdoors.0,'W') THEN doors.0=0
  180. IF WORDS(SHOWDIR(bbspath'rexxDoors','F'))~=doors.0 THEN
  181.   DO
  182.     jdoors.=''
  183.     doorlist=SHOWDIR(bbspath'rexxDoors','F')
  184.     doors.=''
  185.     doors.0=WORDS(doorlist)
  186.     DO i=1 TO doors.0
  187.       doors.i=WORD(doorlist,i)
  188.     END
  189.     SAY 'Sorting..'
  190.     CALL QSORT(1,doors.0,doors)
  191.     jdoors.0=doors.0%3
  192.     IF (doors.0//3)>0 THEN jdoors.0=jdoors.0+1
  193.     DO i=1 TO jdoors.0
  194.       DO j=0 TO 2
  195.         k=i+j*jdoors.0
  196.         IF k<=doors.0 THEN
  197.           DO
  198.             jdoors.i=jdoors.i' 'LEFT(RIGHT(k,3)'.' LEFT(doors.k,LENGTH(doors.k)-5),24)
  199.             dcount=WORD(STATEF(bbspath'rexxDoors/'doors.k),8)
  200.             jdoors.i.0=jdoors.i.0||LEFT(RIGHT(dcount,5) LEFT(doors.k,LENGTH(doors.k)-5),24)' '
  201.           END
  202.       END
  203.     END
  204.   END
  205. RETURN 0
  206.  
  207.  
  208. /* bbsDoors.rexx */
  209.