X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=blobdiff_plain;f=anykey.c;h=f11b0d7b031a4a3f94deefad037c861f828cdfc7;hp=be16ff11a37fa6895a4385d93665f890f2cb8b4e;hb=b4d72c27b716b729a35e5d985f11f69ef5e2fa8e;hpb=43e5747a59ed92243c217f7e36da2ac35bbcd80d diff --git a/anykey.c b/anykey.c index be16ff1..f11b0d7 100644 --- a/anykey.c +++ b/anykey.c @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the sigrok-cli project. * * Copyright (C) 2011 Bert Vermeulen * @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include "sigrok-cli.h" #include #ifdef _WIN32 #include @@ -26,23 +27,21 @@ #include #include #include -#include -#include "sigrok-cli.h" #ifdef _WIN32 -HANDLE stdin_handle; -DWORD stdin_mode; +static HANDLE stdin_handle; +static DWORD stdin_mode; #else -struct termios term_orig; +static struct termios term_orig; #endif -static int received_anykey(int fd, int revents, void *user_data) +static int received_anykey(int fd, int revents, void *cb_data) { - /* Avoid compiler warnings. */ (void)fd; (void)revents; - (void)user_data; + (void)cb_data; + sr_session_source_remove(STDIN_FILENO); sr_session_stop(); return TRUE; @@ -70,7 +69,7 @@ void add_anykey(void) sr_session_source_add(STDIN_FILENO, G_IO_IN, -1, received_anykey, NULL); - printf("Press any key to stop acquisition.\n"); + g_message("Press any key to stop acquisition."); } /* Restore stdin attributes. */