Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
2.2 KiB

  1. ;
  2. ; This is a script file that demonstrates how
  3. ; to establish a slip connection with a host.
  4. ;
  5. ; A script file must have a 'main' procedure.
  6. ; All script execution starts with this 'main'
  7. ; procedure.
  8. ;
  9. ; Main entry point to script
  10. ;
  11. proc main
  12. ; Change these variables to customize for your
  13. ; specific Internet service provider.
  14. integer nTries = 3
  15. ; This is the login prompt and timeout values
  16. string szLogin = "Userid:"
  17. integer nLoginTimeout = 3
  18. ; This is the password prompt and timeout values
  19. string szPW = "Password?"
  20. integer nPWTimeout = 3
  21. ; This is the prompt once your password is verified
  22. string szPrompt = "InternetLR/E>"
  23. ; This is the command to send to establish the
  24. ; connection. This script assumes you only need
  25. ; to issue one command to continue. Feel free
  26. ; to add more commands if your provider requires
  27. ; it.
  28. string szConnect = "slip^M"
  29. ; Set this to FALSE if you don't want to get an IP
  30. ; address
  31. boolean bUseSlip = TRUE
  32. ; Delay for 2 seconds first to make sure the
  33. ; host doesn't get confused when we send the
  34. ; two carriage-returns.
  35. delay 2
  36. transmit "^M^M"
  37. ; Attempt to login at most 'nTries' times
  38. while 0 < nTries do
  39. ; Wait for the login prompt before entering
  40. ; the user ID, timeout after x seconds
  41. waitfor szLogin then DoLogin
  42. until nLoginTimeout
  43. TryAgain:
  44. transmit "^M" ; ping
  45. nTries = nTries - 1
  46. endwhile
  47. goto BailOut
  48. DoLogin:
  49. ; Enter user ID
  50. transmit $USERID, raw
  51. transmit "^M"
  52. ; Wait for the password prompt
  53. waitfor szPW until nPWTimeout
  54. if FALSE == $SUCCESS then
  55. goto TryAgain
  56. endif
  57. ; Send the password
  58. transmit $PASSWORD, raw
  59. transmit "^M"
  60. ; Wait for the prompt
  61. waitfor szPrompt
  62. transmit szConnect
  63. if bUseSlip then
  64. ; An alternative to the following line is
  65. ;
  66. ; waitfor "Your address is "
  67. ; set ipaddr getip
  68. ;
  69. ; if we don't know the order of the IP addresses.
  70. set ipaddr getip 2
  71. endif
  72. goto Done
  73. BailOut:
  74. ; Something isn't responding. Halt the script
  75. ; and let the user handle it manually.
  76. set screen keyboard on
  77. halt
  78. Done:
  79. endproc