Re: [util-linux] [PATCH] agetty: map NL to CR-NL on output in initial termiossettings

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux