MCPcopy Create free account
hub / github.com/NetHack/NetHack / setftty

Function setftty

sys/share/unixtty.c:250–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void
251setftty(void)
252{
253 unsigned ef, cf;
254 int change = 0;
255
256 ef = 0; /* desired value of flags & ECHO */
257 cf = CBRKON(CBRKMASK); /* desired value of flags & CBREAK */
258 iflags.cbreak = ON;
259 iflags.echo = OFF;
260 /* Should use (ECHO|CRMOD) here instead of ECHO */
261 if ((unsigned) (curttyb.echoflgs & ECHO) != ef) {
262 curttyb.echoflgs &= ~ECHO;
263 /* curttyb.echoflgs |= ef; */
264 change++;
265 }
266 if ((unsigned) (curttyb.cbrkflgs & CBRKMASK) != cf) {
267 curttyb.cbrkflgs &= ~CBRKMASK;
268 curttyb.cbrkflgs |= cf;
269#ifdef USG
270 /* be satisfied with one character; no timeout */
271 curttyb.c_cc[VMIN] = 1; /* was VEOF */
272 curttyb.c_cc[VTIME] = 0; /* was VEOL */
273#ifdef POSIX_JOB_CONTROL
274/* turn off system suspend character
275 * due to differences in structure layout, this has to be
276 * here instead of in ioctl.c:getioctls() with the BSD
277 * equivalent
278 */
279#ifdef VSUSP /* real POSIX */
280 curttyb.c_cc[VSUSP] = nonesuch;
281#else /* other later SYSV */
282 curttyb.c_cc[VSWTCH] = nonesuch;
283#endif
284#endif
285#ifdef VDSUSP /* SunOS Posix extensions */
286 curttyb.c_cc[VDSUSP] = nonesuch;
287#endif
288#ifdef VREPRINT
289 curttyb.c_cc[VREPRINT] = nonesuch;
290#endif
291#ifdef VDISCARD
292 curttyb.c_cc[VDISCARD] = nonesuch;
293#endif
294#ifdef VWERASE
295 curttyb.c_cc[VWERASE] = nonesuch;
296#endif
297#ifdef VLNEXT
298 curttyb.c_cc[VLNEXT] = nonesuch;
299#endif
300#endif
301 change++;
302 }
303 if (!IS_7BIT(inittyb))
304 curttyb.inputflags &= ~STRIPHI;
305 /* If an interrupt character is used, it will be overridden and
306 * set to ^C.
307 */

Callers

nothing calls this directly

Calls 2

setcttyFunction · 0.70
term_start_screenFunction · 0.50

Tested by

no test coverage detected