MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / console_init

Function console_init

tinyemu/temu.c:177–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177CharacterDevice *console_init(BOOL allow_ctrlc)
178{
179 CharacterDevice *dev;
180 STDIODevice *s;
181 struct sigaction sig;
182
183 term_init(allow_ctrlc);
184
185 dev = mallocz(sizeof(*dev));
186 s = mallocz(sizeof(*s));
187 s->stdin_fd = 0;
188 /* Note: the glibc does not properly tests the return value of
189 write() in printf, so some messages on stdout may be lost */
190 fcntl(s->stdin_fd, F_SETFL, O_NONBLOCK);
191
192 s->resize_pending = TRUE;
193 global_stdio_device = s;
194
195 /* use a signal to get the host terminal resize events */
196 sig.sa_handler = term_resize_handler;
197 sigemptyset(&sig.sa_mask);
198 sig.sa_flags = 0;
199 sigaction(SIGWINCH, &sig, NULL);
200
201 dev->opaque = s;
202 dev->write_data = console_write;
203 dev->read_data = console_read;
204 return dev;
205}
206
207#endif /* !_WIN32 */
208

Callers 1

mainFunction · 0.70

Calls 3

term_initFunction · 0.85
malloczFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected