aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Keith Winstein <keithw@mit.edu>2012-03-31 15:20:30 -0400
committerGravatar Keith Winstein <keithw@mit.edu>2012-03-31 15:20:30 -0400
commit9a7f3ad33d1ead81f6c2bff508a0e716e9e6d98e (patch)
treeb272116a8097f95765d1ce05eda22b92d3ed1490 /src
parent9119fa1c7df778328a97b2e6891b54f98bf9ce89 (diff)
Print warnings when IUTF8 missing
Diffstat (limited to 'src')
-rw-r--r--src/examples/parse.cc5
-rw-r--r--src/examples/termemu.cc4
-rw-r--r--src/frontend/mosh-server.cc4
-rw-r--r--src/frontend/stmclient.cc5
4 files changed, 17 insertions, 1 deletions
diff --git a/src/examples/parse.cc b/src/examples/parse.cc
index 87e3adb..728ff6d 100644
--- a/src/examples/parse.cc
+++ b/src/examples/parse.cc
@@ -31,6 +31,7 @@
#include <wctype.h>
#include <iostream>
#include <typeinfo>
+#include <termios.h>
#if HAVE_PTY_H
#include <pty.h>
@@ -65,10 +66,14 @@ int main( int argc __attribute__((unused)),
child_termios = saved_termios;
+#ifdef HAVE_IUTF8
if ( !(child_termios.c_iflag & IUTF8) ) {
fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" );
child_termios.c_iflag |= IUTF8;
}
+#else
+ fprintf( stderr, "Warning: termios IUTF8 flag not defined. Character-erase of multibyte character sequence probably does not work properly on this platform.\n" );
+#endif /* HAVE_IUTF8 */
pid_t child = forkpty( &master, NULL, &child_termios, NULL );
diff --git a/src/examples/termemu.cc b/src/examples/termemu.cc
index eb4e93b..f43afb6 100644
--- a/src/examples/termemu.cc
+++ b/src/examples/termemu.cc
@@ -74,10 +74,14 @@ int main( void )
child_termios = saved_termios;
+#ifdef HAVE_IUTF8
if ( !(child_termios.c_iflag & IUTF8) ) {
fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" );
child_termios.c_iflag |= IUTF8;
}
+#else
+ fprintf( stderr, "Warning: termios IUTF8 flag not defined. Character-erase of multibyte character sequence probably does not work properly on this platform.\n" );
+#endif /* HAVE_IUTF8 */
pid_t child = forkpty( &master, NULL, &child_termios, NULL );
diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc
index f45d47d..8b47ed9 100644
--- a/src/frontend/mosh-server.cc
+++ b/src/frontend/mosh-server.cc
@@ -265,11 +265,15 @@ int run_server( const char *desired_ip, const char *desired_port,
int master;
+#ifdef HAVE_IUTF8
if ( !(child_termios.c_iflag & IUTF8) ) {
/* SSH should also convey IUTF8 across connection. */
// fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" );
child_termios.c_iflag |= IUTF8;
}
+#else
+ fprintf( stderr, "\nWarning: termios IUTF8 flag not defined.\nCharacter-erase of multibyte character sequence\nprobably does not work properly on this platform.\n" );
+#endif /* HAVE_IUTF8 */
/* Fork child process */
pid_t child = forkpty( &master, NULL, &child_termios, &window_size );
diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc
index 2e2414f..b191914 100644
--- a/src/frontend/stmclient.cc
+++ b/src/frontend/stmclient.cc
@@ -62,11 +62,14 @@ void STMClient::init( void )
/* Put terminal driver in raw mode */
raw_termios = saved_termios;
+
+#ifdef HAVE_IUTF8
if ( !(raw_termios.c_iflag & IUTF8) ) {
- /* SSH should also convey IUTF8 across connection. */
// fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" );
+ /* Probably not really necessary since we are putting terminal driver into raw mode anyway. */
raw_termios.c_iflag |= IUTF8;
}
+#endif /* HAVE_IUTF8 */
cfmakeraw( &raw_termios );