#include #include #include #include #include int main(int argc, char **argv) { if (argc < 2) { printf("usage: %s ROM\n", argv[0]); return 1; } char *rom = argv[1]; int fd = -1; pid_t pid = forkpty(&fd, NULL, NULL, NULL); if (pid == 0) { // child setenv("TERM", "ansi", 1); execlp("bash", "bash"); } else { // parent char *argp = {0, 40, 0, 79, 0, 8, 0, 8}; // HHHH: height, width, 8, 8 ioctl(fd, TIOCSWINSZ, argp); dup2(fd, STDIN); dup2(dup(fd), STDOUT); execlp("uxnemu", "uxnemu", rom); } }