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

Function tty_stty

extern/editline/src/tty.c:1134–1289  ·  view source on GitHub ↗

tty_stty(): * Stty builtin */

Source from the content-addressed store, hash-verified

1132 * Stty builtin
1133 */
1134protected int
1135/*ARGSUSED*/
1136tty_stty(EditLine *el, int argc __attribute__((__unused__)), const Char **argv)
1137{
1138 const ttymodes_t *m;
1139 char x;
1140 int aflag = 0;
1141 const Char *s, *d;
1142 char name[EL_BUFSIZ];
1143 struct termios *tios = &el->el_tty.t_ex;
1144 int z = EX_IO;
1145
1146 if (argv == NULL)
1147 return -1;
1148 strncpy(name, ct_encode_string(*argv++, &el->el_scratch), sizeof(name));
1149 name[sizeof(name) - 1] = '\0';
1150
1151 while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0')
1152 switch (argv[0][1]) {
1153 case 'a':
1154 aflag++;
1155 argv++;
1156 break;
1157 case 'd':
1158 argv++;
1159 tios = &el->el_tty.t_ed;
1160 z = ED_IO;
1161 break;
1162 case 'x':
1163 argv++;
1164 tios = &el->el_tty.t_ex;
1165 z = EX_IO;
1166 break;
1167 case 'q':
1168 argv++;
1169 tios = &el->el_tty.t_ts;
1170 z = QU_IO;
1171 break;
1172 default:
1173 (void) fprintf(el->el_errfile,
1174 "%s: Unknown switch `%c'.\n",
1175 name, argv[0][1]);
1176 return -1;
1177 }
1178
1179 if (!argv || !*argv) {
1180 int i = -1;
1181 size_t len = 0, st = 0, cu;
1182 for (m = ttymodes; m->m_name; m++) {
1183 if (m->m_type != i) {
1184 (void) fprintf(el->el_outfile, "%s%s",
1185 i != -1 ? "\n" : "",
1186 el->el_tty.t_t[z][m->m_type].t_name);
1187 i = m->m_type;
1188 st = len =
1189 strlen(el->el_tty.t_t[z][m->m_type].t_name);
1190 }
1191 if (i != -1) {

Callers 2

el_setFunction · 0.85
FUN(el,set)Function · 0.85

Calls 6

ct_encode_stringFunction · 0.85
parse__escapeFunction · 0.85
assertClass · 0.85
tty__getcharindexFunction · 0.85
tty_setup_flagsFunction · 0.85
tty_settyFunction · 0.85

Tested by

no test coverage detected