setxon.c

来自「异步通讯C语言例行子程序」· C语言 代码 · 共 28 行

C
28
字号
/* 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) */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?