home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s2.arc / MAKETELE.MOD < prev    next >
Text File  |  1987-12-02  |  4KB  |  85 lines

  1. (*----------------------------------------------------------------------*)
  2. (*          Make_Telink_Header --- Send special TELINK header block     *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Make_Telink_Header( File_Entry : SearchRec );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*       Procedure:  Make_Telink_Header                                 *)
  10. (*                                                                      *)
  11. (*       Purpose:    Makes special TELINK header block                  *)
  12. (*                                                                      *)
  13. (*       Calling sequence:                                              *)
  14. (*                                                                      *)
  15. (*          Make_Telink_Header( File_Entry : SearchRec );               *)
  16. (*                                                                      *)
  17. (*       Calls:  None                                                   *)
  18. (*                                                                      *)
  19. (*       Remarks:                                                       *)
  20. (*                                                                      *)
  21. (*          The Telink header block is ALWAYS sent in Checksum mode,    *)
  22. (*          regardless of whether or not the files are to be sent in    *)
  23. (*          CRC or checksum mode.                                       *)
  24. (*                                                                      *)
  25. (*          Format of Telink/SeaLink block 0:                           *)
  26. (*                                                                      *)
  27. (*             Bytes         Contents                                   *)
  28. (*             -----       ---------------------------------------      *)
  29. (*                                                                      *)
  30. (*               1           SYN (SOH for SeaLink)                      *)
  31. (*               2             0                                        *)
  32. (*               3           255                                        *)
  33. (*              4-7          File size in MS DOS directory form         *)
  34. (*              8-9          Creation date in MS DOS form               *)
  35. (*             10-11         Creation time in MS DOS form               *)
  36. (*             12-27         Name of file in 'name.ext' form            *)
  37. (*              28           Version number (always zero here)          *)
  38. (*             29-44         PIBTERM  -- sending program's name         *)
  39. (*             45-131        All zeroes                                 *)
  40. (*              132          Checksum of block                          *)
  41. (*                                                                      *)
  42. (*          The first three bytes and the checksum are added later by   *)
  43. (*          the Xmodem send routine.  The rest are constructed here.    *)
  44. (*                                                                      *)
  45. (*----------------------------------------------------------------------*)
  46.  
  47. VAR
  48.    I            : INTEGER;
  49.    J            : INTEGER;
  50.    L            : INTEGER;
  51.    CheckSum     : INTEGER;
  52.    ACK_Ok       : BOOLEAN;
  53.    Int_Ch       : INTEGER;
  54.    C            : STRING[1];
  55.  
  56. BEGIN (* Make_Telink_Header *)
  57.                                    (* Zero out block *)
  58.    FOR I := 1 TO 130 DO
  59.       Sector_Data[I] := 0;
  60.                                    (* File size in 32-bit MS DOS form *)
  61.  
  62.    MOVE( File_Entry.Size , Sector_Data[1], 4 );
  63.  
  64.                                    (* Creation time/date in MS DOS form *)
  65.  
  66.    MOVE( File_Entry.Time , Sector_Data[5], 4 );
  67.  
  68.                                    (* File name *)
  69.    L := LENGTH( File_Entry.Name );
  70.  
  71.    FOR J := 1 TO L DO
  72.       Sector_Data[J+8] := ORD( File_Entry.Name[J] );
  73.  
  74.    FOR I := L TO 16 DO
  75.       Sector_Data[I+8] := ORD(' ');
  76.  
  77.                                    (* Sending program's name *)
  78.    FOR I := 1 TO 16 DO
  79.       BEGIN
  80.          C                 := COPY( 'PIBTERM         ', I, 1 );
  81.          Sector_Data[I+25] := ORD( C[1] );
  82.       END;
  83.  
  84. END   (* Make_Telink_Header *);
  85.