MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ttcompatgetflags

Function ttcompatgetflags

freebsd/kern/tty_compat.c:275–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275static int
276ttcompatgetflags(struct tty *tp)
277{
278 tcflag_t iflag = tp->t_termios.c_iflag;
279 tcflag_t lflag = tp->t_termios.c_lflag;
280 tcflag_t oflag = tp->t_termios.c_oflag;
281 tcflag_t cflag = tp->t_termios.c_cflag;
282 int flags = 0;
283
284 if (iflag&IXOFF)
285 flags |= TANDEM;
286 if (iflag&ICRNL || oflag&ONLCR)
287 flags |= CRMOD;
288 if ((cflag&CSIZE) == CS8) {
289 flags |= PASS8;
290 if (iflag&ISTRIP)
291 flags |= ANYP;
292 }
293 else if (cflag&PARENB) {
294 if (iflag&INPCK) {
295 if (cflag&PARODD)
296 flags |= ODDP;
297 else
298 flags |= EVENP;
299 } else
300 flags |= EVENP | ODDP;
301 }
302
303 if ((lflag&ICANON) == 0) {
304 /* fudge */
305 if (iflag&(INPCK|ISTRIP|IXON) || lflag&(IEXTEN|ISIG)
306 || (cflag&(CSIZE|PARENB)) != CS8)
307 flags |= CBREAK;
308 else
309 flags |= RAW;
310 }
311 if (!(flags&RAW) && !(oflag&OPOST) && (cflag&(CSIZE|PARENB)) == CS8)
312 flags |= LITOUT;
313 if (cflag&MDMBUF)
314 flags |= MDMBUF;
315 if ((cflag&HUPCL) == 0)
316 flags |= NOHANG;
317 if (oflag&TAB3)
318 flags |= XTABS;
319 if (lflag&ECHOE)
320 flags |= CRTERA|CRTBS;
321 if (lflag&ECHOKE)
322 flags |= CRTKIL|CRTBS;
323 if (lflag&ECHOPRT)
324 flags |= PRTERA;
325 if (lflag&ECHOCTL)
326 flags |= CTLECH;
327 if ((iflag&IXANY) == 0)
328 flags |= DECCTQ;
329 flags |= lflag&(ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH);
330 if (ttydebug)
331 printf("getflags: %x\n", flags);
332 return (flags);

Callers 2

ttsetcompatFunction · 0.85
tty_ioctl_compatFunction · 0.85

Calls 1

printfFunction · 0.70

Tested by

no test coverage detected