home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / pibterm / pibt41e3.zip / SENDMLIN.SCR < prev    next >
Text File  |  1988-02-26  |  4KB  |  100 lines

  1. ***************************************************************************
  2. *    S E N D M L I N . S C R --- Script interfacing MLINK to PibTerm      *
  3. ***************************************************************************
  4. *                                                                         *
  5. *    Script:  SendMLin.Scr                                                *
  6. *                                                                         *
  7. *    Purpose: Interfaces external Megalink driver program MLINK.COM       *
  8. *             to PibTerm for sending files.                               *
  9. *                                                                         *
  10. *    Invocation:                                                          *
  11. *                                                                         *
  12. *       Execute "SendMLin"                                                *
  13. *                                                                         *
  14. *    Remarks:                                                             *
  15. *                                                                         *
  16. *       This script is designed to be automatically invoked by the        *
  17. *       <ALT>S command when MegaLink has been defined as an external      *
  18. *       protocol at <ALT>P, F)ile transfer, k) external file transfers.   *
  19. *                                                                         *
  20. ***************************************************************************
  21. *                                                                         *
  22. *                                  File spec for files to transfer
  23.    Declare FileSpec String
  24. *                                  Baud rate for transfer
  25.    Declare BaudRate String
  26. *                                  Comm port number
  27.    Declare Port     String
  28. *                                  Build MLink invocation line in this
  29.    Declare Mlink    String
  30. *                                  Host mode flag
  31.    Declare HostMode String
  32. *                                  Upload directory
  33.    Declare UpDir String
  34. *
  35. **************************************************************************
  36. *       StripPath --- procedure to strip path from file name             *
  37. **************************************************************************
  38. *
  39.    PROCEDURE StripPath
  40. *
  41.       Declare I  Integer
  42.       Declare L  Integer
  43.       Declare Ch String
  44. *
  45.       IF ( ( INDEX( '\' , FileSpec ) <> 0 ) OR ( INDEX( ':' , FileSpec ) <> 0 ) ) THEN
  46. *
  47.          L = LENGTH( FileSpec )
  48.          I = L
  49. *
  50.          REPEAT
  51.             I  = I - 1
  52.             Ch = Substr( FileSpec, I, 1 )
  53.          UNTIL ( ( Ch = '\' ) OR ( Ch = ':' ) )
  54. *
  55.          FileSpec = SUBSTR( FileSpec,  I + 1 , L - I )
  56. *
  57.       ENDIF
  58. *
  59.    ENDPROC   StripPath
  60. *
  61. **************************************************************************
  62. *                       SendMLin -- Main Routine                         *
  63. **************************************************************************
  64. *
  65. *                                  Find out if we're in host mode
  66. *
  67.    GetParam 'HP' HostMode
  68. *                                  Get port number
  69.    GetParam 'PO' Port
  70. *                                  Get baud rate
  71.    GetParam 'BA' BaudRate
  72. *                                  Get file spec
  73.    GetParam 'FN' FileSpec
  74. *                                  Get host mode directory, and
  75. *                                  prepend to file spec, after
  76. *                                  stripping any other directory spec.
  77.    IF ( HostMode = 'N' ) THEN
  78.       GetParam 'HD' UpDir
  79.       Call StripPath
  80.       Set FileSpec = CONCAT( UpDir , FileSpec )
  81.    ENDIF
  82. *                                  Build MLink invocation line
  83. *
  84.    Set Mlink = CONCAT( 'MLink port ' , Port )
  85.    Set Mlink = CONCAT( CONCAT( Mlink , ' speed '  ), BaudRate )
  86.    Set Mlink = CONCAT( CONCAT( Mlink , ' SM ' ), FileSpec )
  87. *
  88. *                                  Echo built line to screen
  89.    Writeln " "
  90.    Writeln "Invoking MLink as follows:"
  91.    Writeln Mlink
  92.    Writeln " "
  93. *                                  Echo Mlink line to capture file
  94. *
  95.    Writelog "Invoking MLink as follows:"
  96.    Writelog Mlink
  97. *                                  Call MLink
  98.    Dos Mlink
  99. *
  100.