Am 19.05.14 21:54, schrieb Christos Zoulas: > Module Name: src > Committed By: christos > Date: Mon May 19 19:54:12 UTC 2014 > > Modified Files: > src/lib/libedit: tty.c tty.h > > Log Message: > more tty modes refactoring, no functional change intended. > > > To generate a diff of this commit: > cvs rdiff -u -r1.43 -r1.44 src/lib/libedit/tty.c > cvs rdiff -u -r1.14 -r1.15 src/lib/libedit/tty.h > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. > > > > Modified files: > > Index: src/lib/libedit/tty.c > diff -u src/lib/libedit/tty.c:1.43 src/lib/libedit/tty.c:1.44 > --- src/lib/libedit/tty.c:1.43 Mon May 19 13:14:41 2014 > +++ src/lib/libedit/tty.c Mon May 19 15:54:12 2014 > @@ -1,4 +1,4 @@ > -/* $NetBSD: tty.c,v 1.43 2014/05/19 17:14:41 christos Exp $ */ > +/* $NetBSD: tty.c,v 1.44 2014/05/19 19:54:12 christos Exp $ */ > > /*- > * Copyright (c) 1992, 1993 > @@ -37,7 +37,7 @@ > #if 0 > static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; > #else > -__RCSID("$NetBSD: tty.c,v 1.43 2014/05/19 17:14:41 christos Exp $"); > +__RCSID("$NetBSD: tty.c,v 1.44 2014/05/19 19:54:12 christos Exp $"); > #endif > #endif /* not lint && not SCCSID */ > > @@ -919,6 +919,58 @@ tty_bind_char(EditLine *el, int force) > } > > > +private tcflag_t *
private? I think you mean static, right? > +tty__get_flag(struct termios *t, int kind) { > + switch (kind) { > + case MD_INP: > + return &t->c_iflag; > + case MD_OUT: > + return &t->c_oflag; > + case MD_CTL: > + return &t->c_cflag; > + case MD_LIN: > + return &t->c_lflag; > + default: > + abort(); > + /*NOTREACHED*/ > + } > +} > + > + > +private tcflag_t dito > +tty_update_flag(EditLine *el, tcflag_t f, int mode, int kind) > +{ > + f &= ~el->el_tty.t_t[mode][kind].t_clrmask; > + f |= el->el_tty.t_t[mode][kind].t_setmask; > + return f; > +} > + > + > +private void dito > +tty_update_flags(EditLine *el, int kind) > +{ > + tcflag_t *tt, *ed, *ex; > + tt = tty__get_flag(&el->el_tty.t_ts, kind); > + ed = tty__get_flag(&el->el_tty.t_ed, kind); > + ex = tty__get_flag(&el->el_tty.t_ex, kind); > + > + if (*tt != *ex && (kind != MD_CTL || *tt != *ed)) { > + *ed = tty_update_flag(el, *tt, ED_IO, kind); > + *ex = tty_update_flag(el, *tt, EX_IO, kind); > + } > +} > + > + > +private void dito > +tty_update_char(EditLine *el, int mode, int c) { > + if (!((el->el_tty.t_t[mode][MD_CHAR].t_setmask & C_SH(c))) > + && (el->el_tty.t_c[TS_IO][c] != el->el_tty.t_c[EX_IO][c])) > + el->el_tty.t_c[mode][c] = el->el_tty.t_c[TS_IO][c]; > + if (el->el_tty.t_t[mode][MD_CHAR].t_clrmask & C_SH(c)) > + el->el_tty.t_c[mode][c] = el->el_tty.t_vdisable; > +} > + > + [...] Christoph