home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / GETTRPRO.MOD < prev    next >
Text File  |  1987-12-26  |  4KB  |  103 lines

  1. (*----------------------------------------------------------------------*)
  2. (*          Get_Transfer_Protocol --- Get File Transfer Protocol        *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. FUNCTION Get_Transfer_Protocol( Direction : CHAR ) : Transfer_Type ;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Function:   Get_Transfer_Protocol                                *)
  10. (*                                                                      *)
  11. (*     Purpose:    Gets file name and transfer protocol.                *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Transtyp := Get_Transfer_Protocol( Direction : CHAR )         *)
  16. (*                    : Transfer_Type;                                  *)
  17. (*                                                                      *)
  18. (*     Calls:                                                           *)
  19. (*                                                                      *)
  20. (*----------------------------------------------------------------------*)
  21.  
  22. VAR
  23.    Transfer_Kind : Transfer_Type;
  24.    I             : INTEGER;
  25.    Get_FileName  : BOOLEAN;
  26.    AFile         : FILE;
  27.  
  28. BEGIN (* Get_Transfer_Protocol *)
  29.                                    (* Copy keyboard data before we screw *)
  30.                                    (* it up so we can get file name      *)
  31.  
  32.    Saved_Kbd_File_Name := Keyboard_Line;
  33.  
  34.                                    (* No file name yet *)
  35.    FileName            := '';
  36.                                    (* No protocol yet *)
  37.    Get_Transfer_Protocol := None;
  38.  
  39.                                    (* Display menu of transfer types *)
  40.                                    (* and get transfer kind.         *)
  41.  
  42.    Display_Transfer_Types( 'send', Transfer_Kind );
  43.  
  44.                                    (* Get file name to transfer *)
  45.  
  46.    Get_FileName := ( Transfer_Kind <> None );
  47.    IF ( Transfer_Kind = Kermit ) THEN
  48.       Get_FileName := FALSE;
  49.  
  50.    IF Get_FileName THEN
  51.       BEGIN
  52.  
  53.          GoToXY( 2 , 18 );
  54.          WRITE('Enter Filename.Ext: ');
  55.          GoToXY( 2 , 19 );
  56.          WRITE('>');
  57.          ClrEol;
  58.          IF Auto_Find_FileNames THEN
  59.             Get_Auto_File_Name( Saved_Kbd_File_Name , FileName );
  60.          Read_Edited_String(FileName);
  61.          WRITELN;
  62.  
  63.          IF ( LENGTH( FileName ) = 0 ) THEN
  64.             BEGIN
  65.                Restore_Screen_And_Colors( Saved_Screen );
  66.                EXIT;
  67.             END;
  68.  
  69.       END;
  70.                                    (* Check that file exists *)
  71.  
  72.    IF Single_File_Protocol[Transfer_Kind] THEN
  73.       BEGIN
  74.  
  75.          ASSIGN(AFile,FileName);
  76.             (*!I- *)
  77.          RESET(AFile);
  78.             (*!I+ *)
  79.  
  80.          IF ( Int24Result <> 0 ) THEN
  81.             BEGIN
  82.                Transfer_Kind := None;
  83.                WRITE('*** File not found, send cancelled ***');
  84.                Window_Delay;
  85.             END;
  86.  
  87.             (*!I-*)
  88.          CLOSE( AFile );
  89.             (*!I+*)
  90.  
  91.          I := Int24Result;
  92.  
  93.       END;
  94.                                    (* Remove this window            *)
  95.  
  96.    Restore_Screen_And_Colors( Saved_Screen );
  97.  
  98.                                    (* Return transfer protocol type *)
  99.  
  100.    Get_Transfer_Protocol := Transfer_Kind;
  101.  
  102. END   (* Get_Transfer_Protocol *);
  103.