From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MsbSr-00051u-S0 for qemu-devel@nongnu.org; Tue, 29 Sep 2009 08:05:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MsbSm-00050p-DP for qemu-devel@nongnu.org; Tue, 29 Sep 2009 08:05:53 -0400 Received: from [199.232.76.173] (port=56964 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MsbSl-00050e-UI for qemu-devel@nongnu.org; Tue, 29 Sep 2009 08:05:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62300) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MsbSl-0004Tv-9y for qemu-devel@nongnu.org; Tue, 29 Sep 2009 08:05:47 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8TC5kQh015962 for ; Tue, 29 Sep 2009 08:05:46 -0400 From: Amit Shah Date: Tue, 29 Sep 2009 17:34:47 +0530 Message-Id: <1254225888-17093-6-git-send-email-amit.shah@redhat.com> In-Reply-To: <1254225888-17093-5-git-send-email-amit.shah@redhat.com> References: <1254225888-17093-1-git-send-email-amit.shah@redhat.com> <1254225888-17093-2-git-send-email-amit.shah@redhat.com> <1254225888-17093-3-git-send-email-amit.shah@redhat.com> <1254225888-17093-4-git-send-email-amit.shah@redhat.com> <1254225888-17093-5-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH 5/6] 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 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