version 1.11, 2012/07/13 14:45:24 |
version 1.12, 2013/01/17 11:15:22 |
|
|
struct bufferevent *input_ev; |
struct bufferevent *input_ev; |
struct bufferevent *output_ev; |
struct bufferevent *output_ev; |
int line_fd; |
int line_fd; |
|
struct termios line_tio; |
struct bufferevent *line_ev; |
struct bufferevent *line_ev; |
struct event sigterm_ev; |
struct event sigterm_ev; |
struct event sighup_ev; |
struct event sighup_ev; |
|
|
err(1, "open(\"%s\")", line); |
err(1, "open(\"%s\")", line); |
if (ioctl(line_fd, TIOCEXCL) != 0) |
if (ioctl(line_fd, TIOCEXCL) != 0) |
err(1, "ioctl(TIOCEXCL)"); |
err(1, "ioctl(TIOCEXCL)"); |
|
if (tcgetattr(line_fd, &line_tio) != 0) |
|
err(1, "tcgetattr"); |
if (set_line(speed) != 0) |
if (set_line(speed) != 0) |
err(1, "tcsetattr"); |
err(1, "tcsetattr"); |
|
|
|
|
{ |
{ |
struct termios tio; |
struct termios tio; |
|
|
cfmakeraw(&tio); |
memcpy(&tio, &line_tio, sizeof(tio)); |
tio.c_iflag = 0; |
tio.c_iflag &= ~(ISTRIP|ICRNL); |
tio.c_oflag = 0; |
tio.c_oflag &= ~OPOST; |
tio.c_lflag = 0; |
tio.c_lflag &= ~(ICANON|ISIG|IEXTEN|ECHO); |
tio.c_cflag = CREAD|CS8|CLOCAL; |
tio.c_cflag &= ~(CSIZE|PARENB); |
|
tio.c_cflag |= CREAD|CS8|CLOCAL; |
tio.c_cc[VMIN] = 1; |
tio.c_cc[VMIN] = 1; |
tio.c_cc[VTIME] = 0; |
tio.c_cc[VTIME] = 0; |
cfsetspeed(&tio, speed); |
cfsetspeed(&tio, speed); |