diff options
author | Kevin Lange <kevin.lange@phpwnage.com> | 2011-12-02 12:51:08 -0800 |
---|---|---|
committer | Kevin Lange <kevin.lange@phpwnage.com> | 2011-12-02 12:51:08 -0800 |
commit | 2f5c5f61289d40610c2f9ab6b7eea706af05dc69 (patch) | |
tree | 41fd4010f17f980cc91d0b4b19763727502bf0a9 /src | |
parent | c0487d5ca476da43c7869261b031c119cc2908bb (diff) | |
parent | a51ae10140af9f408536b588516fadd4708e8b36 (diff) | |
download | nyancat-2f5c5f61289d40610c2f9ab6b7eea706af05dc69.tar.gz |
Merge pull request #10 from TheAlphaNerd/master
Added SIGINT_Handler
Diffstat (limited to '')
-rw-r--r-- | src/nyancat.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nyancat.c b/src/nyancat.c index cd109de..ab36280 100644 --- a/src/nyancat.c +++ b/src/nyancat.c @@ -34,6 +34,7 @@ #include <string.h> #include <stdlib.h> #include <unistd.h> +#include <signal.h> char * colors[256] = {NULL}; @@ -853,10 +854,16 @@ char * output = " "; #define MIN_COL 10 #define MAX_COL 50 +void SIGINT_handler(int sig){ + printf("\033[?25h"); + exit(0); +} + int main(int argc, char ** argv) { printf("\033[H\033[2J"); fflush(stdout); int always_escape = 0; + signal(SIGINT, SIGINT_handler); try_again: printf("Select a mode:\n"); printf(" 1 xterm 256-color compatible mode (best)\n"); @@ -1025,6 +1032,5 @@ try_again: printf("\033[H"); usleep(90000); } - return 0; } |