summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/nyancat.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nyancat.c b/src/nyancat.c
index 5f5939f..46cd6c1 100644
--- a/src/nyancat.c
+++ b/src/nyancat.c
@@ -213,14 +213,21 @@ int main(int argc, char ** argv) {
}
}
+ /* Set the alarm handler to execute the longjmp */
signal(SIGALRM, SIGALRM_handler);
+
/* Negotiate options */
if (!setjmp(environment)) {
+ /* We will stop handling options after one second */
alarm(1);
+
+ /* Let's do this */
while (!feof(stdin) && !done) {
+ /* Get either IAC (start command) or a regular character (break, unless in SB mode) */
unsigned char i = getchar();
unsigned char opt = 0;
if (i == IAC) {
+ /* If IAC, get the command */
i = getchar();
switch (i) {
case SE:
@@ -286,8 +293,6 @@ int main(int argc, char ** argv) {
sb[sb_len] = i;
sb_len++;
}
- } else {
- goto ready;
}
}
}
/td>-28/+347 SimpleLCD driver added 2005-02-24[lcd4linux @ 2005-02-24 06:51:40 by reinelt]reinelt1-4/+5 LCD-Linux driver GOTO_COST corrected 2005-01-30[lcd4linux @ 2005-01-30 06:43:22 by reinelt]reinelt4-69/+95 driver for LCD-Linux finished 2005-01-29[lcd4linux @ 2005-01-29 09:30:56 by reinelt]reinelt1-8/+11 minor HD44780 cleanups 2005-01-22[lcd4linux @ 2005-01-22 22:57:57 by reinelt]reinelt9-47/+382 LCD-Linux driver added 2005-01-22[lcd4linux @ 2005-01-22 12:44:41 by reinelt]reinelt1-3/+6 MatrixOrbital backlight micro-fix 2005-01-18[lcd4linux @ 2005-01-18 06:30:21 by reinelt]reinelt89-261/+603 added (C) to all copyright statements 2005-01-17[lcd4linux @ 2005-01-17 06:38:48 by reinelt]reinelt1-1/+6 info about backlight and brightness 2005-01-17[lcd4linux @ 2005-01-17 06:29:24 by reinelt]reinelt3-33/+85 added software-controlled backlight support to HD44780