home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / BLST10_2.ZIP / SAMPLES / EXAMPLE.SYS < prev    next >
Encoding:
Text File  |  1990-09-13  |  18.7 KB  |  541 lines

  1. :
  2. ##############################################################################
  3. #
  4. # Example system script using Digital Equipment Corp (DEC) VAX VMS as basis
  5. #
  6. # Areas that will often be customized are indicated by a comment of the form:
  7. #
  8. #-------------------------------------------------------------------------------
  9. # Description of what follows
  10. #-------------------------------------------------------------------------------
  11. #
  12. # Structure of a system script
  13. #                 
  14. #    1) Optional comments --    any comments preceding the index tag start with a
  15. #                            colon (:) on a line by itself.  This tells the
  16. #                            index program to keep these lines.  If it is
  17. #                            omitted, the leading comments will be lost during
  18. #                            the indexing process.
  19. #    2) Index tag ----------    A colon (:) followed by up to eight charaters.
  20. #                            This is the name to use in the System Type field
  21. #                            of the Setup.  System Type ignores the case of the
  22. #                            entries in the systems.scr index.
  23. #    3) Entry points    -------    Each entry point returns 0 if successful.
  24. #                            Unsuccessful results are indicated by returning
  25. #                            1 of not running AutoPoll, -2 for .LOGON & .LOGOFF
  26. #                            and -3 for .TRANSFER when running AutoPoll.
  27. #                            Four entry points are required in a system script:
  28. #                            .LOGON ----    Generally, .LOGON sends a USERID and
  29. #                                        PASSWORD in response to the operating
  30. #                                        system's prompts.  This section should
  31. #                                        also be used to "navigate" through any
  32. #                                        data security devices or network con-
  33. #                                        nections.  AutoPoll uses line 12 of the
  34. #                                        display for logon messages.  
  35. #                            .LOGOFF ---    Used to terminate a user session on the
  36. #                                        called computer.  This section is
  37. #                                        called prior to instructing the modem
  38. #                                        to hang up.  AutoPoll uses line 14 of
  39. #                                        the display for logoff messages.
  40. #                            .UPLOAD ---    Performs the non-error-checked upload of
  41. #                                        a text file. This is often referred to 
  42. #                                        as an "ASCII upload".  AutoPoll does not
  43. #                                        support the UPLOAD function.
  44. #                            .TRANSFER -    Starts BLAST on the remote computer.
  45. #                                        AutoPoll uses line 13 of the display
  46. #                                        for File Transfer messages.
  47. #    4) Terminator ---------    The label ".END".
  48. #
  49. ##############################################################################
  50. #
  51. #-------------------------------------------------------------------------------
  52. # Index tag (change this to the name you want to use in the System Type field) 
  53. #-------------------------------------------------------------------------------
  54. :Custom
  55. #########################################
  56. #                                        #
  57. # LOGON                                    #
  58. #                                        #
  59. #########################################
  60. .LOGON
  61.     if not null @USERID goto .LOG10        # Make sure that there is a USERID
  62.     if @SCRFILE not = "AutoPoll"        # Only ask the user if not in AutoPoll
  63.         ask "enter account", @USERID
  64.         if null @USERID return 0        # Return success if user insists on no USERID
  65.         goto .LOG10                        # Otherwise, continue with LOGON
  66.     end
  67. #
  68. # AutoPoll Status file update
  69. #
  70.         # Each "log" line in the status file is preceded by 18 spaces
  71.         # Informational messages should have a "*" in the 19th position
  72.         # Error messages should have ">>" in the 19th and 20th positions
  73.     fwrite 4, "                  >> CHECK SETUP FILE (",@su_fil,") - No USERID specified"
  74. #
  75. # AutoPoll Screen display
  76. #
  77. # @USERIF tracks the setting of the "/n" (no display) command line option
  78. # If /n was used, @USERIF = "0".  Otherwise it is "1".
  79. # If the USER InterFace is active (= "1") update the status display.
  80. #
  81.     if @USERIF = "1"
  82.         set @SCRLREG = "1"                # Turn on the scrolling region
  83. #
  84. # The next two commands (with varying row and column numbers) must occur after
  85. # each time you enable the scrolling region.  This will maintain compatibility
  86. # with certain version of BLAST that fail to position the cursor properly
  87. # immediately after turning on the scrolling region.  Always use the position
  88. # of the "real" string location and always use " " as the string to put.
  89. #
  90.         cursor 12,0                        # Position the cursor
  91.         put " "                            # Display "nothing" there
  92. #
  93. # The next 4 lines update the online status display.
  94. # Columns 0-2 contain either "-->" or "   " to indicate that the task on that
  95. # line is in process or done, respectivley.  Column 3 remains blank until the
  96. # task is done.  It is changed to a "*" if the task was successful, "X" if not.
  97. # The status message area starts in column 15 and extends thru column 79.
  98. #
  99.         cursor 12,0                        # In this case the task failed...
  100.         put "   X"                        # so replace the "--> " with "   X"
  101.         cursor 12,15                    # and add the error message text
  102.         put "SETUP FILE ",@su_fil," - No USERID specified"
  103.         cleol                            # and clean up the rest of the line.
  104.         set @SCRLREG = "0"                # Done, turn scrolling region off.
  105.     end
  106.     return -2                            # Return -2, to indicate logon failed.
  107. #
  108. # Comes here if there is a USERID
  109. #
  110. .LOG10
  111.     if not null @PASSWORD goto .LOG15    # Go on, if the PASSWORD is filled in
  112.     if @SCRFILE not = "AutoPoll"        # If not running AutoPoll, ask for one
  113.         ask noecho "enter password", @PASSWORD
  114.         if null @PASSWORD return 0        # If user insists on none, return success
  115.         goto .LOG15
  116.     end
  117. #
  118. # AutoPoll Status file update
  119. #
  120.     fwrite 4, "                  >> CHECK SETUP FILE (",@su_fil,") - No PASSWORD specified"
  121. #
  122. # AutoPoll Screen display
  123. #
  124.     if @USERIF = "1"
  125.         set @SCRLREG = "1"
  126.         cursor 12,0
  127.         put " "
  128.         cursor 12,0
  129.         put "   X"
  130.         cursor 12,15
  131.         put "SETUP FILE ",@su_fil," - No PASSWORD specified"
  132.         cleol
  133.         set @SCRLREG = "0"
  134.     end
  135.     return -2
  136. .LOG15
  137. #
  138. # AutoPoll Screen display
  139. #
  140.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  141.         set @SCRLREG = "1"
  142.         cursor 12,0
  143.         put " "
  144.         cursor 12,0
  145.         put "--> "
  146.         set @SCRLREG = "0"
  147.     end
  148. #-------------------------------------------------------------------------------
  149. # Determines how many times to retry the login procedure
  150. #-------------------------------------------------------------------------------
  151.     reps 5
  152. #
  153. # AutoPoll Screen display
  154. #
  155. .LOG20
  156.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  157.         set @SCRLREG = "1"
  158.         cursor 12,15
  159.         put " "
  160.         cursor 12,15
  161.         put "Looking for ",@SYSTYPE," Username prompt"
  162.         cleol
  163.         set @SCRLREG = "0"
  164.     end
  165. #-------------------------------------------------------------------------------
  166. # Send something to get the Username prompt (or equivalent)
  167. #-------------------------------------------------------------------------------
  168.     tsend CR, CR
  169. #-------------------------------------------------------------------------------
  170. # Look for the most likely responses
  171. #-------------------------------------------------------------------------------
  172.     ttrap 5 "name:","word:","$","authorization fail"
  173.     if @STATUS = "1" goto .LOG30
  174.     if @STATUS = "2"
  175.         tsend CR
  176.         goto .LOG20
  177.     end
  178.     if @STATUS = "3"
  179.         tsend "LOGOFF", CR
  180.         goto .LOG20
  181.     end
  182. .LOG25
  183. #-------------------------------------------------------------------------------
  184. # Send a Ctrl-Q (\021) to try and restart output from remote system
  185. # Also send a Ctrl-Y (\031) to try and abort any application running on remote
  186. #-------------------------------------------------------------------------------
  187.     tsend "\021\031"
  188.     if @SCRFILE = "AutoPoll" fwrite 4, "                  * Attempting to get ",@SYSTYPE," system's attention"
  189.     if reps goto .LOG20
  190. #
  191. #    Can't log in, inform user and exit
  192. #
  193.     if @SCRFILE = "AutoPoll" fwrite 4, "                  >> CHECK SETUP FILE (",@su_fil,") - Remote not responding with Userid prompt for ",@SYSTYPE
  194.     else return 1
  195. #
  196. # AutoPoll Screen display
  197. #
  198.     if @USERIF = "1"
  199.         set @SCRLREG = "1"
  200.         cursor 12,0
  201.         put " "
  202.         cursor 12,0
  203.         put "   X "
  204.         cursor 12,15
  205.         put "CHECK SETUP ",@su_fil," - Wrong System Type?"
  206.         cleol
  207.         set @SCRLREG = "0"
  208.     end
  209.     return -2
  210. #
  211. # Comes here when the prompt for the user name is detected
  212. .LOG30
  213. #
  214. # AutoPoll Screen display
  215. #
  216.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  217.         set @SCRLREG = "1"
  218.         cursor 12,15
  219.         put " "
  220.         cursor 12,15
  221.         put "Sending UserId"
  222.         cleol
  223.         set @SCRLREG = "0"
  224.     end
  225. #-------------------------------------------------------------------------------
  226. # Send the user name data (usually just the @USERID variable and a return) 
  227. #-------------------------------------------------------------------------------
  228.     tsend @USERID, CR                       # enter USERID
  229. #-------------------------------------------------------------------------------
  230. # Wait for the most likely responses
  231. #-------------------------------------------------------------------------------
  232.     ttrap 10 "word:","$","authorization fail"                    # wait for PASSWORD prompt
  233.     if @STATUS = "2" goto .LOG50
  234.     if @STATUS = "0" or @STATUS = "3" goto .LOG25
  235. #
  236. # AutoPoll Screen display
  237. #
  238.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  239.         set @SCRLREG = "1"
  240.         cursor 12,15
  241.         put " "
  242.         cursor 12,15
  243.         put "Sending Password"
  244.         cleol
  245.         set @SCRLREG = "0"
  246.     end
  247. #-------------------------------------------------------------------------------
  248. # Send the password data (usually just the @PASSWORD variable + return)
  249. #-------------------------------------------------------------------------------
  250.     tsend @PASSWORD, CR                     # enter PASSWORD
  251. #-------------------------------------------------------------------------------
  252. # Look for the system prompt (or whatever indicates that you are logged on)
  253. #-------------------------------------------------------------------------------
  254.     ttrap 20 "$","authorization fail"
  255.     if @STATUS = "1"
  256. .LOG50
  257.         if @USERIF = "0" or @SCRFILE NOT = "AutoPoll" return 0
  258. #
  259. # AutoPoll Screen display
  260. #
  261.         set @SCRLREG = "1"
  262.         cursor 12,0
  263.         put " "
  264.         cursor 12,0
  265.         put "   *"
  266.         cursor 12,15
  267.         put "Logged on"
  268.         cleol
  269.         set @SCRLREG = "0"
  270.         return 0                            # got a system prompt
  271.     end
  272. #
  273. #    Incorrect USERID/PASSWORD - perhaps it was corrupted in transit
  274. #
  275.     if @SCRFILE = "AutoPoll" fwrite 4, "                  * Re-trying LOGIN - noise may have corrupted Username/Password exchange"
  276.     if reps goto .LOG20
  277.     if @SCRFILE = "AutoPoll" fwrite 4, "                  >> CHECK SETUP FILE (",@su_fil,") - Userid/Password not valid or noisy line"
  278.     else return 1
  279. #
  280. # AutoPoll Screen display
  281. #
  282.     if @USERIF = "1"
  283.         set @SCRLREG = "1"
  284.         cursor 12,0
  285.         put " "
  286.         cursor 12,0
  287.         put "   X"
  288.         cursor 12,15
  289.         put "CHECK SETUP ",@su_fil," - bad Username/Password or line noise"
  290.         cleol
  291.         set @SCRLREG = "0"
  292.     end
  293.     return -2
  294. #########################################
  295. #                                        #
  296. # LOGOFF                                #
  297. #                                        #
  298. #########################################
  299. .LOGOFF
  300. #
  301. # AutoPoll Screen display
  302. #
  303.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  304.         set @SCRLREG = "1"
  305.         cursor 14,0
  306.         put " "
  307.         cursor 14,0
  308.         put "--> "
  309.         cursor 14,15
  310.         put "Looking for operating system prompt"
  311.         set @SCRLREG = "0"
  312.     end
  313. #-------------------------------------------------------------------------------
  314. # Determine the number of times to attempt the logoff
  315. #-------------------------------------------------------------------------------
  316.     reps 4                                  # try 4 times
  317. #
  318. .LGF10
  319. #-------------------------------------------------------------------------------
  320. # Look for a recognizable response from the remote system
  321. #-------------------------------------------------------------------------------
  322.     tsend CR                                # get system prompt
  323. #-------------------------------------------------------------------------------
  324. # Handle the most likey responses
  325. #-------------------------------------------------------------------------------
  326.     ttrap 5 "$","name:","word:","authorization fail"
  327.     if @STATUS = "1" goto .LGF20                        # VMS sys prompt
  328.     if @STATUS = "2" or @STATUS = "4" goto .LGF25
  329. #
  330.     if reps
  331. #-------------------------------------------------------------------------------
  332. # Send a Ctrl-Q (\021) to try and restart output from remote system
  333. # Also send a Ctrl-Y (\031) to try and abort any application running on remote
  334. #-------------------------------------------------------------------------------
  335.         tsend "\021\031"
  336.         goto .LGF10
  337.     end
  338. #
  339. #    Unable to get anything recognizable - abort
  340. #
  341.     if @SCRFILE = "AutoPoll" fwrite 4, "                  >> CHECK SETUP FILE (",@su_fil,") - LOGOFF Failed: Remote not responding as expected for ",@SYSTYPE
  342.     else return 1
  343. #
  344. # AutoPoll Screen display
  345. #
  346.     if @USERIF = "1"
  347.         set @SCRLREG = "1"
  348.         cursor 14,0
  349.         put " "
  350.         cursor 14,0
  351.         put "   X"
  352.         cursor 14,15
  353.         put "CHECK SETUP ",@su_fil," - Could not find operating system prompt"
  354.         cleol
  355.         set @SCRLREG = "0"
  356.     end
  357.     return -2
  358. #
  359. .LGF20                                          # VMS logout
  360. #-------------------------------------------------------------------------------
  361. # Send the command to terminate this user session
  362. #-------------------------------------------------------------------------------
  363.     tsend  "LOGOFF",CR
  364. #
  365. # AutoPoll Screen display
  366. #
  367. .LGF25
  368.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  369.         set @SCRLREG = "1"
  370.         cursor 14,0
  371.         put " "
  372.         cursor 14,0
  373.         put "   *"
  374.         cursor 14,15
  375.         put "Logged off"
  376.         cleol
  377.         set @SCRLREG = "0"
  378.     end
  379.     return 0
  380. #########################################
  381. #                                        #
  382. # UPLOAD                                #
  383. #                                        #
  384. #########################################
  385. .UPLOAD
  386.     if @SCRFILE = "AutoPoll"
  387.         werror "UPLOAD not supported by AutoPoll"
  388.         fwrite 4, "                  >> UPLOAD not supported"
  389.         return -2
  390.     end
  391.         ask "enter filename to upload", @filename
  392.         if null @filename return 0
  393.         if exist @filename goto .UPL10
  394.         werror "can't open ", @filename
  395.         return 1
  396. #
  397. .UPL10
  398.         ask "enter remote filename or <RETURN> to upload to system", @remotefn
  399.         if null @remotefn goto .UPL20
  400. #-------------------------------------------------------------------------------
  401. # Send a Ctrl-Y (\031) to abort any application running on remote
  402. # Send a return to get the system prompt
  403. #-------------------------------------------------------------------------------
  404.         tsend "\031",cr
  405. #-------------------------------------------------------------------------------
  406. # Handle the most likely responses
  407. #-------------------------------------------------------------------------------
  408.         ttrap 5 "$"
  409.         if 0 return 1
  410. #
  411. #    If no remote filename given, assume file already open on receiving system
  412. #
  413. #-------------------------------------------------------------------------------
  414. # Send the operating system command to create a text file 
  415. #-------------------------------------------------------------------------------
  416.         tsend "create ",@remotefn,cr
  417. #-------------------------------------------------------------------------------
  418. # Delay a short while to allow the command get started (could also use "wait") 
  419. #-------------------------------------------------------------------------------
  420.         ttrap 2
  421. .UPL20
  422.         tupload @filename
  423. #-------------------------------------------------------------------------------
  424. # Delay a while to allow the remote system to get finished
  425. #-------------------------------------------------------------------------------
  426.         wait 2 idle
  427. #
  428.         if null @remotefn return 0
  429. #-------------------------------------------------------------------------------
  430. # Send the string to tell the remote operating system command that you're done
  431. #-------------------------------------------------------------------------------
  432.         tsend "\032"
  433. #-------------------------------------------------------------------------------
  434. # Handle the most likely responses
  435. #-------------------------------------------------------------------------------
  436.         ttrap 5 "$"
  437.         if 1 return 0
  438.         return 1
  439. #########################################
  440. #                                        #
  441. # TRANSFER                                #
  442. #                                        #
  443. #########################################
  444. .TRANSFER
  445. #
  446. # AutoPoll Screen display
  447. #
  448.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  449.         set @SCRLREG = "1"
  450.         cursor 13,0
  451.         put " "
  452.         cursor 13,0
  453.         put "--> "
  454.         cursor 13,15
  455.         put "Looking for operating system prompt"
  456.         set @SCRLREG = "0"
  457.     end
  458. #-------------------------------------------------------------------------------
  459. # Determine the number of times to attempt to get file transfer started
  460. #-------------------------------------------------------------------------------
  461.     reps 4
  462. #
  463. .TRANS10
  464. #-------------------------------------------------------------------------------
  465. # Send something that should elicit a response from the remote system
  466. #-------------------------------------------------------------------------------
  467.     tsend CR
  468. #-------------------------------------------------------------------------------
  469. # Handle the most likely responses.  Must include the strings sent by BLAST A,
  470. # B and C protocols (a string of p's or some part of the message
  471. # ";starting BLAST protocol."  Usually also includes: the system prompt and
  472. # application or system error messages - as below.
  473. #-------------------------------------------------------------------------------
  474.     ttrap 10 "$","protocol","ppp","%DCL-"
  475.     if @STATUS = "2" or @STATUS = "3" return 0
  476.     if @STATUS = "1" goto .TRANS20
  477.     if @STATUS = "4"
  478.         if @SCRFILE = "AutoPoll" fwrite 4, "                  * CHECK REMOTE SYSTEM - BLAST symbol incorrectly defined"
  479.         else goto .TRANS15
  480.         if @USERIF = "0" goto .TRANS15
  481. #
  482. # AutoPoll Screen display
  483. #
  484.         set @SCRLREG = "1"
  485.         cursor 13,15
  486.         put " "
  487.         cursor 13,15
  488.         put "CHECK REMOTE SYSTEM - BLAST symbol incorrectly defined"
  489.         cleol
  490.         set @SCRLREG = "0"
  491.     end
  492. .TRANS15
  493.     if reps
  494. #-------------------------------------------------------------------------------
  495. # Send a Ctrl-Q (\021) to try and restart output from remote system
  496. # Also send a Ctrl-Y (\031) to try and abort any application running on remote
  497. #-------------------------------------------------------------------------------
  498.         tsend "\021\031"
  499.         goto .TRANS10
  500.     end
  501. #
  502. #    Unable to get anything recognizable on remote computer - abort
  503. #
  504.     if @SCRFILE = "AutoPoll" fwrite 4, "                  >> CHECK REMOTE SYSTEM - Unable to get ",@SYSTYPE," system prompt after login"
  505.     else return 1
  506. #
  507. # AutoPoll Screen display
  508. #
  509.     if @USERIF = "1"
  510.         set @SCRLREG = "1"
  511.         cursor 13,0
  512.         put " "
  513.         cursor 13,0
  514.         put "  X "
  515.         cursor 13,15
  516.         put "CHECK REMOTE - System not responding in time"
  517.         cleol
  518.         set @SCRLREG = "0"
  519.     end
  520.     return -3
  521. .TRANS20
  522. #-------------------------------------------------------------------------------
  523. # Send the operating system command which will start BLAST in Host mode
  524. #-------------------------------------------------------------------------------
  525.     tsend "BLAST /H",CR               # invoke BLAST in host mode
  526. #
  527. # AutoPoll Screen display
  528. #
  529.     if @USERIF = "1" and @SCRFILE = "AutoPoll"
  530.         set @SCRLREG = "1"
  531.         cursor 13,15
  532.         put " "
  533.         cursor 13,15
  534.         put "Waiting for BLAST protocol"
  535.         cleol
  536.         set @SCRLREG = "0"
  537.     end
  538.     goto .TRANS10
  539. .END
  540.