INTEGER FUNCTION SINIT (X) C C **************************************************************** C C KERMIT for the MODCOMP MAXIV operating system C C Compliments of: C C SETPOINT, Inc. C 10245 Brecksville Rd. C Brecksville, Ohio 44141 C C C KERMIT is a copyrighted protocol of Columbia Univ. The authors C of this version hereby grant permission to copy this software C provided that it is not used for an explicitly commercial C purpose and that proper credit be given. SETPOINT, Inc. makes C no warranty whatsoever regarding the accuracy of this package C and will assume no liability resulting from it's use. C C **************************************************************** C C Abstract: Send an initial packet for the first connection C Tell the other Kermit what my parameters are. C C MODIFICATION HISTORY C C BY DATE REASON PROGRAMS AFFECTED C C **************************************************************** C C Author: Rick Burke Version: A.0 Date: Sep-86 C C Calling Parameters: C C R X - Dummy argument required by FORTRAN C C **************************************************************** C C Messages generated by this module : None C C **************************************************************** C C Subroutines called directly : DGETLI, MOD, PACK, POSUSL, C RPACK, RPAR, SCOPY, SPACK, C SPAR C C **************************************************************** C C Files referenced : None C C **************************************************************** C C Local variable definitions : C C FOUND - Flag indicating existing file name found C LEN - Length of received apcket C NUM - Number of received packet C SCRUFT - UFT of assigned to scratch partition C with list of files to be sent C STATUS - Status of received packet C TNUM - Number of transmitted packet C TEMP - Function value returned by DGETLI C TV1 - Temporary variable C TV2 - Temporary variable C ALIN(132) - File name buffer C C **************************************************************** C C Commons referenced : KER and KERPAR local commons C C **************************************************************** C C (*$END.DOCUMENT*) C C **************************************************************** C * * C * D I M E N S I O N S T A T E M E N T S * C * * C **************************************************************** C IMPLICIT INTEGER (A-Z) C INTEGER*2 ALIN(132), FNAM(4) C C **************************************************************** C * * C * T Y P E S T A T E M E N T S * C * * C **************************************************************** C LOGICAL*2 FOUND C C **************************************************************** C * * C * C O M M O N S T A T E M E N T S * C * * C **************************************************************** C INCLUDE USL/KERCOM INCLUDE USL/KERPMC INCLUDE USL/UFTTBC C C **************************************************************** C * * C * E Q U I V A L E N C E S T A T E M E N T S * C * * C **************************************************************** C C C **************************************************************** C * * C * D A T A S T A T E M E N T S * C * * C **************************************************************** C DATA SCRUFT /9/ C C **************************************************************** C C Code starts here : C C-----> Assume an error. C SINIT = BIGA C C-----> Check if maximum number of retries exceeded. C IF (NUMTRY .GT. MAXTRY) RETURN NUMTRY = NUMTRY+1 C C-----> Get my required parameters. C CALL SPAR (PACKET) C C-----> and send them to the remote. C TNUM = N TV1 = BIGS TV2 = 6 CALL SPACK (TV1,TNUM,TV2,PACKET) STATUS = RPACK (LEN,NUM,RECPKT) C C-----> Was the reply a NAK? Branch if not. C IF (STATUS .NE.BIGN) GO TO 10 IF (N .NE. NUM-1) SINIT = STATE RETURN 10 CONTINUE C C-----> Was the reply an ACK? Branch if not. C IF (STATUS .NE. BIGY) GO TO 60 IF (N .EQ. NUM) GO TO 20 SINIT = STATE RETURN 20 CONTINUE CALL RPAR (RECPKT) C C-----> Reset the retry counter and bump the packet number. C NUMTRY = 0 N = MOD (N+1,64) C C-----> Get a valid file name from the file list. C 30 CONTINUE SCRLUN = IUFT(2,SCRUFT) READ (SCRLUN,1000,END=70) FNAM 1000 FORMAT (4A2) CALL POSUSL (IUFT(2,7),FNAM,FOUND) IF (.NOT. FOUND) GO TO 30 DO 40 I=1,8 IWORD = FNAM((I+1)/2) IF (MOD(I,2) .NE. 0) FILNAM(I) = ISHFT (IWORD,-8) IF (MOD(I,2) .EQ. 0) FILNAM(I) = IAND (IWORD,4Z00FF) IF (FILNAM(I) .EQ. 0 .OR. > FILNAM(I) .EQ. BLANK ) GO TO 50 40 CONTINUE I = 9 50 CONTINUE FILNAM(I) = LF FILNAM(I+1) = EOS SINIT = BIGF RETURN 60 CONTINUE C C-----> Handle a checksum error or unexpected packet type. C IF (STATUS .EQ. BAD) SINIT = STATE RETURN 70 CONTINUE RETURN END