home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / bbs / pibterm / pibt3sp2 / pibhosta.pas < prev    next >
Pascal/Delphi Source File  |  1985-10-03  |  57KB  |  1,245 lines

  1. OVERLAY PROCEDURE Emulate_Host;
  2.  
  3. (*----------------------------------------------------------------------*)
  4. (*               PibHost --- Host mode (mini-BBS) for PibTerm           *)
  5. (*----------------------------------------------------------------------*)
  6. (*                                                                      *)
  7. (*  Author:   Philip R. Burns                                           *)
  8. (*  Date:     July, 1985                                                *)
  9. (*  Version:  1.0  (July, 1985)                                         *)
  10. (*            1.1  (July, 1985)                                         *)
  11. (*            1.2  (August, 1985)                                       *)
  12. (*            2.0  (August, 1985)                                       *)
  13. (*            3.0  (October, 1985)                                      *)
  14. (*                                                                      *)
  15. (*  Systems:  For MS-DOS on IBM PCs and close compatibles only.         *)
  16. (*            Note:  I have checked these on Zenith 151s under          *)
  17. (*                   MSDOS 2.1 and IBM PCs under PCDOS 2.0.             *)
  18. (*                                                                      *)
  19. (*  Overview: This overlay provides a simple host mode for use with     *)
  20. (*            PibTerm.  Facilities are provided for message leaving     *)
  21. (*            and file transfer.  This code can be used as a very       *)
  22. (*            simple remote bulletin board.  However, it lacks the      *)
  23. (*            security provisions needed for a genuine BBS, and is      *)
  24. (*            really intended to cover the need for a simple remote     *)
  25. (*            facility for a small private group of users.              *)
  26. (*                                                                      *)
  27. (*  Use:      This code assumes a Hayes-compatible modem.  You may need *)
  28. (*            to modify the code if your modem doesn't return verbal    *)
  29. (*            codes sufficient to determine the baud rate of the caller.*)
  30. (*            The modem is assumed to be set to answer the phone        *)
  31. (*            automatically.                                            *)
  32. (*                                                                      *)
  33. (*            To invoke host mode after entering PibTerm, enter Alt-W.  *)
  34. (*                                                                      *)
  35. (*            If you want the remote session echoed to the printer or   *)
  36. (*            captured to disk, then use the Alt-L and Alt-O commands   *)
  37. (*            before using Alt-W to invoke host mode.                   *)
  38. (*                                                                      *)
  39. (*            The following files are required above those normally     *)
  40. (*            used with PibTerm:                                        *)
  41. (*                                                                      *)
  42. (*              PIBTERM.USF  --- the user file.  A simple text file     *)
  43. (*                               containing the first name, last name,  *)
  44. (*                               and password for each authorized user. *)
  45. (*                               This file can be created using any     *)
  46. (*                               text editor that produces ascii files. *)
  47. (*                               The format is simply:                  *)
  48. (*                                                                      *)
  49. (*                                  firstname;lastname;password         *)
  50. (*                                                                      *)
  51. (*                               i.e., semicolons separating the first  *)
  52. (*                               name, last name, and password.         *)
  53. (*                                                                      *)
  54. (*                               This file MUST be created outside of   *)
  55. (*                               PibTerm;  there are no provisions for  *)
  56. (*                               a remote caller to get added to the    *)
  57. (*                               user file.                             *)
  58. (*                                                                      *)
  59. (*              PIBTERM.MSG ---  The message file.  This file is also   *)
  60. (*                               a simple ascii text file.  Message     *)
  61. (*                               header information is flagged by '=='  *)
  62. (*                               in columns one and two.  The end of a  *)
  63. (*                               message is marked by '== End' in       *)
  64. (*                               column one.  This file will be created *)
  65. (*                               by PibTerm if it doesn't exist when a  *)
  66. (*                               host session requires its presence.    *)
  67. (*                                                                      *)
  68. (*                               To remove messages, use a text editor  *)
  69. (*                               and just delete the header lines and   *)
  70. (*                               text for a message.  There are no      *)
  71. (*                               provisions for deleting messages       *)
  72. (*                               remotely.                              *)
  73. (*                                                                      *)
  74. (*              PIBTERM.XFR ---  The file transfer list.  This file     *)
  75. (*                               contains a list of files which may be  *)
  76. (*                               downloaded by a remote user.  Files    *)
  77. (*                               NOT on the transfer list cannot be     *)
  78. (*                               downloaded.                            *)
  79. (*                                                                      *)
  80. (*                               Also, a file with the same name as a   *)
  81. (*                               file on this list cannot be uploaded   *)
  82. (*                               by a remote user.  Further, any file   *)
  83. (*                               with PIBTERM as part of the name       *)
  84. (*                               can't be transferred, to prevent       *)
  85. (*                               a remote user from downloading the     *)
  86. (*                               user or comments files.                *)
  87. (*                                                                      *)
  88. (*                               The easiest way to create this file is *)
  89. (*                               to execute the DOS command:            *)
  90. (*                                                                      *)
  91. (*                                  DIR >PIBTERM.XFR                    *)
  92. (*                                                                      *)
  93. (*                               and then edit the resulting file using *)
  94. (*                               a text editor to remove unneeded lines *)
  95. (*                               and get the file names into 'name.ext' *)
  96. (*                               form as required by PibTerm.           *)
  97. (*                                                                      *)
  98. (*              PIBTERM.CMT ---  private comments file -- only readable *)
  99. (*                               by you.  The format is the same as the *)
  100. (*                               message file.                          *)
  101. (*                                                                      *)
  102. (*              PIBTERM.LOG ---  log file telling who logged on and     *)
  103. (*                               when they logged off.                  *)
  104. (*                                                                      *)
  105. (*            Note that all these files are simple sequential ascii     *)
  106. (*            files. This implies that they should be kept small for    *)
  107. (*            reasonable performance -- which is fine for a small group *)
  108. (*            of users.  This implementation does not provide good      *)
  109. (*            performance for a large group of users;  if you need that,*)
  110. (*            you should obtain a real BBS program designed to handle   *)
  111. (*            large numbers of users.                                   *)
  112. (*                                                                      *)
  113. (*                                                                      *)
  114. (*----------------------------------------------------------------------*)
  115. (*                                                                      *)
  116. (*                            Restriction                               *)
  117. (*                            -----------                               *)
  118. (*                                                                      *)
  119. (*           You may use this code only for NON COMMERCIAL purposes     *)
  120. (*           unless you explicitly obtain my permission.  I take a dim  *)
  121. (*           view of others making money on my work and those of other  *)
  122. (*           people whose code I've inserted here.                      *)
  123. (*                                                                      *)
  124. (*           Please feel free to add new features.  I wrote this        *)
  125. (*           program to give people a useful and usable basic terminal  *)
  126. (*           facility, and to show how Turbo Pascal can be used for     *)
  127. (*           asynchronous communications, menu display, windowing, and  *)
  128. (*           so on.  I hope that you find this program useful -- and,   *)
  129. (*           if you expand upon it, please upload your extensions so    *)
  130. (*           that all of us can enjoy them!                             *)
  131. (*                                                                      *)
  132. (*----------------------------------------------------------------------*)
  133. (*                                                                      *)
  134. (*           Suggestions for improvements or corrections are welcome.   *)
  135. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145  *)
  136. (*           or Ron Fox's BBS (312) 940 6496.                           *)
  137. (*                                                                      *)
  138. (*----------------------------------------------------------------------*)
  139.  
  140. (*----------------------------------------------------------------------*)
  141. (*                    Global host mode variables                        *)
  142. (*----------------------------------------------------------------------*)
  143.  
  144. CONST
  145.    MaxUsers      = 15              (* Maximum number of users supported *);
  146.    Page_Size     = 23              (* No. lines per screen for display  *);
  147.    Max_Login_Try = 3               (* Max. number of tries for login    *);
  148.  
  149. TYPE                               (* Information about a user *)
  150.  
  151.    User_Record = RECORD
  152.                     First_Name: STRING[20];
  153.                     Last_Name : STRING[20];
  154.                     Password  : STRING[10];
  155.                  END;
  156.  
  157. VAR
  158.  
  159.    Done           : BOOLEAN        (* If session complete        *);
  160.    Really_Done    : BOOLEAN        (* To leave host mode         *);
  161.  
  162.    Kbd_Input      : BOOLEAN        (* Input found at host keybrd *);
  163.    Fname          : ShortStr       (* First name of caller       *);
  164.    Lname          : ShortStr       (* Last name of caller        *);
  165.    PassWord       : ShortStr       (* Password to access system  *);
  166.    First_Time     : BOOLEAN        (* If first time host mode up *);
  167.    Recipient_Name : AnyStr         (* Name for message reception *);
  168.    Message_Subject: AnyStr         (* Subject of message         *);
  169.    Message_Line   : AnyStr         (* Text line for message      *);
  170.  
  171.    CR_LF_Host     : STRING[2]      (* CR or CR+LF                *);
  172.    Expert_On      : BOOLEAN        (* TRUE to use short menus    *);
  173.  
  174.    User_File      : Text_File      (* Password file              *);
  175.    Message_File   : Text_File      (* Message file               *);
  176.    Comments_File  : Text_File      (* Comments file              *);
  177.    Log_File       : Text_File      (* Log file                   *);
  178.  
  179.                                    (* User list *)
  180.  
  181.    User_List      : ARRAY[1 .. MaxUsers] OF User_Record;
  182.  
  183.    NUsers         : INTEGER        (* Number of active users *);
  184.  
  185.    Cur_User       : INTEGER        (* Current user           *);
  186.    Cur_User_Name  : AnyStr         (* Current user's name    *);
  187.  
  188.    NMessages      : INTEGER        (* Number of messages     *);
  189.  
  190.    Local_Host     : BOOLEAN        (* TRUE if local host session *);
  191.    Host_Section   : CHAR           (* Which section are we in?   *);
  192.  
  193. (*----------------------------------------------------------------------*)
  194. (*        Host_Carrier_Detect --- Check for carrier or local mode       *)
  195. (*----------------------------------------------------------------------*)
  196.  
  197. FUNCTION Host_Carrier_Detect : BOOLEAN;
  198.  
  199. (*----------------------------------------------------------------------*)
  200. (*                                                                      *)
  201. (*     Function:  Host_Carrier_Detect                                   *)
  202. (*                                                                      *)
  203. (*     Purpose:   Reports on carrier detect/local host mode status      *)
  204. (*                                                                      *)
  205. (*     Calling sequence:                                                *)
  206. (*                                                                      *)
  207. (*        Carrier := Host_Carrier_Detect : BOOLEAN;                     *)
  208. (*                                                                      *)
  209. (*           Carrier --- set TRUE if local host session, or if          *)
  210. (*                       carrier detected for remote session.           *)
  211. (*                                                                      *)
  212. (*----------------------------------------------------------------------*)
  213.  
  214. BEGIN (* Host_Carrier_Detect *)
  215.  
  216.    Host_Carrier_Detect := FALSE;
  217.  
  218.    IF Local_Host THEN
  219.       Host_Carrier_Detect := TRUE
  220.    ELSE
  221.       Host_Carrier_Detect := Async_Carrier_Detect;
  222.  
  223. END   (* Host_Carrier_Detect *);
  224.  
  225. (*----------------------------------------------------------------------*)
  226. (*        Host_Send  ---  Send character to port/screen in host mode    *)
  227. (*----------------------------------------------------------------------*)
  228.  
  229. PROCEDURE Host_Send( Ch : CHAR );
  230.  
  231. (*----------------------------------------------------------------------*)
  232. (*                                                                      *)
  233. (*     Procedure:  Host_Send                                            *)
  234. (*                                                                      *)
  235. (*     Purpose:    Sends character to comm port and/or screen           *)
  236. (*                                                                      *)
  237. (*     Calling sequence:                                                *)
  238. (*                                                                      *)
  239. (*        Host_Send( Ch : CHAR );                                       *)
  240. (*                                                                      *)
  241. (*           Ch --- character to be sent out                            *)
  242. (*                                                                      *)
  243. (*     Remarks:  If local host session, character is NOT sent out port. *)
  244. (*                                                                      *)
  245. (*----------------------------------------------------------------------*)
  246.  
  247. BEGIN (* Host_Send *)
  248.  
  249.    IF ( NOT Local_Host ) THEN
  250.       Async_Send( Ch );
  251.  
  252.    WRITE( Ch );
  253.  
  254. END   (* Host_Send *);
  255.  
  256. (*----------------------------------------------------------------------*)
  257. (*   Host_Send_String  ---  Send string to port/screen in host mode     *)
  258. (*----------------------------------------------------------------------*)
  259.  
  260. PROCEDURE Host_Send_String( S : AnyStr );
  261.  
  262. (*----------------------------------------------------------------------*)
  263. (*                                                                      *)
  264. (*     Procedure:  Host_Send_String                                     *)
  265. (*                                                                      *)
  266. (*     Purpose:    Sends string to comm port and/or screen              *)
  267. (*                                                                      *)
  268. (*     Calling sequence:                                                *)
  269. (*                                                                      *)
  270. (*        Host_Send_String( S : AnyStr );                               *)
  271. (*                                                                      *)
  272. (*           S --- character to be sent out                             *)
  273. (*                                                                      *)
  274. (*     Remarks:  If local host session, string is NOT sent out port.    *)
  275. (*                                                                      *)
  276. (*----------------------------------------------------------------------*)
  277.  
  278. BEGIN (* Host_Send_String *)
  279.  
  280.    IF ( NOT Local_Host ) THEN
  281.       Async_Send_String( S );
  282.  
  283.    WRITE( S );
  284.  
  285.    IF Printer_On THEN
  286.       WRITE( Lst, S );
  287.  
  288.    IF Capture_On THEN
  289.       WRITE( Capture_File , S );
  290.  
  291. END   (* Host_Send_String *);
  292.  
  293. (*----------------------------------------------------------------------*)
  294. (*   Host_Send_String_With_CR --- Append CR or CR+LF and send string    *)
  295. (*----------------------------------------------------------------------*)
  296.  
  297. PROCEDURE Host_Send_String_With_CR( S : AnyStr );
  298.  
  299. (*----------------------------------------------------------------------*)
  300. (*                                                                      *)
  301. (*     Procedure: Host_Send_String_With_CR                              *)
  302. (*                                                                      *)
  303. (*     Purpose:   Appends end-of-line characters to string and sends    *)
  304. (*                it out over communications port.                      *)
  305. (*                                                                      *)
  306. (*     Calling sequence:                                                *)
  307. (*                                                                      *)
  308. (*        Host_Send_String_With_CR( S: AnyStr );                        *)
  309. (*                                                                      *)
  310. (*           S --- string to be sent out.                               *)
  311. (*                                                                      *)
  312. (*     Remarks:                                                         *)
  313. (*                                                                      *)
  314. (*        The end-of-line characters are either a CR or a CR+LF,        *)
  315. (*        depending upon the choice made by the user at login time.     *)
  316. (*                                                                      *)
  317. (*----------------------------------------------------------------------*)
  318.  
  319. BEGIN (* Host_Send_String_With_CR *)
  320.  
  321.    IF ( NOT Local_Host ) THEN
  322.       Async_Send_String( S + CR_LF_Host );
  323.  
  324.    WRITELN( S );
  325.  
  326.    IF Printer_On THEN
  327.       WRITELN( Lst, S );
  328.  
  329.    IF Capture_On THEN
  330.       WRITELN( Capture_File , S );
  331.  
  332. END   (* Host_Send_String_With_CR *);
  333.  
  334. (*----------------------------------------------------------------------*)
  335. (*    Host_Send_String_And_Echo --- Send string and echo it to screen   *)
  336. (*----------------------------------------------------------------------*)
  337.  
  338. PROCEDURE Host_Send_String_And_Echo( S : AnyStr );
  339.  
  340. (*----------------------------------------------------------------------*)
  341. (*                                                                      *)
  342. (*     Procedure: Host_Send_String_And_Echo                             *)
  343. (*                                                                      *)
  344. (*     Purpose:   Send string out com port and echo to screen           *)
  345. (*                                                                      *)
  346. (*     Calling sequence:                                                *)
  347. (*                                                                      *)
  348. (*        Host_Send_String_And_Echo( S: AnyStr );                       *)
  349. (*                                                                      *)
  350. (*           S --- string to be sent out and echoed.                    *)
  351. (*                                                                      *)
  352. (*----------------------------------------------------------------------*)
  353.  
  354. BEGIN (* Host_Send_String_And_Echo *)
  355.  
  356.    IF ( NOT Local_Host ) THEN
  357.       Async_Send_String( S );
  358.  
  359.    WRITE( S );
  360.  
  361.    IF Printer_On THEN
  362.       WRITE( Lst, S );
  363.  
  364.    IF Capture_On THEN
  365.       WRITE( Capture_File , S );
  366.  
  367. END   (* Host_Send_String_And_Echo *);
  368.  
  369. (*----------------------------------------------------------------------*)
  370. (*    Host_Prompt_And_Read_String --- Get string from remote and echo   *)
  371. (*----------------------------------------------------------------------*)
  372.  
  373. PROCEDURE Host_Prompt_And_Read_String(      Prompt : AnyStr;
  374.                                         VAR S      : AnyStr;
  375.                                             Echo   : BOOLEAN );
  376.  
  377. (*----------------------------------------------------------------------*)
  378. (*                                                                      *)
  379. (*     Procedure: Host_Prompt_And_Read_String                           *)
  380. (*                                                                      *)
  381. (*     Purpose:   Issues prompt to remote user, reads response, and     *)
  382. (*                echos response.                                       *)
  383. (*                                                                      *)
  384. (*     Calling sequence:                                                *)
  385. (*                                                                      *)
  386. (*        Host_Prompt_And_Read_String(      Prompt : AnyStr;            *)
  387. (*                                      VAR S      : AnyStr;            *)
  388. (*                                          Echo   : BOOLEAN );         *)
  389. (*                                                                      *)
  390. (*           Prompt --- prompt string to be issued.                     *)
  391. (*                      If null, no prompt is issued.                   *)
  392. (*           S      --- resulting string received from remote user.     *)
  393. (*           Echo   --- TRUE to echo characters as they are read;       *)
  394. (*                      FALSE to echo characters as '.'s.  This is      *)
  395. (*                      useful for getting passwords.                   *)
  396. (*                                                                      *)
  397. (*----------------------------------------------------------------------*)
  398.  
  399. VAR
  400.    Ch      : CHAR;
  401.    GotChar : BOOLEAN;
  402.    XPos    : INTEGER;
  403.    Rem_Ch  : CHAR;
  404.  
  405. BEGIN (* Host_Prompt_And_Read_String *)
  406.  
  407.                                    (* Send prompt to remote user *)
  408.    IF LENGTH( Prompt ) > 0 THEN
  409.       Host_Send_String_And_Echo( Prompt );
  410.  
  411.    Ch      := CHR( 0 );
  412.    S       := '';
  413.    XPos    := WhereX;
  414.                                    (* Get response string        *)
  415.    REPEAT
  416.  
  417.       GotChar := FALSE;
  418.  
  419.       IF KeyPressed THEN
  420.          BEGIN
  421.             READ( Kbd, Ch );
  422.             GotChar := TRUE;
  423.          END;
  424.  
  425.       IF Async_Receive( Rem_Ch ) THEN
  426.          BEGIN
  427.             Ch      := Rem_Ch;
  428.             GotChar := TRUE;
  429.          END;
  430.  
  431.       IF GotChar THEN
  432.          IF Ch <> CHR( CR ) THEN
  433.             IF Ch = ^H THEN
  434.                BEGIN  (* Backspace *)
  435.                   IF WhereX > Xpos THEN
  436.                      BEGIN
  437.                         Host_Send( Ch  );
  438.                         Host_Send( ' ' );
  439.                         Host_Send( Ch  );
  440.                         IF LENGTH( S ) > 1 THEN
  441.                            S := COPY( S, 2, LENGTH( S ) - 1 )
  442.                         ELSE
  443.                            S := '';
  444.                      END;
  445.                END   (* Backspace *)
  446.             ELSE
  447.                BEGIN
  448.                   S := S + Ch;
  449.                   IF Echo THEN
  450.                      Host_Send( Ch )
  451.                   ELSE
  452.                      Host_Send( '.' );
  453.                END;
  454.  
  455.    UNTIL ( Ch = CHR( CR ) ) OR ( NOT Host_Carrier_Detect );
  456.  
  457.                                    (* CR ends line *)
  458.    IF Host_Carrier_Detect THEN
  459.       BEGIN
  460.  
  461.          WRITELN;
  462.  
  463.          IF Printer_On THEN
  464.             WRITELN( Lst , S );
  465.  
  466.          IF Capture_On THEN
  467.             WRITELN( Capture_File , S );
  468.  
  469.       END;
  470.  
  471. END   (* Host_Prompt_And_Read_String *);
  472.  
  473. (*----------------------------------------------------------------------*)
  474. (*            Page_Sysop --- Page sysop to enter gossip mode            *)
  475. (*----------------------------------------------------------------------*)
  476.  
  477. PROCEDURE Page_Sysop( VAR Sysop_Found : BOOLEAN );
  478.  
  479. (*----------------------------------------------------------------------*)
  480. (*                                                                      *)
  481. (*     Procedure:  Page_Sysop                                           *)
  482. (*                                                                      *)
  483. (*     Purpose:    Pages Sysop to enter gossip mode.                    *)
  484. (*                                                                      *)
  485. (*     Calling Sequence:                                                *)
  486. (*                                                                      *)
  487. (*        Page_Sysop( VAR Sysop_Found : BOOLEAN );                      *)
  488. (*                                                                      *)
  489. (*           Sysop_Found --- TRUE if sysop responds.                    *)
  490. (*                                                                      *)
  491. (*     Remarks:                                                         *)
  492. (*                                                                      *)
  493. (*        If silent mode is on (Alt_M) then this page is not performed. *)
  494. (*                                                                      *)
  495. (*----------------------------------------------------------------------*)
  496.  
  497. VAR
  498.    Timer: REAL;
  499.    I    : INTEGER;
  500.    Ch   : CHAR;
  501.  
  502. BEGIN (* Page_Sysop *)
  503.  
  504.    Host_Send_String_With_CR(' ');
  505.  
  506.    Sysop_Found := FALSE;
  507.  
  508.    IF ( NOT Silent_Mode ) THEN
  509.       BEGIN
  510.  
  511.          Host_Send_String_With_CR('Summoning Sysop ...');
  512.  
  513.          Timer := 30;
  514.  
  515.          REPEAT
  516.  
  517.             FOR I := 1 TO 5 DO
  518.                WRITE( CHR( BELL ) );
  519.  
  520.             IF KeyPressed THEN
  521.                BEGIN
  522.                   READ( Kbd, Ch );
  523.                   IF ( Ch = CHR( ESC ) ) AND KeyPressed THEN
  524.                      READ( Kbd , Ch );
  525.                   Sysop_Found := TRUE;
  526.                END;
  527.  
  528.             DELAY( One_Second_Delay );
  529.  
  530.             Timer := Timer - 1.0;
  531.  
  532.          UNTIL ( Timer <= 0.0 ) OR ( Sysop_Found );
  533.  
  534.       END
  535.    ELSE
  536.       Host_Send_String_With_CR('Sysop not available, gossip cancelled.');
  537.  
  538. END   (* Page_Sysop *);
  539.  
  540. (*----------------------------------------------------------------------*)
  541. (*           List_Prompt --- prompt for end-of-screen                   *)
  542. (*----------------------------------------------------------------------*)
  543.  
  544. PROCEDURE List_Prompt( VAR List_Count : INTEGER; VAR List_Done : BOOLEAN );
  545.  
  546. (*----------------------------------------------------------------------*)
  547. (*                                                                      *)
  548. (*     Procedure:  List_Prompt                                          *)
  549. (*                                                                      *)
  550. (*     Purpose:    Issues end-of-screen prompt for view routines        *)
  551. (*                                                                      *)
  552. (*     Calling Sequence:                                                *)
  553. (*                                                                      *)
  554. (*        List_Prompt( VAR List_Count : INTEGER;                        *)
  555. (*                     VAR List_Done  : BOOLEAN );                      *)
  556. (*                                                                      *)
  557. (*           List_Done  --- TRUE if Stop option selected here           *)
  558. (*           List_Count --- Count of lines per panel.  May be changed   *)
  559. (*                          here if C option selected.                  *)
  560. (*                                                                      *)
  561. (*     Calls:   RvsVideoOn                                              *)
  562. (*              RvsVideoOff                                             *)
  563. (*                                                                      *)
  564. (*     Called by:                                                       *)
  565. (*                                                                      *)
  566. (*        List_Files_For_Transfer                                       *)
  567. (*        Read_Messages                                                 *)
  568. (*                                                                      *)
  569. (*----------------------------------------------------------------------*)
  570.  
  571. VAR
  572.    List_Char : CHAR;
  573.  
  574. BEGIN (* List_Prompt *)
  575.  
  576.    List_Count := List_Count + 1;
  577.  
  578.    IF List_Count > Page_Size THEN
  579.       BEGIN (* Do end of screen prompt *)
  580.  
  581.          REPEAT
  582.  
  583.             Host_Send_String_And_Echo('Enter <CR> to continue, S to stop, ' +
  584.                                           'C to continue non-stop: ');
  585.  
  586.             REPEAT
  587.             UNTIL ( Async_Receive( List_Char ) OR KeyPressed OR
  588.                     ( NOT Host_Carrier_Detect ) );
  589.  
  590.             IF KeyPressed THEN
  591.                READ( KBD, List_Char );
  592.  
  593.             IF List_Char = CHR( CR ) THEN
  594.                List_Char := ' ';
  595.  
  596.             Host_Send_String_With_CR( List_Char );
  597.  
  598.             IF Printer_On THEN
  599.                WRITELN( Lst , List_Char );
  600.             IF Capture_On THEN
  601.                WRITELN( Capture_File , List_Char );
  602.  
  603.             List_Char := UpCase( List_Char );
  604.  
  605.          UNTIL ( List_Char IN ['S', 'C', ' '] ) OR ( NOT Host_Carrier_Detect );
  606.  
  607.          CASE List_Char Of
  608.             'C':  List_Count := -MaxInt;
  609.             'S':  List_Done  := TRUE;
  610.             ' ':  List_Count := 1;
  611.             ELSE
  612.                   ;
  613.          END (* CASE *);
  614.  
  615.       END (* Do end of screen prompt *);
  616.  
  617. END  (* List_Prompt *);
  618.  
  619. (*----------------------------------------------------------------------*)
  620. (*                   Gossip_Mode --- Enter PibTerm gossip mode          *)
  621. (*----------------------------------------------------------------------*)
  622.  
  623. PROCEDURE Gossip_Mode;
  624.  
  625. (*----------------------------------------------------------------------*)
  626. (*                                                                      *)
  627. (*     Procedure:  Gossip_Mode                                          *)
  628. (*                                                                      *)
  629. (*     Purpose:    Allows "conversation" with remote user.              *)
  630. (*                                                                      *)
  631. (*     Calling Sequence:                                                *)
  632. (*                                                                      *)
  633. (*        Gossip_Mode;                                                  *)
  634. (*                                                                      *)
  635. (*     Remarks:                                                         *)
  636. (*                                                                      *)
  637. (*         This gossip mode feature does not use a split screen.        *)
  638. (*                                                                      *)
  639. (*----------------------------------------------------------------------*)
  640.  
  641. VAR
  642.    Gossip_Done : BOOLEAN           (* TRUE to exit back to host mode       *);
  643.    Ch          : CHAR              (* Character read/written               *);
  644.    Bozo        : BOOLEAN;
  645.  
  646. BEGIN (* Gossip_Mode *)
  647.  
  648.    Host_Send_String_With_CR(' ');
  649.    Host_Send_String_With_CR('Entering gossip mode ... ');
  650.    WRITELN('Enter Ctrl-C to exit gossip mode.');
  651.  
  652.    Gossip_Done := FALSE;
  653.                                    (* Loop over input until done *)
  654.    WHILE ( NOT Gossip_Done ) DO
  655.       BEGIN
  656.                                    (* Check if XOFF needs to be sent *)
  657.          Async_Buffer_Full;
  658.                                    (* Check for character typed at keyboard *)
  659.          IF KeyPressed THEN
  660.             BEGIN
  661.  
  662.                READ( Kbd , Ch );
  663.  
  664.                IF ( ORD( Ch ) = ESC ) AND KeyPressed THEN
  665.                   BEGIN
  666.                      READ( Kbd, Ch );
  667.                      IF ( ORD( Ch ) = F1 ) THEN
  668.                         Ch := CHR( 3 )
  669.                      ELSE IF ( ORD( Ch ) = F2 ) THEN
  670.                         BEGIN
  671.                            Ch := CHR( 3 );
  672.                            Done := TRUE;
  673.                         END;
  674.                   END;
  675.  
  676.                CASE ORD( Ch ) OF
  677.  
  678.                     3:  Gossip_Done := TRUE;
  679.  
  680.                   ESC:  IF KeyPressed THEN
  681.                            BEGIN
  682.                               Process_Command( Ch, FALSE, PibTerm_Command );
  683.                               IF PibTerm_Command <> Null_Command THEN
  684.                                  Execute_Command( PibTerm_Command, Bozo, FALSE );
  685.                            END
  686.                         ELSE
  687.                            BEGIN
  688.                               IF Local_Echo THEN WRITE( Ch );
  689.                               Async_Send( Ch );
  690.                            END;
  691.  
  692.  
  693.                   BS:   BEGIN
  694.                            Ch := BS_Char;
  695.                            Host_Send( Ch );
  696.                            IF Printer_On THEN
  697.                               WRITE( Lst , Ch );
  698.                            IF Capture_On THEN
  699.                               WRITE( Capture_File , Ch );
  700.                         END;
  701.  
  702.                   DEL:  BEGIN
  703.                            Ch := Ctrl_BS_Char;
  704.                            Host_Send( Ch );
  705.                            IF Printer_On THEN
  706.                               WRITE( Lst , Ch );
  707.                            IF Capture_On THEN
  708.                               WRITE( Capture_File , Ch );
  709.                         END;
  710.  
  711.                   CR:   BEGIN
  712.                            Host_Send_String( CR_LF_Host );
  713.                            IF Printer_On THEN
  714.                               WRITELN( Lst );
  715.                            IF Capture_On THEN
  716.                               WRITELN( Capture_File );
  717.                         END;
  718.  
  719.                   ELSE
  720.                         BEGIN
  721.                            Host_Send( Ch );
  722.                            IF Printer_On THEN
  723.                               WRITE( Lst , Ch );
  724.                            IF Capture_On THEN
  725.                               WRITE( Capture_File , Ch );
  726.                         END;
  727.  
  728.                END (* CASE ORD( Ch ) *);
  729.  
  730.             END;
  731.  
  732.          IF Async_Receive( Ch ) THEN
  733.             BEGIN
  734.                IF Ch = CHR( CR ) THEN
  735.                   BEGIN
  736.                      IF Printer_On THEN
  737.                         WRITELN( Lst );
  738.                      IF Capture_On THEN
  739.                         WRITELN( Capture_File );
  740.                      Host_Send_String( CR_LF_Host );
  741.                   END
  742.                ELSE
  743.                   Host_Send( Ch );
  744.             END;
  745.  
  746.       END;
  747.  
  748. END   (* Gossip_Mode *);
  749.  
  750. (*----------------------------------------------------------------------*)
  751. (*                Start of host mode overlay section one                *)
  752. (*----------------------------------------------------------------------*)
  753.  
  754. CONST
  755.    Start_Host_Overlay_One = 1;
  756.  
  757. (*----------------------------------------------------------------------*)
  758. (*  Process_File_Transfer_Commands --- Process file transfer commands   *)
  759. (*----------------------------------------------------------------------*)
  760.  
  761. OVERLAY PROCEDURE Process_File_Transfer_Commands( VAR Done: BOOLEAN;
  762.                                                   VAR Back: BOOLEAN );
  763.  
  764. (*----------------------------------------------------------------------*)
  765. (*                                                                      *)
  766. (*     Procedure:  Process_File_Transfer_Commands                       *)
  767. (*                                                                      *)
  768. (*     Purpose:    Controls processing of file transfer commands.       *)
  769. (*                                                                      *)
  770. (*     Calling Sequence:                                                *)
  771. (*                                                                      *)
  772. (*        Process_File_Transfer_Commands( VAR Done: BOOLEAN;            *)
  773. (*                                        VAR Back: BOOLEAN );          *)
  774. (*                                                                      *)
  775. (*           Done --- set TRUE if quit command entered or carrier       *)
  776. (*                    dropped.                                          *)
  777. (*           Back --- set TRUE if return to main menu requested.        *)
  778. (*                                                                      *)
  779. (*----------------------------------------------------------------------*)
  780.  
  781. VAR
  782.    Ch:        CHAR;
  783.  
  784. (*----------------------------------------------------------------------*)
  785. (*      Display_Xfer_Commands --- Display file transfer commands        *)
  786. (*----------------------------------------------------------------------*)
  787.  
  788. PROCEDURE Display_Xfer_Commands;
  789.  
  790. (*----------------------------------------------------------------------*)
  791. (*                                                                      *)
  792. (*     Procedure: Display_Xfer_Commands                                 *)
  793. (*                                                                      *)
  794. (*     Purpose:   Displays menu of PibTerm file transfer commands and   *)
  795. (*                prompts for command entry.                            *)
  796. (*                                                                      *)
  797. (*     Calling sequence:                                                *)
  798. (*                                                                      *)
  799. (*        Display_Xfer_Commands;                                        *)
  800. (*                                                                      *)
  801. (*----------------------------------------------------------------------*)
  802.  
  803. BEGIN (* Display_Xfer_Commands *)
  804.  
  805.    IF ( NOT Expert_On ) THEN
  806.       BEGIN
  807.          Host_Send_String_With_CR('======================================================');
  808.          Host_Send_String_With_CR('=        PibTerm Host Mode File Transfer Menu        =');
  809.          Host_Send_String_With_CR('======================================================');
  810.          Host_Send_String_With_CR(' ');
  811.          Host_Send_String_With_CR('     U=Upload file');
  812.          Host_Send_String_With_CR('     D=Download file');
  813.          Host_Send_String_With_CR('     L=List files for transfer');
  814.          Host_Send_String_With_CR('     M=Return to main menu');
  815.          Host_Send_String_With_CR('     Q=Quit and logoff');
  816.          Host_Send_String_With_CR('     X=Expert mode');
  817.          Host_Send_String_With_CR(' ');
  818.          Host_Send_String_With_CR('======================================================');
  819.          Host_Send_String_With_CR(' ');
  820.          Host_Send_String_And_Echo('Enter command ? ');
  821.       END
  822.    ELSE
  823.       BEGIN
  824.          Host_Send_String_With_CR(' ');
  825.          Host_Send_String_And_Echo('Xfer (U,D,L,M,Q,X) ? ');
  826.       END;
  827.  
  828. END   (* Display_Xfer_Commands *);
  829.  
  830.  
  831. (*----------------------------------------------------------------------*)
  832. (*    List_Files_For_Transfer --- List files available for transfer     *)
  833. (*----------------------------------------------------------------------*)
  834.  
  835. PROCEDURE List_Files_For_Transfer;
  836.  
  837. (*----------------------------------------------------------------------*)
  838. (*                                                                      *)
  839. (*     Procedure: List_Files_For_Transfer                               *)
  840. (*                                                                      *)
  841. (*     Purpose:   Displays files available for transfer.                *)
  842. (*                                                                      *)
  843. (*     Calling sequence:                                                *)
  844. (*                                                                      *)
  845. (*        List_Files_For_Transfer;                                      *)
  846. (*                                                                      *)
  847. (*                                                                      *)
  848. (*     Remarks:                                                         *)
  849. (*                                                                      *)
  850. (*        This procedure sends the contents of the PIBTERM.XFR file to  *)
  851. (*        the remote user.                                              *)
  852. (*                                                                      *)
  853. (*----------------------------------------------------------------------*)
  854.  
  855. VAR
  856.    LCount    : INTEGER;
  857.    LDone     : BOOLEAN;
  858.    XFer_Line : AnyStr;
  859.  
  860. BEGIN (* List_Files_For_Transfer *)
  861.                                    (* Open xferlist file *)
  862.  
  863.    ASSIGN( Xfer_List_File , Home_Dir + 'PIBTERM.XFR' );
  864.       (*$I-*)
  865.    RESET( Xfer_List_File );
  866.       (*$I+*)
  867.                                    (* If not there, no transfer possible *)
  868.    IF Int24Result <> 0 THEN
  869.       BEGIN
  870.          Host_Send_String( CR_LF_Host );
  871.          Host_Send_String_With_CR('No files available for transfer.');
  872.       END
  873.    ELSE                            (* If there, list it *)
  874.       BEGIN
  875.  
  876.          LCount := 2;
  877.          LDone  := FALSE;
  878.  
  879.          Host_Send_String( CR_LF_Host );
  880.          Host_Send_String_With_CR('List of files available for transfer: ');
  881.          Host_Send_String_With_CR(' ');
  882.  
  883.          List_Prompt( LCount , LDone );
  884.  
  885.          REPEAT
  886.  
  887.             READLN( Xfer_List_File , Xfer_Line );
  888.  
  889.             Host_Send_String_With_CR( Xfer_Line );
  890.  
  891.             List_Prompt( LCount , LDone );
  892.  
  893.          UNTIL ( EOF( Xfer_List_File ) OR LDone );
  894.  
  895.       END;
  896.  
  897.       (*$I-*)
  898.    CLOSE( Xfer_List_File )
  899.       (*$I+*)
  900.  
  901. END   (* List_Files_For_Transfer *);
  902.  
  903. (*----------------------------------------------------------------------*)
  904. (*        Search_Xfer_List --- Search transfer list for file name       *)
  905. (*----------------------------------------------------------------------*)
  906.  
  907. FUNCTION Search_Xfer_List( File_Name : AnyStr ) : BOOLEAN;
  908.  
  909. (*----------------------------------------------------------------------*)
  910. (*                                                                      *)
  911. (*     Function:  Search_Xfer_List                                      *)
  912. (*                                                                      *)
  913. (*     Purpose:   Searches transfer list for given file name.           *)
  914. (*                                                                      *)
  915. (*     Calling sequence:                                                *)
  916. (*                                                                      *)
  917. (*        Found := Search_Xfer_List( File_Name: AnyStr ) : BOOLEAN;     *)
  918. (*                                                                      *)
  919. (*           File_Name --- file name to look for.                       *)
  920. (*           Found     --- TRUE if file on transfer list, else FALSE.   *)
  921. (*                                                                      *)
  922. (*     Remarks:                                                         *)
  923. (*                                                                      *)
  924. (*        This procedure searches the contents of the PIBTERM.XFR file. *)
  925. (*                                                                      *)
  926. (*----------------------------------------------------------------------*)
  927.  
  928. VAR
  929.    SDone     : BOOLEAN;
  930.    XFer_Line : AnyStr;
  931.  
  932. BEGIN (* Search_Xfer_List *)
  933.  
  934.    Host_Send_String( CR_LF_Host );
  935.  
  936.    Host_Send_String_With_CR('Scanning file list ... ');
  937.  
  938.    Search_Xfer_List := Scan_Xfer_List( File_Name );
  939.  
  940. END   (* Search_Xfer_List *);
  941.  
  942. (*----------------------------------------------------------------------*)
  943. (*        Display_Xfer_Protocols --- Display file xfer protocols        *)
  944. (*----------------------------------------------------------------------*)
  945.  
  946. PROCEDURE Display_Xfer_Protocols;
  947.  
  948. (*----------------------------------------------------------------------*)
  949. (*                                                                      *)
  950. (*     Procedure: Display_Xfer_Protocols;                               *)
  951. (*                                                                      *)
  952. (*     Purpose:   Displays available file transfer protocols.           *)
  953. (*                                                                      *)
  954. (*     Calling sequence:                                                *)
  955. (*                                                                      *)
  956. (*        Display_Xfer_Protocols;                                       *)
  957. (*                                                                      *)
  958. (*----------------------------------------------------------------------*)
  959.  
  960. BEGIN (* Display_Xfer_Protocols *)
  961.  
  962.    Host_Send_String( CR_LF_Host );
  963.    Host_Send_String_With_CR('Available transfer protocols are: ');
  964.    Host_Send_String_With_CR(' ');
  965.    Host_Send_String_With_CR('   A    Ascii');
  966.    Host_Send_String_With_CR('   X    Xmodem CheckSum');
  967.    Host_Send_String_With_CR('   XC   Xmodem CRC');
  968.    Host_Send_String_With_CR('   Y    Ymodem');
  969.    Host_Send_String_With_CR('   YB   Ymodem Batch');
  970.    Host_Send_String_With_CR('   T    Telink');
  971.    Host_Send_String_With_CR('   M    Modem7 Batch Checksum');
  972.    Host_Send_String_With_CR('   MC   Modem7 Batch CRC');
  973.    Host_Send_String_With_CR('   K    Kermit (Text file)');
  974.    Host_Send_String_With_CR('   KB   Kermit (Binary file)');
  975.  
  976. END   (* Display_Xfer_Protocols *);
  977.  
  978. (*----------------------------------------------------------------------*)
  979. (*              Get_Xfer_Protocol --- Get file xfer protocol            *)
  980. (*----------------------------------------------------------------------*)
  981.  
  982. FUNCTION Get_Xfer_Protocol : Transfer_Type;
  983.  
  984. (*----------------------------------------------------------------------*)
  985. (*                                                                      *)
  986. (*     Function:  Get_Xfer_Protocol;                                    *)
  987. (*                                                                      *)
  988. (*     Purpose:   Prompts remote user for, and reads, selected file     *)
  989. (*                transfer protocol.                                    *)
  990. (*                                                                      *)
  991. (*     Calling sequence:                                                *)
  992. (*                                                                      *)
  993. (*        Trans_Type := Get_Xfer_Protocol : Transfer_Type;              *)
  994. (*                                                                      *)
  995. (*           Trans_Type --- Protocol chosen by remote user.             *)
  996. (*                                                                      *)
  997. (*----------------------------------------------------------------------*)
  998.  
  999. VAR
  1000.    Trans_Mode        : AnyStr;
  1001.    Transfer_Protocol : Transfer_Type;
  1002.  
  1003. BEGIN (* Get_Xfer_Protocol *)
  1004.  
  1005.    REPEAT
  1006.  
  1007.       Host_Send_String( CR_LF_Host );
  1008.       Host_Prompt_And_Read_String('Enter transfer protocol:     ',
  1009.                                      Trans_Mode, TRUE );
  1010.  
  1011.       Trans_Mode := Uppercase( TRIM( Trans_Mode ) );
  1012.  
  1013.       Transfer_Protocol := None;
  1014.  
  1015.       IF Trans_Mode = '?' THEN
  1016.          Display_Xfer_Protocols
  1017.       ELSE IF Trans_Mode = 'A'  THEN
  1018.          Transfer_Protocol := Ascii
  1019.       ELSE IF Trans_Mode = 'X'  THEN
  1020.          Transfer_Protocol := Xmodem_Chk
  1021.       ELSE IF Trans_Mode = 'XC' THEN
  1022.          Transfer_Protocol := Xmodem_CRC
  1023.       ELSE IF Trans_Mode = 'Y'  THEN
  1024.          Transfer_Protocol := Ymodem
  1025.       ELSE IF Trans_Mode = 'YB' THEN
  1026.          Transfer_Protocol := Ymodem_Batch
  1027.       ELSE IF Trans_Mode = 'T'  THEN
  1028.          Transfer_Protocol := Telink
  1029.       ELSE IF Trans_Mode = 'TC' THEN
  1030.          Transfer_Protocol := Telink
  1031.       ELSE IF Trans_Mode = 'M'  THEN
  1032.          Transfer_Protocol := Modem7_Chk
  1033.       ELSE IF Trans_Mode = 'MC'  THEN
  1034.          Transfer_Protocol := Modem7_CRC
  1035.       ELSE IF Trans_Mode = 'M7' THEN
  1036.          Transfer_Protocol := Modem7_CRC
  1037.       ELSE IF Trans_Mode = 'K' THEN
  1038.          BEGIN
  1039.             Transfer_Protocol    := Kermit;
  1040.             Kermit_File_Type_Var := Kermit_Ascii;
  1041.          END
  1042.       ELSE IF Trans_Mode = 'KB' THEN
  1043.          BEGIN
  1044.             Transfer_Protocol    := Kermit;
  1045.             Kermit_File_Type_Var := Kermit_Binary;
  1046.          END;
  1047.  
  1048.    UNTIL ( Transfer_Protocol  <> None );
  1049.  
  1050.    Get_Xfer_Protocol := Transfer_Protocol;
  1051.  
  1052. END   (* Get_Xfer_Protocol *);
  1053.  
  1054. (*----------------------------------------------------------------------*)
  1055. (*               Upload_A_File  --- Receive file from remote user       *)
  1056. (*----------------------------------------------------------------------*)
  1057.  
  1058. PROCEDURE Upload_A_File;
  1059.  
  1060. (*----------------------------------------------------------------------*)
  1061. (*                                                                      *)
  1062. (*     Procedure:  Upload_A_File;                                       *)
  1063. (*                                                                      *)
  1064. (*     Purpose:   Prompts remote user for, and receives, selected file. *)
  1065. (*                                                                      *)
  1066. (*     Calling sequence:                                                *)
  1067. (*                                                                      *)
  1068. (*        Upload_A_File;                                                *)
  1069. (*                                                                      *)
  1070. (*----------------------------------------------------------------------*)
  1071.  
  1072. VAR
  1073.    File_Name         : AnyStr;
  1074.    Trans_Mode        : AnyStr;
  1075.    Transfer_Protocol : Transfer_Type;
  1076.  
  1077. BEGIN (* Upload_A_File *)
  1078.  
  1079.    Host_Send_String( CR_LF_Host );
  1080.    Host_Prompt_And_Read_String('Enter file name to upload: ',
  1081.                                   File_Name, TRUE );
  1082.  
  1083.    Transfer_Protocol := Get_Xfer_Protocol;
  1084.  
  1085.    IF ( Search_Xfer_List( File_Name ) ) THEN
  1086.       BEGIN
  1087.          Host_Send_String( CR_LF_Host );
  1088.          Host_Send_String_With_CR('File already exists, upload cancelled.');
  1089.       END
  1090.    ELSE IF( File_Name = 'PIBTERM.XFR' ) OR
  1091.           ( File_Name = 'PIBTERM.LOG' ) OR
  1092.           ( File_Name = 'PIBTERM.USF' ) OR
  1093.           ( File_Name = 'PIBTERM.MSG' ) OR
  1094.           ( File_Name = 'PIBTERM.CMT' ) THEN
  1095.       BEGIN
  1096.          Host_Send_String( CR_LF_Host );
  1097.          Host_Send_String_With_CR('You may not upload a file with that name.');
  1098.       END
  1099.    ELSE
  1100.       BEGIN                        (* FileName is global for transfers *)
  1101.          FileName := File_Name;
  1102.          Host_Send_String( CR_LF_Host );
  1103.          Host_Send_String_With_CR('Ready to receive file, begin your send procedure.');
  1104.          PibDownLoad( Transfer_Protocol );
  1105.       END;
  1106.  
  1107. END   (* Upload_A_File *);
  1108.  
  1109. (*----------------------------------------------------------------------*)
  1110. (*             Download_A_File  --- Send file to remote user            *)
  1111. (*----------------------------------------------------------------------*)
  1112.  
  1113. PROCEDURE Download_A_File;
  1114.  
  1115. (*----------------------------------------------------------------------*)
  1116. (*                                                                      *)
  1117. (*     Procedure:  Download_A_File;                                     *)
  1118. (*                                                                      *)
  1119. (*     Purpose:   Prompts remote user for, and sends, selected file.    *)
  1120. (*                                                                      *)
  1121. (*     Calling sequence:                                                *)
  1122. (*                                                                      *)
  1123. (*        Download_A_File;                                              *)
  1124. (*                                                                      *)
  1125. (*----------------------------------------------------------------------*)
  1126.  
  1127. VAR
  1128.    File_Name         : AnyStr;
  1129.    Trans_Mode        : AnyStr;
  1130.    Transfer_Protocol : Transfer_Type;
  1131.    Found_File        : BOOLEAN;
  1132.  
  1133. BEGIN (* Download_A_File *)
  1134.  
  1135.    Host_Send_String( CR_LF_Host );
  1136.    Host_Prompt_And_Read_String('Enter file name to download: ',
  1137.                                   File_Name, TRUE );
  1138.  
  1139.    Transfer_Protocol := Get_Xfer_Protocol;
  1140.  
  1141.    IF POS( '*', File_Name ) = 0 THEN
  1142.       BEGIN
  1143.          Found_File := Search_Xfer_List( File_Name );
  1144.          IF ( NOT Found_File ) THEN
  1145.             BEGIN
  1146.                Host_Send_String( CR_LF_Host );
  1147.                Host_Send_String_With_CR('File not found, download cancelled.');
  1148.             END;
  1149.       END
  1150.    ELSE IF Transfer_Protocol IN [ Xmodem_Chk, Xmodem_Crc, Ascii, Ymodem ] THEN
  1151.       BEGIN
  1152.          Found_File := FALSE;
  1153.          Host_Send_String( CR_LF_Host );
  1154.          Host_Send_String('Wildcards are not allowed for this protocol.');
  1155.       END
  1156.    ELSE
  1157.       Found_File := TRUE;
  1158.  
  1159.    IF Found_File THEN
  1160.       BEGIN                        (* FileName is global for transfers *)
  1161.          FileName := File_Name;
  1162.          Host_Send_String( CR_LF_Host );
  1163.          Host_Send_String_With_CR('Ready to send, begin your receive procedure.');
  1164.          PibUpLoad( Transfer_Protocol );
  1165.       END;
  1166.  
  1167. END   (* Download_A_File *);
  1168.  
  1169. (*----------------------------------------------------------------------*)
  1170.  
  1171. BEGIN (* Process_File_Transfer_Commands *)
  1172.  
  1173.                                    (* No keyboard input yet *)
  1174.    Kbd_Input := FALSE;
  1175.                                    (* Stay in files section for a while *)
  1176.    Back := FALSE;
  1177.                                    (* Prompt for commands *)
  1178.    Display_Xfer_Commands;
  1179.                                    (* Wait for command to be entered *)
  1180.    REPEAT
  1181.       Done := Done OR ( NOT Host_Carrier_Detect );
  1182.    UNTIL Done OR Async_Receive( Ch ) OR KeyPressed;
  1183.  
  1184.                                    (* Process input from keyboard *)
  1185.    IF KeyPressed THEN
  1186.       BEGIN
  1187.          READ( KBD , Ch );
  1188.          Kbd_Input := TRUE;
  1189.          IF ( ORD( Ch ) = ESC ) AND KeyPressed THEN
  1190.             BEGIN
  1191.                READ( Kbd, Ch );
  1192.                IF ORD( Ch ) = F1 THEN
  1193.                   Ch := 'G'
  1194.                ELSE IF ORD( Ch ) = F2 THEN
  1195.                   Ch := 'Q';
  1196.             END;
  1197.       END;
  1198.  
  1199.    IF ( Not DONE ) THEN
  1200.                                    (* Echo command character *)
  1201.       IF Printer_On THEN
  1202.          WRITELN( Lst, Ch );
  1203.       IF Capture_On THEN
  1204.          WRITELN( Capture_File, Ch );
  1205.       Host_Send_String( Ch + CR_LF_Host );
  1206.  
  1207.                                    (* Process command request *)
  1208.       CASE UpCase( Ch ) OF
  1209.  
  1210.          'U':  Upload_A_File;
  1211.          'D':  Download_A_File;
  1212.          'Q':  BEGIN
  1213.                   IF Kbd_Input THEN
  1214.                      BEGIN
  1215.                         Host_Send_String_With_CR('System operator shutting ' +
  1216.                                                   ' down system.');
  1217.                         Host_Send_String_With_CR('Thanks for calling.');
  1218.                         Done := TRUE;
  1219.                      END
  1220.                   ELSE
  1221.                      BEGIN
  1222.                         Host_Send_String_With_CR('Quit and logoff');
  1223.                         Done := TRUE;
  1224.                      END;
  1225.                END;
  1226.          'L':  List_Files_For_Transfer;
  1227.          'X':  Expert_On := NOT Expert_On;
  1228.          'M':  BEGIN
  1229.                   Back         := TRUE;
  1230.                   Host_Section := 'M';
  1231.                END;
  1232.          'G':  IF Kbd_Input THEN
  1233.                   BEGIN
  1234.                      Host_Send_String_With_CR(' ... System operator wishes' +
  1235.                                                ' to chat, please wait ...');
  1236.                      Host_Send_String_With_CR(' ');
  1237.                      Gossip_Mode;
  1238.                   END;
  1239.  
  1240.          ELSE  Host_Send_String( ^G );
  1241.  
  1242.       END (* CASE *)
  1243.  
  1244. END   (* Process_File_Transfer_Commands *);
  1245. ə