home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BSRC_250.LZH / B_WHACK.C < prev    next >
C/C++ Source or Header  |  1991-09-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-91, 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.250.    */
  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:343/491             */
  37. /* P.O. Box 460398                AlterNet 7:491/0                          */
  38. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  39. /*                                Internet f491.n343.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 this file before any other includes or defines! */
  47.  
  48. #include "includes.h"
  49.  
  50. int Whack_CR ()
  51. {
  52.    long t1, t2;
  53.    unsigned char j;
  54.    char m;
  55.    int k, l;
  56.    unsigned int i;
  57.    char buf[180];
  58.  
  59.    t1 = timerset (3000);                         /* set 30 second timeout */
  60.    j = CR;
  61.    (void) strcpy (buf, MSG_TXT(M_INTRO));
  62.    l = (int) strlen (buf);
  63.    m = 0;
  64.    k = 2;
  65.    while (!timeup (t1) && CARRIER)               /* till then or CD lost  */
  66.       {
  67.  
  68.       /* We send two XON's to try to unstick a V.42 miscue */
  69.       if (k-- > 0)
  70.          SENDBYTE (XON);                         /* Unstick other side?   */
  71.  
  72.       /* Send either the CR or SPACE */
  73.       SENDBYTE (j);
  74.  
  75.       /* Now switch to either CR or SPACE based on last output */
  76.       j = (unsigned char) (45 - j);
  77.  
  78.       /* Now read what we get back to see if we get anything useful */
  79.       while (((i = (unsigned) TIMED_READ (0)) != (unsigned int)EOF) && (!timeup (t1)) && CARRIER)
  80.          {
  81.          if (i == CR)
  82.             {
  83.             if (m)
  84.                {
  85.                if (un_attended && fullscreen)
  86.                   {
  87.                   clear_filetransfer ();
  88.  
  89.                   sb_move (file_hWnd, 1, 2);
  90.                   sb_puts( GetDlgItem( file_hWnd, FILE_LN_1 ), buf );
  91.                   sb_show ();
  92.                   status_line ("*%s", buf);
  93.                   }
  94.                else
  95.                   {
  96.                   set_xy (NULL);
  97.                   scr_printf (buf);
  98.                   }
  99.                /* We got what we wanted */
  100.                /* Now try to stop output on an Opus */
  101.                SENDBYTE (' ');
  102.                return (0);
  103.                }
  104.             }
  105.          else if (i >= ' ')
  106.             {
  107.             buf[l++] = (char) (i & 0xff);
  108.             buf[l] = '\0';
  109.             if (l > (int)SB_COLS - 6)
  110.                l = SB_COLS - 6;
  111.             m = 1;
  112.             }
  113.          }
  114.  
  115.       if (got_ESC ())
  116.          {
  117.          status_line (MSG_TXT(M_CONNECT_ABORTED));
  118.          mdm_hangup ();
  119.          return (-1);
  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 (MSG_TXT(M_NOBODY_HOME));
  130.    else
  131.       status_line (MSG_TXT(M_NO_CARRIER));
  132.    return (-1);
  133. }
  134.