home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / ftpdc2.zip / ftpdc2.cmd next >
OS/2 REXX Batch file  |  1994-08-12  |  3KB  |  74 lines

  1. /**/
  2. "@echo off"
  3. /* init info,data      */ info = ""; data = "";
  4. /* add rxsock          */ rc = RxFuncAdd("SockLoadFuncs","RxSock","SockLoadFuncs")
  5. /* load rxsock         */ rc = SockLoadFuncs('Quiet')
  6. /* add RxUtil          */ rc = rxfuncadd 'rxydbautilinit','ydbautil','rxydbautilinit'
  7. /* load RxUtil         */ rc = rxydbautilinit()
  8. /* socket from inetd   */ Parse arg ns
  9. /* Connect             */ rc = SockGetPeerName(ns,"peer.!")
  10. /* Get real name       */ rc = SockGetHostByAddr(peer.!addr,"host.!")
  11.  
  12. maxusers=5
  13.  
  14. /* Send the welcome message here */
  15.  
  16. Call Send copies("*",75)
  17. call Send "*"center("University of Arkansas",73)"*"
  18. call Send "*"center("College of Agriculture and Home Economics",73)"*"
  19. call Send "*"center("Microcomputer Laboratories",73)"*"
  20. call Send "*"center("AGHELAB.UARK.EDU (130.184.48.50)",73)"*"
  21. Call Send copies("*",75)
  22.  
  23. /* Count the number of users */
  24. "netstat -s >" ns||".temp"
  25. stat=charin(ns||".temp",1,chars(ns||".temp"))
  26. users=RxScount("ftp..21",stat)-RxScount("STREAM         ftp..21",stat)-1
  27. call stream ns||".temp","C","Close"
  28. "erase " ns||".temp"
  29.  
  30. if users>maxusers then
  31.    do
  32.    call Send "You are user "users
  33.    call Send500 "There are only "maxusers" user(s) allowed at this time."
  34.    call Send500 "Sorry.  Please try again later."
  35.    Call socksoclose(ns)
  36.    say "Closed session because too many users."
  37.    exit
  38.    end
  39.  
  40. call Send "This site is the home of the SMB-Based Networking FAQ draft and"
  41. call Send "  MaxiFTP - the premier command line FTP client for OS/2."
  42. call Send " "
  43. call Send "The NetBIOS name for this site is \\AGHELAB\FTP."
  44. call Send "  If you have an SMB-Client capable of using NetBIOS over TCP/IP,"
  45. call Send "  feel free to access this site in that fashion."
  46. call Send " "
  47. call Send "Due to a bug in the OS/2 FPTD, LS does not display directory names."
  48. call Send "  Use DIR insetead."
  49. call Send " "
  50. call Send "Note: OS/2 preserves but ignores case."
  51. call Send " "
  52. call Send "The August 1994 Hobbes OS/2 CD-ROM collection is on-line in the"
  53. call Send "Hobbes directory. If another CD is mounted, this will be unavailable."
  54. call Send " "
  55. call Send "You are user "users" out of "maxusers" FTP users allowed."
  56. call send "Local time is "time()" on "date("L")"."
  57.  
  58. /* Call the real FTPDC */"FTPDC "ns
  59. /* leave!              */ exit
  60.  
  61. send:
  62. parse arg info
  63. info="220-"||info||d2c(10)
  64. /* Get the length      */ textlength = length(info)
  65. /* Send it             */ rc = SockSend(ns,info,textlength)
  66. return
  67.  
  68. send500:
  69. parse arg info
  70. info="500-"||info||d2c(10)
  71. /* Get the length      */ textlength = length(info)
  72. /* Send it             */ rc = SockSend(ns,info,textlength)
  73. return
  74.