#include #include #include #include int main(int argc, char *argv[]) { chdir("/nethack"); while(1) { pid_t pid = fork(); if (pid == 0) { execl("/nethack/nethack", "/nethack/nethack", NULL); } else { char buf[1]; waitpid(pid, NULL, 0); /* wait so user can see highscore list */ write(STDOUT_FILENO, "\n\nPress [Return] to restart.\n", 29); read(STDIN_FILENO, buf, sizeof(buf)); tcflush(STDIN_FILENO, TCIFLUSH); } } return 0; }