MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / tty_rawmode

Function tty_rawmode

extern/editline/src/tty.c:978–1057  ·  view source on GitHub ↗

tty_rawmode(): * Set terminal into 1 character at a time mode. */

Source from the content-addressed store, hash-verified

976 * Set terminal into 1 character at a time mode.
977 */
978protected int
979tty_rawmode(EditLine *el)
980{
981
982 if (el->el_tty.t_mode == ED_IO || el->el_tty.t_mode == QU_IO)
983 return 0;
984
985 if (el->el_flags & EDIT_DISABLED)
986 return 0;
987
988 if (tty_getty(el, &el->el_tty.t_ts) == -1) {
989#ifdef DEBUG_TTY
990 (void) fprintf(el->el_errfile, "%s: tty_getty: %s\n", __func__,
991 strerror(errno));
992#endif /* DEBUG_TTY */
993 return -1;
994 }
995 /*
996 * We always keep up with the eight bit setting and the speed of the
997 * tty. But we only believe changes that are made to cooked mode!
998 */
999 el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts);
1000 el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts);
1001
1002 if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed ||
1003 tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) {
1004 (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed);
1005 (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed);
1006 (void) cfsetispeed(&el->el_tty.t_ed, el->el_tty.t_speed);
1007 (void) cfsetospeed(&el->el_tty.t_ed, el->el_tty.t_speed);
1008 }
1009 if (tty__cooked_mode(&el->el_tty.t_ts)) {
1010 int i;
1011
1012 for (i = MD_INP; i <= MD_LIN; i++)
1013 tty_update_flags(el, i);
1014
1015 if (tty__gettabs(&el->el_tty.t_ex) == 0)
1016 el->el_tty.t_tabs = 0;
1017 else
1018 el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0;
1019
1020 tty__getchar(&el->el_tty.t_ts, el->el_tty.t_c[TS_IO]);
1021 /*
1022 * Check if the user made any changes.
1023 * If he did, then propagate the changes to the
1024 * edit and execute data structures.
1025 */
1026 for (i = 0; i < C_NCC; i++)
1027 if (el->el_tty.t_c[TS_IO][i] !=
1028 el->el_tty.t_c[EX_IO][i])
1029 break;
1030
1031 if (i != C_NCC) {
1032 /*
1033 * Propagate changes only to the unprotected
1034 * chars that have been modified just now.
1035 */

Callers 6

sig_handlerFunction · 0.85
FUN(el,set)Function · 0.85
el_editmodeFunction · 0.85
FUN(el,getc)Function · 0.85
read_prepareFunction · 0.85
FUN(el,gets)Function · 0.85

Calls 8

tty_gettyFunction · 0.85
tty__getspeedFunction · 0.85
tty_update_flagsFunction · 0.85
tty__getcharFunction · 0.85
tty_update_charFunction · 0.85
tty_bind_charFunction · 0.85
tty__setcharFunction · 0.85
tty_settyFunction · 0.85

Tested by

no test coverage detected