From 91f5cc7b07c5f54e80d6cb8488637ede2837e5a1 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 5 May 2010 11:32:37 +0000 Subject: [PATCH] Shouldn't exit out of dgl while watching ttyrecs. git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@551 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- ttyplay.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ttyplay.c b/ttyplay.c index 99aa70a..6c3b043 100644 --- a/ttyplay.c +++ b/ttyplay.c @@ -144,6 +144,7 @@ ttyplay_keyboard_action(int c) struct termios t; switch (c) { + case ERR: case 'q': return READ_QUIT; case 'r': @@ -213,14 +214,14 @@ ttyread (FILE * fp, Header * h, char **buf, int pread) { fprintf (stderr, "h->len too big (%ld) limit %ld\n", (long)h->len, (long)BUFSIZ); - exit (-21); + return READ_QUIT; } *buf = malloc (h->len + 1); if (*buf == NULL) { perror ("malloc"); - exit (-22); + return READ_QUIT; } if (fread (*buf, 1, h->len, fp) != h->len) @@ -253,7 +254,7 @@ ttypread (FILE * fp, Header * h, char **buf, int pread) if (kq == -1) { printf ("kqueue() failed.\n"); - exit (1); + return READ_QUIT; } #endif @@ -299,7 +300,7 @@ ttypread (FILE * fp, Header * h, char **buf, int pread) */ endwin (); printf ("Exiting due to 20 minutes of inactivity.\n"); - exit (-23); + return READ_QUIT; } FD_ZERO (&readfs); FD_SET (STDIN_FILENO, &readfs); @@ -314,7 +315,7 @@ ttypread (FILE * fp, Header * h, char **buf, int pread) return READ_RESTART; } else { printf("select()/kevent() failed.\n"); - exit (1); + return READ_QUIT; } } if (doread)