From aa8f2cbf335943f80fa8bf5f8ce646b99ef566b6 Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Wed, 29 Feb 2012 22:27:18 +0100 Subject: [PATCH] example/x11: Set raw terminal mode manually instead of with cfmakeraw() OpenSolaris has no cfmakeraw() so to make the example more portable we simply do the equivalent operations on struct termios ourselves. Thanks to Tom Weber for reporting this problem, and finding a solution. --- example/x11.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/example/x11.c b/example/x11.c index cff451c..86dca0f 100644 --- a/example/x11.c +++ b/example/x11.c @@ -79,7 +79,12 @@ static int _raw_mode(void) rc = tcgetattr(fileno(stdin), &tio); if (rc != -1) { _saved_tio = tio; - cfmakeraw(&tio); + /* do the equivalent of cfmakeraw() manually, to build on Solaris */ + tio.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + tio.c_oflag &= ~OPOST; + tio.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + tio.c_cflag &= ~(CSIZE|PARENB); + tio.c_cflag |= CS8; rc = tcsetattr(fileno(stdin), TCSADRAIN, &tio); } return rc;