blob: 7977b1ce150ae59f480320f4e04ca05938ebab02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* Serial line flow control option settings.
* $Id$
* Copyright (c) 1997 by Tycho Softworks.
* For conditions of distribution and reuse see product license.
*/
#include <dev/tty.h>
#ifndef TERMIOS_H_MISSING
#include <termios.h>
#endif
#ifndef CRTSCTS
#ifdef CTSFLOW
#define CRTSCTS CTSFLOW | CRTSFL
#endif
#endif
int setflowctrl(stty_t stty, FLOWCONTROL flow)
{
#ifndef TERMIOS_H_MISSING
struct termios *tios = stty;
tios->c_cflag &= ~CRTSCTS;
tios->c_iflag &= ~(IXON | IXOFF | IXANY);
switch(flow)
{
case FC_HARD:
tios->c_cflag |= CRTSCTS;
break;
case FC_SOFT:
tios->c_iflag |= (IXON | IXOFF | IXANY);
break;
case FC_FULL:
tios->c_cflag |= CRTSCTS;
tios->c_iflag |= (IXON | IXOFF | IXANY);
break;
}
#endif
return 0;
}
|