On Tue, Aug 02, 2011 at 12:09:23AM +0200, Samuel Thibault wrote: > Hello, > > Currently, agetty always clears the IUTF8 flag. This poses problem on > linux utf8 consoles when for instance running cat (in canonical mode), > type a non-ascii character, type backspace, then enter, and finally > control-D: the kernel only dropped one of the bytes coding the non-ascii > character. The IUTF8 flag should thus be set at some point. It happens > that the kernel already sets up the IUTF8 flag correctly. agetty simply > has to preserve it, as the patch below implements. > > Samuel > > > agetty: Fix IUTF8 flag > > Preserve IUTF8 as set up by the kernel, which knows which consoles are > in utf8 mode. > > Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> > > diff --git a/term-utils/agetty.c b/term-utils/agetty.c > index 6120a26..21c056e 100644 > --- a/term-utils/agetty.c > +++ b/term-utils/agetty.c > @@ -977,7 +977,8 @@ static void termio_init(struct options *op, struct termios *tp) > /* Flush input and output queues, important for modems! */ > tcflush(STDIN_FILENO, TCIOFLUSH); > > - tp->c_iflag = tp->c_lflag = tp->c_oflag = 0; > + tp->c_iflag = tp->c_iflag & IUTF8; > + tp->c_lflag = tp->c_oflag = 0; > > if ((op->flags & F_KEEPCFLAGS) == 0) > tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL); Maybe it would be an option to surround this with an `#ifdef IUTF8 ... #else .. #endif' for system not knowing about IUTF8 as well as add the line op->flags |= F_UTF8; for the IUTF8 branch to be abel to use later on the multibyte account name support? Werner -- "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr
agetty: Fix IUTF8 flag Preserve IUTF8 as set up by the kernel, which knows which consoles are in utf8 mode. Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> Signed-off-by: Werner Fink <werner@xxxxxxx> --- term-utils/agetty.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 6120a26..203668e 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -977,7 +977,13 @@ static void termio_init(struct options *op, struct termios *tp) /* Flush input and output queues, important for modems! */ tcflush(STDIN_FILENO, TCIOFLUSH); - tp->c_iflag = tp->c_lflag = tp->c_oflag = 0; +#ifdef IUTF8 + tp->c_iflag = tp->c_iflag & IUTF8; + op->flags |= F_UTF8; +#else + tp->c_iflag = 0; +#endif + tp->c_lflag = tp->c_oflag = 0; if ((op->flags & F_KEEPCFLAGS) == 0) tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);