home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PIBTERM / PIBT41S1.ARC / GETUPLOA.MOD < prev    next >
Encoding:
Text File  |  1988-02-15  |  4.1 KB  |  115 lines

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