bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inconsistent output in terminal emulator


From: nico raffo
Subject: Re: Inconsistent output in terminal emulator
Date: Mon, 24 Aug 2009 16:58:12 -0700

On Sat, Aug 22, 2009 at 5:30 PM, Chet Ramey <chet.ramey@case.edu> wrote:
>
> Bob Proulx wrote:
> > nico raffo wrote:
> >> I'm writing a simple terminal emulator (on linux using standard pty
> >> libraries) and have run across some behavior in bash that I cannot
> >> explain after several weeks of reading documentation.
> >
> > I am not sure of the exact cause of your trouble.  But having been a
> > few days and no one else suggesting anything I thought I would jump in
> > anyway.
> >
> > Hopefully you will be using a free license on your code?  And then you
> > could post it and perhaps someone might see something in it then.
> >
> >> However with bash, the shell doesn't respond at all until a
> >> <CR> is sent, and then bash only sends the output of the command, not
> >> the command itself. If my terminal emulator is expecting the shell to
> >> provide all display text, it wouldn't show the commands at all.
> >
> > This seems like you are tripping into the difference between different
> > tty driver settings of raw mode and canonical input mode (aka cooked
> > mode).
>
> I think it's how the terminal emulator sets the ECHO flag in the
> termios local status word (c_lflag & ECHO).  If that bit is set,
> readline echoes the text it reads back to the terminal.  If it's
> not, readline assumes that the terminal is in no-echo mode and that
> it should not echo the characters.
>
> I assume that the difference between bash and zsh is that zsh sets
> the ECHO bit and leaves it set when it exits.  A subsequent invocation
> of bash picks up that flag and echoes input as a result.
>
> Chet

Thanks for pointing me in the right direction. The ECHO flag did the trick.

Nico




reply via email to

[Prev in Thread] Current Thread [Next in Thread]