home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BTMTSRC3.ZIP / B_WHACK.C < prev    next >
C/C++ Source or Header  |  1991-08-15  |  6KB  |  134 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-90, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                 This module was written by Bob Hartman                   */
  14. /*                                                                          */
  15. /*                                                                          */
  16. /*                 BinkleyTerm FTSC Mail Session Routines                   */
  17. /*                                                                          */
  18. /*                                                                          */
  19. /*    For complete  details  of the licensing restrictions, please refer    */
  20. /*    to the License  agreement,  which  is published in its entirety in    */
  21. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.240.    */
  22. /*                                                                          */
  23. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  24. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  25. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  26. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  27. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  28. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  29. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  30. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  31. /*                                                                          */
  32. /*                                                                          */
  33. /* You can contact Bit Bucket Software Co. at any one of the following      */
  34. /* addresses:                                                               */
  35. /*                                                                          */
  36. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:132/491, 1:141/491  */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n132.z1.fidonet.org         */
  40. /*                                                                          */
  41. /* Please feel free to contact us at any time to share your comments about  */
  42. /* our software and/or licensing policies.                                  */
  43. /*                                                                          */
  44. /*--------------------------------------------------------------------------*/
  45.  
  46. #include <stdio.h>
  47. #include <ctype.h>
  48. #include <conio.h>
  49. #include <string.h>
  50.  
  51. #define WAZOO_SECTION
  52. #define MATRIX_SECTION
  53.  
  54. #include "com.h"
  55. #include "xfer.h"
  56. #include "zmodem.h"
  57. #include "keybd.h"
  58. #include "sbuf.h"
  59. #include "sched.h"
  60. #include "externs.h"
  61. #include "prototyp.h"
  62.  
  63. int Whack_CR ()
  64. {
  65.    long t1, t2;
  66.    unsigned char j;
  67.    char m;
  68.    int l;
  69.    unsigned int i;
  70.    char buf[180];
  71.  
  72.    t1 = timerset (3000);                         /* set 30 second timeout */
  73.    j = CR;
  74.    (void) strcpy (buf, msgtxt[M_INTRO]);
  75.    l = (int) strlen (buf);
  76.    m = 0;
  77.    while (!timeup (t1) && CARRIER)               /* till then or CD lost  */
  78.       {
  79.  
  80.       /* Send either the CR or SPACE */
  81.       SENDBYTE (j);
  82.  
  83.       /* Now switch to either CR or SPACE based on last output */
  84.       j = (unsigned char) (45 - j);
  85.  
  86.       /* Now read what we get back to see if we get anything useful */
  87.       while (((i = (unsigned) TIMED_READ (0)) != (unsigned int)EOF) && (!timeup (t1)) && CARRIER)
  88.          {
  89.          if (i == CR)
  90.             {
  91.             if (m)
  92.                {
  93.                if (un_attended && fullscreen)
  94.                   {
  95.                   clear_filetransfer ();
  96.                   sb_move (filewin, 1, 2);
  97.                   sb_puts (filewin, (unsigned char *) buf);
  98.                   sb_show ();
  99.                   status_line ("*%s", buf);
  100.                   }
  101.                else
  102.                   {
  103.                   set_xy (NULL);
  104.                   scr_printf (buf);
  105.                   }
  106.                /* We got what we wanted */
  107.                /* Now try to stop output on an Opus */
  108.                SENDBYTE (' ');
  109.                return (0);
  110.                }
  111.             }
  112.          else if (i >= ' ')
  113.             {
  114.             buf[l++] = (char) (i & 0xff);
  115.             buf[l] = '\0';
  116.             if (l > SB_COLS - 6)
  117.                l = SB_COLS - 6;
  118.             m = 1;
  119.             }
  120.          }
  121.  
  122.       /* Delay for a second */
  123.       t2 = timerset (100);
  124.       while (!timeup (t2))
  125.          time_release ();
  126.       }
  127.  
  128.    if (CARRIER)
  129.       status_line (msgtxt[M_NOBODY_HOME]);
  130.    else
  131.       status_line (msgtxt[M_NO_CARRIER]);
  132.    return (-1);
  133. }
  134.