blob: 9a465da557ee3ddf1f22f24f713e6aa1b3b9e52f (
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
|
/*
* Portable routines to get and set serial device attributes.
* $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>
stty_t getstty(fd_t fd)
{
stty_t stty = (stty_t)malloc(sizeof(struct termios));
tcgetattr(fd, stty);
return stty;
}
void putstty(fd_t fd, stty_t stty, bool now)
{
if(now)
tcsetattr(fd, TCSANOW, stty);
else
tcsetattr(fd, TCSADRAIN, stty);
free(stty);
}
#endif
|