From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlIIX-0002Uw-2L for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:13:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlIIR-0002T8-NA for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:59 -0400 Received: from [199.232.76.173] (port=55978 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlIIR-0002T2-GZ for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36333) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlIIQ-0003hJ-RJ for qemu-devel@nongnu.org; Wed, 09 Sep 2009 04:12:55 -0400 From: Amit Shah Date: Wed, 9 Sep 2009 13:42:04 +0530 Message-Id: <1252483925-26336-6-git-send-email-amit.shah@redhat.com> In-Reply-To: <1252483925-26336-5-git-send-email-amit.shah@redhat.com> References: <1252483925-26336-1-git-send-email-amit.shah@redhat.com> <1252483925-26336-2-git-send-email-amit.shah@redhat.com> <1252483925-26336-3-git-send-email-amit.shah@redhat.com> <1252483925-26336-4-git-send-email-amit.shah@redhat.com> <1252483925-26336-5-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH 4/5] vnc: add a is_vnc_active() helper List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: Amit Shah This helper is introduced to query the status of vnc. Signed-off-by: Amit Shah --- vnc.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/vnc.c b/vnc.c index 5eaef6a..ff2d4a8 100644 --- a/vnc.c +++ b/vnc.c @@ -178,9 +178,17 @@ static void do_info_vnc_client(Monitor *mon, VncState *client) #endif } -void do_info_vnc(Monitor *mon) +static int is_vnc_active(void) { if (vnc_display == NULL || vnc_display->display == NULL) { + return 0; + } + return 1; +} + +void do_info_vnc(Monitor *mon) +{ + if (!is_vnc_active()) { monitor_printf(mon, "Server: disabled\n"); } else { char *serverAddr = vnc_socket_local_addr(" address: %s:%s\n", -- 1.6.2.5