From 851c651820242b9875dc582cc97a39ba1c449f24 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 26 Nov 2007 12:14:32 +0000 Subject: [PATCH] Mon Nov 26 12:12:00 UTC 2007 Richard W.M. Jones * configure.in, src/console.c: Replace cfmakeraw if not in standard library. --- ChangeLog | 5 +++++ configure.in | 2 +- src/console.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6086350f6c..b283e7787a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 26 12:12:00 UTC 2007 Richard W.M. Jones + + * configure.in, src/console.c: Replace cfmakeraw if not in + standard library. + Mon Nov 26 12:03:00 UTC 2007 Richard W.M. Jones * tests/Makefile.am, tests/nodeinfotest.c, tests/qemuxml2argvtest.c, diff --git a/configure.in b/configure.in index 5c8582f764..6247d9c7d9 100644 --- a/configure.in +++ b/configure.in @@ -61,7 +61,7 @@ AM_PROG_CC_C_O LIBVIRT_COMPILE_WARNINGS(maximum) dnl Availability of various common functions (non-fatal if missing). -AC_CHECK_FUNCS([regexec]) +AC_CHECK_FUNCS([regexec cfmakeraw]) dnl Availability of various common headers (non-fatal if missing). AC_CHECK_HEADERS([paths.h sys/syslimits.h]) diff --git a/src/console.c b/src/console.c index 1342887ad2..ab83fcf800 100644 --- a/src/console.c +++ b/src/console.c @@ -20,6 +20,8 @@ * Daniel Berrange */ +#include "config.h" + #include #include #include @@ -42,6 +44,19 @@ static void do_signal(int sig ATTRIBUTE_UNUSED) { got_signal = 1; } +#ifndef HAVE_CFMAKERAW +static void +cfmakeraw (struct termios *attr) +{ + attr->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP + | INLCR | IGNCR | ICRNL | IXON); + attr->c_oflag &= ~OPOST; + attr->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + attr->c_cflag &= ~(CSIZE | PARENB); + attr->c_cflag |= CS8; +} +#endif /* !HAVE_CFMAKERAW */ + int vshRunConsole(const char *tty) { int ttyfd, ret = -1; struct termios ttyattr, rawattr;