util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. Werner Fink" <werner@suse.de>
To: util-linux@vger.kernel.org
Subject: Re: [util-linux] [PATCH] agetty: map NL to CR-NL on output in initial termiossettings
Date: Wed, 19 Dec 2012 14:29:17 +0100	[thread overview]
Message-ID: <20121219132917.GA26228@boole.suse.de> (raw)
In-Reply-To: <20121219093346.GA17959@x2.net.home>

On Wed, Dec 19, 2012 at 10:33:46AM +0100, Karel Zak wrote:
> On Mon, Dec 10, 2012 at 01:34:39PM +0100, Dr. Werner Fink wrote:
> > > --- a/term-utils/agetty.c
> > > +++ b/term-utils/agetty.c
> > > @@ -1091,7 +1091,8 @@ static void termio_init(struct options *op, struct termios *tp)
> > >  #else
> > >  	tp->c_iflag = 0;
> > >  #endif
> > > -	tp->c_lflag = tp->c_oflag = 0;
> > > +	tp->c_lflag = 0;
> > > +	tp->c_oflag &= OPOST | ONLCR;
> > >  
> > >  	if ((op->flags & F_KEEPCFLAGS) == 0)
> > >  		tp->c_cflag = CS8 | HUPCL | CREAD | (tp->c_cflag & CLOCAL);
> > 
> > 
> > Indeed this should work even on some strange serial consoles.
> > Maybe this is also required for my patch set for sulogin as
> 
>  OK, applied to sulogin too.
> 
> > with this set sulogin supports not only virtual consoles but
> > also serial consoles as well.
> 
>  It seems that we duplicate some code in sulogin and agetty. 
> 
>  See: 
>     term-utils/agetty.c: termio_final()
>     login-utils/sulogin.c: tcfinal()
> 
>     (and maybe also tcinit() in sulogin.c)
> 
>  would be possible to merge this code and move it to include/ttyutils.h 
>  (or lib/ttyutils.c). I see small differences in the code, but not sure 
>  which version is better (I guess agetty as this code is tested on more
>  places).
> 
>  It would be nice to cleanup this before the next release to have only
>  one place (code) where we initialize terminal attributes.

This may require to move `struct chardata' from term-utils/agetty.c and
also from include/consoles.h as well as init_chardata from term-utils/agetty.c to
a new include/ttyutils.h ...  then the function caps_lock() from term-utils/agetty.c
could be moved to lib/ttyutils.c ... after this termio_final() could become
the core of tcfinal() after the two boolean.  Similar holds true for tcinit()
and termio_init().


     Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

  reply	other threads:[~2012-12-19 13:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-16  9:54 [PATCH] agetty: map NL to CR-NL on output in initial termios settings Dennis Jensen
2011-11-23 11:08 ` Karel Zak
2011-11-24 17:55   ` [PATCH] agetty: map NL to CR-NL on output in initial termiossettings Dennis Jensen
2011-11-28  9:35     ` Karel Zak
2012-12-10 12:34     ` Dr. Werner Fink
2012-12-19  9:33       ` Karel Zak
2012-12-19 13:29         ` Dr. Werner Fink [this message]
2012-12-19 14:28           ` [PATCH] Move struct chardata and init_chardata to ttyutils Werner Fink
2013-01-08 14:43             ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121219132917.GA26228@boole.suse.de \
    --to=werner@suse.de \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).