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

  1.       INTEGER FUNCTION SINIT (X)
  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 an initial packet for the first connection
  24. C                Tell the other Kermit what my parameters are.
  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: Sep-86
  33. C
  34. C     Calling Parameters:
  35. C
  36. C     R    X            - Dummy argument required by FORTRAN
  37. C
  38. C     ****************************************************************
  39. C
  40. C     Messages generated by this module :  None
  41. C
  42. C     ****************************************************************
  43. C
  44. C     Subroutines called directly : DGETLI, MOD, PACK, POSUSL,
  45. C                                   RPACK, RPAR, SCOPY, SPACK,
  46. C                                   SPAR
  47. C
  48. C     ****************************************************************
  49. C
  50. C     Files referenced :  None
  51. C
  52. C     ****************************************************************
  53. C
  54. C     Local variable definitions :
  55. C
  56. C     FOUND        - Flag indicating existing file name found
  57. C     LEN          - Length of received apcket
  58. C     NUM          - Number of received packet
  59. C     SCRUFT       - UFT of assigned to scratch partition
  60. C                    with list of files to be sent
  61. C     STATUS       - Status of received packet
  62. C     TNUM         - Number of transmitted packet
  63. C     TEMP         - Function value returned by DGETLI
  64. C     TV1          - Temporary variable
  65. C     TV2          - Temporary variable
  66. C     ALIN(132)    - File name buffer
  67. C
  68. C     ****************************************************************
  69. C
  70. C     Commons referenced :  KER and KERPAR local commons
  71. C
  72. C     ****************************************************************
  73. C
  74. C     (*$END.DOCUMENT*)
  75. C
  76. C     ****************************************************************
  77. C     *                                                              *
  78. C     *         D I M E N S I O N   S T A T E M E N T S              *
  79. C     *                                                              *
  80. C     ****************************************************************
  81. C
  82.       IMPLICIT INTEGER (A-Z)
  83. C
  84.       INTEGER*2 ALIN(132),     FNAM(4)
  85. C
  86. C     ****************************************************************
  87. C     *                                                              *
  88. C     *         T Y P E   S T A T E M E N T S                        *
  89. C     *                                                              *
  90. C     ****************************************************************
  91. C
  92.       LOGICAL*2 FOUND
  93. C
  94. C     ****************************************************************
  95. C     *                                                              *
  96. C     *         C O M M O N   S T A T E M E N T S                    *
  97. C     *                                                              *
  98. C     ****************************************************************
  99. C
  100.       INCLUDE USL/KERCOM
  101.       INCLUDE USL/KERPMC
  102.       INCLUDE USL/UFTTBC
  103. C
  104. C     ****************************************************************
  105. C     *                                                              *
  106. C     *         E Q U I V A L E N C E   S T A T E M E N T S          *
  107. C     *                                                              *
  108. C     ****************************************************************
  109. C
  110. C
  111. C     ****************************************************************
  112. C     *                                                              *
  113. C     *         D A T A   S T A T E M E N T S                        *
  114. C     *                                                              *
  115. C     ****************************************************************
  116. C
  117.       DATA        SCRUFT /9/
  118. C
  119. C     ****************************************************************
  120. C
  121. C     Code starts here :
  122. C
  123. C----->  Assume an error.
  124. C
  125.       SINIT = BIGA
  126. C
  127. C----->  Check if maximum number of retries exceeded.
  128. C
  129.       IF (NUMTRY .GT. MAXTRY) RETURN
  130.       NUMTRY = NUMTRY+1
  131. C
  132. C----->  Get my required parameters.
  133. C
  134.       CALL SPAR (PACKET)
  135. C
  136. C----->  and send them to the remote.
  137. C
  138.       TNUM = N
  139.       TV1 = BIGS
  140.       TV2 = 6
  141.       CALL SPACK (TV1,TNUM,TV2,PACKET)
  142.       STATUS = RPACK (LEN,NUM,RECPKT)
  143. C
  144. C----->  Was the reply a NAK?  Branch if not.
  145. C
  146.       IF (STATUS .NE.BIGN) GO TO 10
  147.       IF (N .NE. NUM-1) SINIT = STATE
  148.       RETURN
  149.    10 CONTINUE
  150. C
  151. C----->  Was the reply an ACK?  Branch if not.
  152. C
  153.       IF (STATUS .NE. BIGY) GO TO 60
  154.       IF (N .EQ. NUM) GO TO 20
  155.       SINIT = STATE
  156.       RETURN
  157.    20 CONTINUE
  158.       CALL RPAR (RECPKT)
  159. C
  160. C----->  Reset the retry counter and bump the packet number.
  161. C
  162.       NUMTRY = 0
  163.       N = MOD (N+1,64)
  164. C
  165. C----->  Get a valid file name from the file list.
  166. C
  167.    30 CONTINUE
  168.       SCRLUN = IUFT(2,SCRUFT)
  169.       READ (SCRLUN,1000,END=70) FNAM
  170.  1000 FORMAT (4A2)
  171.       CALL POSUSL (IUFT(2,7),FNAM,FOUND)
  172.       IF (.NOT. FOUND) GO TO 30
  173.       DO 40 I=1,8
  174.       IWORD = FNAM((I+1)/2)
  175.       IF (MOD(I,2) .NE. 0) FILNAM(I) = ISHFT (IWORD,-8)
  176.       IF (MOD(I,2) .EQ. 0) FILNAM(I) = IAND (IWORD,4Z00FF)
  177.       IF (FILNAM(I) .EQ.     0 .OR.
  178.      >    FILNAM(I) .EQ. BLANK     ) GO TO 50
  179.    40 CONTINUE
  180.       I = 9
  181.    50 CONTINUE
  182.       FILNAM(I) = LF
  183.       FILNAM(I+1) = EOS
  184.       SINIT = BIGF
  185.       RETURN
  186.    60 CONTINUE
  187. C
  188. C----->  Handle a checksum error or unexpected packet type.
  189. C
  190.       IF (STATUS .EQ. BAD) SINIT = STATE
  191.       RETURN
  192.    70 CONTINUE
  193.       RETURN
  194.       END
  195.