home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / modcomp / ssend. < prev    next >
Text File  |  2020-01-01  |  10KB  |  311 lines

  1.       SUBROUTINE SSEND (ALIN)
  2. C
  3. C     ****************************************************************
  4. C
  5. C              KERMIT for the MODCOMP MAXIV operating system
  6. C
  7. C        Compliments of:
  8. C
  9. C                         SETPOINT, Inc.
  10. C                      10245 Brecksville Rd.
  11. C                      Brecksville, Ohio 44141
  12. C
  13. C
  14. C      KERMIT is a copyrighted protocol of Columbia Univ. The authors
  15. C      of this version hereby grant permission to copy this software
  16. C      provided that it is not used for an explicitly commercial
  17. C      purpose and that proper credit be given. SETPOINT, Inc. makes
  18. C      no warranty whatsoever regarding the accuracy of this package
  19. C      and will assume no liability resulting from it's use.
  20. C
  21. C     ****************************************************************
  22. C
  23. C     Abstract:  Send a file or group of files to a remote Kermit.
  24. C
  25. C
  26. C     MODIFICATION HISTORY
  27. C
  28. C     BY            DATE     REASON            PROGRAMS AFFECTED
  29. C
  30. C     ****************************************************************
  31. C
  32. C     Author:  Rick Burke           Version: A.0    Date: Aug-86
  33. C
  34. C     Calling Parameters:
  35. C
  36. C     R    ALIN         - Command line with name of file or group
  37. C                         of files to be sent.
  38. C
  39. C     ****************************************************************
  40. C
  41. C     Messages generated by this module :  None
  42. C
  43. C     ****************************************************************
  44. C
  45. C     Subroutines called directly :  ASSGN4, CTA4, ISCAN, ISHFT
  46. C                                    PACK, POSUSL, READ4, REW4,
  47. C                                    SENDSW, SKIPBL, WAIT, WEOF4
  48. C
  49. C     ****************************************************************
  50. C
  51. C     Files referenced :  None
  52. C
  53. C     ****************************************************************
  54. C
  55. C     Local variable definitions :
  56. C
  57. C     A1           - Character pointer into ALIN
  58. C     BEGENT       - Index to 1st entry in directory sector
  59. C     BKPTR        - Pointer to previous sector
  60. C     CH           - UFT number for directory reads
  61. C     ERR          - Error indicator for CTA4
  62. C     FILEOK       - Success flag from POSUSL, file was found
  63. C     FRPTR        - Forward pointer to next directory sector
  64. C     I            - Index variable
  65. C     IDX          - Index variable
  66. C     IND          - Error indicator from WAIT call
  67. C     JUSL         - CAN code of directory name to be sent to
  68. C                    the remote Kermit
  69. C     MXENT        - Number of directory entries per sector
  70. C     SCRLUN       - LUN of file for file name list
  71. C     SCRUFT       - UFT number of file to be used for temporary
  72. C                    storage of file names to be sent to remote
  73. C     SECTOR       - Directory partition file position index to read
  74. C     STATUS       - Function value returned by SENDSW
  75. C     TCOUNT       - Index variable
  76. C     X            - Dummy argument required by SENDSW function
  77. C     DIRBUF(128)  - Buffer for directory sector
  78. C     DIRNAM(132)  - Buffer for ASCII name of directory to send
  79. C     ENTRY(9,14)  - Table of directory entries for a sector
  80. C     FILNME(4)    - ASCII file name (packed 2 chars per word)
  81. C     TLINE(12)    - File name buffer (unpacked ASCII)
  82. C
  83. C     ****************************************************************
  84. C
  85. C     Commons referenced :  KER, KERPAR, and UFTTBL local commons
  86. C
  87. C     ****************************************************************
  88. C
  89. C     (*$END.DOCUMENT*)
  90. C
  91. C     ****************************************************************
  92. C     *                                                              *
  93. C     *         D I M E N S I O N   S T A T E M E N T S              *
  94. C     *                                                              *
  95. C     ****************************************************************
  96. C
  97.       IMPLICIT INTEGER (A-Z)
  98.       INTEGER*2   ALIN(1),     DIRNAM(132), ENTRY(9,14), DIRBUF(128)
  99.       INTEGER*2   FILNME(4),   TLINE(12)
  100. C
  101. C     ****************************************************************
  102. C     *                                                              *
  103. C     *         T Y P E   S T A T E M E N T S                        *
  104. C     *                                                              *
  105. C     ****************************************************************
  106. C
  107.       LOGICAL*2   FILEOK
  108. C
  109. C     ****************************************************************
  110. C     *                                                              *
  111. C     *         C O M M O N   S T A T E M E N T S                    *
  112. C     *                                                              *
  113. C     ****************************************************************
  114. C
  115.       INCLUDE USL/KERCOM
  116.       INCLUDE USL/KERPMC
  117.       INCLUDE USL/UFTTBC
  118. C
  119. C     ****************************************************************
  120. C     *                                                              *
  121. C     *         E Q U I V A L E N C E   S T A T E M E N T S          *
  122. C     *                                                              *
  123. C     ****************************************************************
  124. C
  125.       EQUIVALENCE (DIRBUF(1),BKPTR),        (DIRBUF(2),FRPTR)
  126.       EQUIVALENCE (DIRBUF(3),ENTRY(1,1))
  127. C
  128. C     ****************************************************************
  129. C     *                                                              *
  130. C     *         D A T A   S T A T E M E N T S                        *
  131. C     *                                                              *
  132. C     ****************************************************************
  133. C
  134.       DATA        MXENT /14/,  SCRUFT / 9/
  135. C
  136. C     ****************************************************************
  137. C
  138. C     Code starts here :
  139. C
  140. C----->  If we're in HOST mode, issue binary READ.
  141. C
  142.       IF (HOSTON .NE. YES) GO TO 5
  143.       CURCHN = 1
  144.       CALL READ4 (IUFT(1,4),BLIN(1,CURCHN),132,.FALSE.)
  145.     5 CONTINUE
  146. C
  147. C----->  Initialize the logical unit for the file name list.
  148. C
  149.       SCRLUN = IUFT(2,SCRUFT)
  150. C
  151. C----->  Position character pointer to start of file specification.
  152. C
  153.       A1 = 1
  154.       CALL SKIPBL(ALIN,A1)
  155.       IF (ALIN(A1) .NE. LF) GO TO 10
  156.       WRITE (LOCALO,1000)
  157.  1000 FORMAT (' PROPER FORMAT IS "SEND FILENAME" OR ',/
  158.      >        ' "SEND @FILENAME"')
  159.       RETURN
  160.    10 CONTINUE
  161. C
  162. C----->  Check for "@" as next character.  If so then the request is
  163. C----->  to send an entire directory of files.
  164. C
  165.       IF (ALIN(A1) .NE. ATSIGN) GO TO 90
  166.       A1 = A1 + 1
  167. C
  168. C----->  Extract the directory name from the command line and
  169. C----->  convert it to CAN code.
  170. C
  171.       DIRNAM(1) = 4Z2020
  172.       DIRNAM(2) = 4Z2020
  173.       DIRNAM(3) = 4Z2020
  174.       CALL PACK (ALIN(A1),DIRNAM)
  175.       JUSL = ISCAN (DIRNAM)
  176. C
  177. C----->  Set up the UFT for reading the directory.
  178. C
  179.       CH = 7
  180.       IUFT(3,CH) = 4Z9400
  181.       CALL ASSGN4 (IUFT(1,CH),JUSL)
  182. C
  183. C----->  Rewind the scratch file that will contain the names of the
  184. C----->  files to be sent.
  185. C
  186.       CALL REW4 (IUFT(1,SCRUFT))
  187. C
  188. C----->  Read a directory and put the file names into the scratch file.
  189. C
  190.       FRPTR = 0
  191.    20 CONTINUE
  192.       IUFT(4,CH) = FRPTR
  193.       SECTOR = FRPTR
  194.       CALL READ4 (IUFT(1,CH),DIRBUF,256)
  195.       IF (SECTOR .NE. 0) GO TO 30
  196. C
  197. C----->  Was the directory found?
  198. C
  199.       IF (BKPTR .EQ. -1) GO TO 30
  200.       WRITE (1,1010) (DIRNAM(I),I=1,4)
  201.  1010 FORMAT (' DIRECTORY NOT FOUND ON ',3A2)
  202.       RETURN
  203. C
  204. C----->  Loop through this sector to find a file entry.
  205. C
  206.    30 CONTINUE
  207.       BEGENT = 1
  208.       IF (SECTOR .EQ. 0) BEGENT = 2
  209.       DO 40 IDX=BEGENT,MXENT
  210.       IF (ENTRY(1,IDX) .NE.      0 .AND.
  211.      >    ENTRY(1,IDX) .NE. 4ZFEFE      ) GO TO 50
  212.    40 CONTINUE
  213. C
  214. C----->  Entry not found, go read the next sector unless this
  215. C----->  sector was the last (FRPTR = -1).
  216. C
  217.       IF (FRPTR .LT. 0) GO TO 80
  218.       GO TO 20
  219.    50 CONTINUE
  220.       IF (ENTRY(1,IDX) .EQ. 4ZFFFF) GO TO 80
  221.       IF (ENTRY(1,IDX) .EQ.      0 .OR.
  222.      >    ENTRY(1,IDX) .EQ. 4ZFEFE     ) GO TO 75
  223. C
  224. C----->  Got a file entry, so convert the file
  225. C----->  name into the unpacked ASCII string for
  226. C----->  DPUTLIN.
  227. C
  228.       CALL CTA4 (ENTRY(1,IDX),TLINE(1),ERR)
  229.       CALL CTA4 (ENTRY(2,IDX),TLINE(4),ERR)
  230.       CALL CTA4 (ENTRY(3,IDX),TLINE(7),ERR)
  231.       DO 55 I=1,9
  232.       TLINE(I) = ISHFT (TLINE(I),-8)
  233.    55 CONTINUE
  234. C
  235. C----->  Remove trailing blanks.
  236. C
  237.       DO 60 I=1,9
  238.       TCOUNT = 10 - I
  239.       IF (TLINE(TCOUNT) .NE.     0 .AND.
  240.      >    TLINE(TCOUNT) .NE. BLANK      ) GO TO 70
  241.    60 CONTINUE
  242.       TCOUNT = 0
  243.    70 CONTINUE
  244. C
  245. C----->  Add CR/EOS at the end.
  246. C
  247.       TLINE(TCOUNT+1) = LF
  248.       TLINE(TCOUNT+2) = EOS
  249. C
  250. C----->  Write the file name out to the scratch file.
  251. C
  252.       FILNME(1) = '  '
  253.       FILNME(2) = '  '
  254.       FILNME(3) = '  '
  255.       FILNME(4) = '  '
  256.       CALL PACK (TLINE,FILNME)
  257.       WRITE (SCRLUN,1050) FILNME
  258.  1050 FORMAT (4A2)
  259.    75 CONTINUE
  260. C
  261. C----->  Loop back to get another file name.
  262. C
  263.       IDX = IDX + 1
  264.       IF (IDX .LE. MXENT) GO TO 50
  265.       GO TO 20
  266.    80 CONTINUE
  267. C
  268. C----->  Write an EOF after the last name in the scratch partition.
  269. C
  270.       CALL WEOF4 (IUFT(1,SCRUFT))
  271.       GO TO 110
  272.    90 CONTINUE
  273. C
  274. C----->  Write the file name in the command line to the scratch
  275. C----->  partition.
  276. C
  277. C----->  First, try to position to the file.
  278. C
  279.       CH = 7
  280.       CALL ASSGN4 (IUFT(1,CH),SUSL)
  281.       FILNME(1) = '  '
  282.       FILNME(2) = '  '
  283.       FILNME(3) = '  '
  284.       FILNME(4) = '  '
  285.       CALL PACK (ALIN(A1),FILNME)
  286.       CALL POSUSL (IUFT(2,CH),FILNME,FILEOK)
  287.       IF (FILEOK) GO TO 100
  288.       WRITE (LOCALO,1020)
  289.  1020 FORMAT (' REQUESTED SOURCE FILE NOT FOUND.',//)
  290.       RETURN
  291.   100 CONTINUE
  292. C
  293. C----->  Put the file name at the beginning of the scratch.
  294. C
  295.       CALL REW4 (IUFT(1,SCRUFT))
  296.       WRITE (SCRLUN,1050) FILNME
  297.       CALL WEOF4 (IUFT(1,SCRUFT))
  298.   110 CONTINUE
  299. C
  300. C----->  Send the file(s) to the remote Kermit.
  301. C
  302.       CALL REW4 (IUFT(1,SCRUFT))
  303.       CALL WAIT (DELAY,2,IND)
  304.       STATUS = SENDSW (X)
  305.       IF (STATUS .EQ. YES) WRITE (LOCALO,1030)
  306.  1030 FORMAT (' FILE TRANSFER COMPLETED.',//)
  307.       IF (STATUS .NE. YES) WRITE (LOCALO,1040)
  308.  1040 FORMAT (' FILE TRANSFER FAILED.',//)
  309.       RETURN
  310.       END
  311.