diff options
Diffstat (limited to 'init.c')
| -rw-r--r-- | init.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#include <termios.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> + +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; +} |
