diff options
author | James Booth <boothj5@gmail.com> | 2012-03-10 20:37:42 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-03-10 20:37:42 +0000 |
commit | 3d8b1a5a4c0442c85661bee7a4d9f70755ec5c47 (patch) | |
tree | d8e9b73b805f89e02d5428ac828a944112e854d5 | |
parent | 9ae213254935335e452f0979a1d88206faf6e246 (diff) | |
download | profani-tty-3d8b1a5a4c0442c85661bee7a4d9f70755ec5c47.tar.gz |
Added atexit callback, for ctrl-c cleanup
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | profanity.c | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/main.c b/main.c index 97a69391..392b9ef6 100644 --- a/main.c +++ b/main.c @@ -47,7 +47,7 @@ int main(int argc, char **argv) profanity_init(disable_tls); profanity_run(); - profanity_shutdown(); + //profanity_shutdown(); return 0; } diff --git a/profanity.c b/profanity.c index 3470e7e1..5f07b8a8 100644 --- a/profanity.c +++ b/profanity.c @@ -21,7 +21,7 @@ */ #include <string.h> -#include <unistd.h> +#include <stdlib.h> #include <ncurses.h> @@ -32,6 +32,8 @@ #include "command.h" #include "history.h" +static void _profanity_shutdown(void); + void profanity_run(void) { int cmd_result = TRUE; @@ -43,7 +45,6 @@ void profanity_run(void) int size = 0; while(ch != '\n') { - usleep(1); gui_refresh(); jabber_process_events(); win_handle_switch(&ch); @@ -64,9 +65,10 @@ void profanity_init(const int disable_tls) gui_init(); jabber_init(disable_tls); history_init(); + atexit(_profanity_shutdown); } -void profanity_shutdown(void) +void _profanity_shutdown(void) { jabber_disconnect(); gui_close(); |