home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / adf42w.zip / Telnet.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-11-05  |  3KB  |  104 lines

  1. /* Sample script for implementing basic Telnet functions in AdeptXBBS */
  2.  
  3. arg line
  4.  
  5. Call AdeptInitRexx
  6.  
  7. if (line = 0) Then  /* Telnet Script won't work in local mode */
  8. Do
  9.   Call AdeptCLS line
  10.   Call AdeptCurPos line,12,1
  11.   Call AdeptPrint line, "Sorry Telnet only avaliable on nodes > 0\r\n"
  12.   Call AdeptPrint line, "{PB"
  13.   Exit
  14. End
  15.  
  16.  
  17. Call AdeptCLS line
  18. Call AdeptLocation line, "Telnet"
  19. /*Call AdeptSayGen line, "Telnet"*/
  20.  
  21. Call AdeptPrint line, "Some Popular AdeptXBBS Systems\r\n\r\n"
  22. Call AdeptPrint line, "1> lakebbs.cn-newc.com.au - LakeBBs Australia         \r\n"
  23. address.1 = "lakebbs.cn-newc.com.au"
  24. port.1 = 23
  25.  
  26. Call AdeptPrint line, "2> summitcnty.com         - Summit Central BBS Colorado USA         \r\n"
  27. address.2 = "summitcnty.com"
  28. port.2 = 23
  29.  
  30. Call AdeptPrint line, "3> snoval.com             - SnoValley Shareware Exchange Washington USA\r\n"
  31. address.3 = "snoval.com"
  32. port.3 = 23
  33. Call AdeptPrint line, "4>                        - Multi User Dungeon System  \r\n"
  34. address.4 = "207.0.255.254"
  35. port.4 = 3333
  36.  
  37. Call AdeptPrint line, "5> Juge.Com               - CommPort OS/2          \r\n"
  38. address.5 = "juge.com"
  39. port.5 = 23
  40.  
  41. Call AdeptPrint line, "6> Gwinn.Com              - The SIO Support BBS                     \r\n"
  42. address.6 = "gwinn.com"
  43. port.6 = 23
  44.  
  45. Call AdeptPrint line, "7> bbs.isonline.com       - A Quickbbs BBS                          \r\n"
  46. address.7 = "bbs.isonline.com"
  47. port.7 = 23
  48.  
  49. Call AdeptPrint line, "8> USER DEFINED\r\n\r\n"
  50.  
  51. Choice = AdeptInput(line,,80,,,"Telnet to: ",,,)
  52.  
  53. if (choice = 8) Then
  54.   Do
  55.     Address.8 = AdeptInput(line,,80,,,"\r\nTelnet to address: ",,,)
  56.     if(Address.8 = '') then exit
  57.     Port.8 = AdeptInput(line,,12,,,"\r\nPort[Enter for Default]: ",,,)
  58.     if(Port.8 = '') then Port.8 = 23
  59.   End
  60.  
  61. if (choice = '') then exit
  62. if (choice > 8 | choice < 1) then exit
  63.  
  64. /* tid = AdeptStartRexxThread('LineTimer.Srx',line) */
  65.  
  66.  
  67. Call AdeptPrint line, "\r\nTrying"
  68. Do 3
  69.   Call AdeptPrint line,"{PA."
  70.   Call AdeptSleep line,128
  71. End
  72.  
  73. Call AdeptPrint line, "{PA" || Address.Choice || " on port "||Port.Choice
  74.  
  75. Call AdeptLocation line, Address.Choice
  76. Call AdeptSayGen line, "Telnet: " || Address.Choice
  77.  
  78. Call AdeptLog line,1,"Telnet: " || Address.Choice
  79. Call AdeptLog line,1,"Port: " || Port.Choice
  80.  
  81. Call AdeptPrintL line,"\r\n\r\n\r\nUser is currently in a telnet session to: "||Address.Choice||":"||Port.Choice
  82.  
  83. rc = AdeptRawOpenSocket(ISTELNETCLIENT, Address.Choice, Port.Choice, 'Port')
  84. if rc = 65558 then do
  85. /* rc = AdeptKillRexxThread(tid) */
  86. exit
  87. end
  88.  
  89. if((port<>0) & (rc=0))then
  90.   rc = AdeptRawComLink(line, Port)
  91. /*if rc = 65558 then do*/
  92.   rc = AdeptRawClose(Port)
  93. /* rc = AdeptKillRexxThread(tid) */
  94.   exit
  95.   end
  96. else
  97. do
  98.   Call AdeptPrint line,"\r\nError: Could not connect to host.\r\n\r\n"
  99.   Call AdeptPrint line,"{PB"
  100. /* rc = AdeptKillRexxThread(tid) */
  101.   exit
  102. end
  103.  
  104.