home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
modcomp
/
sfile.
< prev
next >
Wrap
Text File
|
2020-01-01
|
6KB
|
199 lines
INTEGER FUNCTION SFILE (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 the file name to the other Kermit
C
C MODIFICATION HISTORY
C
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 : BUFILL, MOD, PUTLIN, RPACK,
C SCOPY, SPACK
C
C ****************************************************************
C
C Files referenced : None
C
C ****************************************************************
C
C Local variable definitions :
C
C AONE - Index variable
C BONE - Index variable
C LEN - Length of file name
C NUM - Packet number of received data
C STATUS - Status of the recieved packet
C TNUM - Packet number of transmitted data
C TV1 - Temporary variable
C ALIN(132) - Line buffer for file name
C
C ****************************************************************
C
C Commons referenced : KER, KERPAR, and XBYTE 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)
C
C ****************************************************************
C * *
C * T Y P E S T A T E M E N T S *
C * *
C ****************************************************************
C
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
COMMON /XBYTE/ XNEW,XCOUNT,XLIN(132),XEOF
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
C
C ****************************************************************
C
C Code starts here :
C
C-----> Assume an error.
C
SFILE = BIGA
C
C------> Maximum no. of retries exceeded?
C
IF (NUMTRY .GT. MAXTRY) RETURN
NUMTRY = NUMTRY+1
C
C-----> Calculate the length of the file name.
C
LEN = 1
10 CONTINUE
IF (FILNAM(LEN) .EQ. EOS) GO TO 20
LEN = LEN + 1
GO TO 10
20 CONTINUE
LEN = LEN - 2
C
C-----> If we are running locally then display the file name.
C
IF (HOSTON .NE. NO .OR.
> NUMTRY .GT. 1 ) GO TO 30
DO 25 I=1,LEN
ALIN(I) = ISHFT (FILNAM(I),8)
25 CONTINUE
WRITE (LOCALO,1000) (ALIN(I),I=1,LEN)
1000 FORMAT (' SENDING FILE--> ',8A1)
WRITE (LOCALO,1010)
1010 FORMAT (/)
30 CONTINUE
C
C-----> Send the file name packet.
C
TNUM = N
TV1 = BIGF
CALL SPACK (TV1,TNUM,LEN,FILNAME)
STATUS = RPACK (LEN,NUM,RECPKT)
C
C-----> Branch if the packet was not NAKed.
C
IF (STATUS .NE. BIGN) GO TO 40
IF (N .EQ. NUM-1) RETURN
SFILE = STATE
RETURN
40 CONTINUE
C
C-----> Branch if the packet was not ACKed.
C
IF (STATUS .NE. BIGY) GO TO 60
C
C-----> Branch if packet number was OK.
C
IF (N .EQ. NUM) GO TO 50
SFILE = STATE
RETURN
50 CONTINUE
C
C-----> Reset retry counter and bump packet number.
C
NUMTRY = 0
N = MOD (N+1,64)
C
C-----> Get ready to begin sending the data.
C
XNEW = YES
XCOUNT = 1
XEOF = NO
CALL CMRI4 (IUFT(2,7),40)
SIZE = BUFILL (PACKET)
IF (SIZE .EQ. EOF) RETURN
SFILE = BIGD
RETURN
60 CONTINUE
C
C-----> Handle a checksum error or unexpected packet type.
C
IF (STATUS .EQ. BAD) SFILE = STATE
RETURN
END