www.pudn.com > ASYNC13.rar > SETXON.C


/* A module of ASYNCx.LIB version 1.20 */ 
 
#include "asyncdef.h" 
 
/* 
** Set the levels at which XON and XOFF characters will be sent. If there 
** are more than xoff characters in the buffer, an XOFF will be sent. If 
** an XOFF character has already been sent and the number of characters 
** drops below xon, an XON will be sent. To turn off XON/XOFF, set xon to 
** 0 and xoff to -1. If XON/XOFF is being turned off and an XOFF charactr 
** has been sent, an XON character is sent so that communications will not 
** be frozen. This function returns 0 on success or -1 on failure. 
*/ 
int a_setxonoff(register ASYNC *p,word xon,word xoff) 
{if (p) 
  {p->xon=xon; 
   p->xoff=xoff; 
   if (xon==0 && xoff==0xffff && p->sentxoff) 
    {p->lookx=0; /* turn off XON/XOFF checking */ 
     a_putc(XON,p); 
    } 
   else 
     p->lookx=1; /* turn on XON/XOFF checking */ 
   return 0; 
  } 
 return -1; 
} /* end of a_setxonoff(p,xon,xoff) */