mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Make it possible for a process to switch controlling terminals.
Via the TIOCSCTTY and TIOCNOTTY ioctls.
This commit is contained in:
parent
10308c6434
commit
49b63281a0
6 changed files with 31 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -7,8 +8,12 @@ int main(int argc, char** argv)
|
|||
(void) argv;
|
||||
|
||||
struct winsize ws;
|
||||
ioctl(0, TIOCGWINSZ, &ws);
|
||||
printf("Terminal is %ux%u\n", ws.ws_col, ws.ws_row);
|
||||
int rc = ioctl(0, TIOCGWINSZ, &ws);
|
||||
if (rc < 0) {
|
||||
perror("ioctl(TIOCGWINSZ)");
|
||||
}
|
||||
printf("TTY is %s\n", ttyname(0));
|
||||
printf("Terminal size is %ux%u\n", ws.ws_col, ws.ws_row);
|
||||
|
||||
printf("Counting to 100000: \033[s");
|
||||
for (unsigned i = 0; i <= 100000; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue