From patchwork Thu Jan 20 03:28:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 79635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 99E47B70AF for ; Thu, 20 Jan 2011 14:28:40 +1100 (EST) Received: from localhost ([127.0.0.1]:48407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PflCO-0000O6-A4 for incoming@patchwork.ozlabs.org; Wed, 19 Jan 2011 22:28:36 -0500 Received: from [140.186.70.92] (port=48574 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PflBv-0000O1-3g for qemu-devel@nongnu.org; Wed, 19 Jan 2011 22:28:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PflBt-0007A1-OX for qemu-devel@nongnu.org; Wed, 19 Jan 2011 22:28:06 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:14133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PflBt-00079s-Bi for qemu-devel@nongnu.org; Wed, 19 Jan 2011 22:28:05 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.69) (envelope-from ) id 1PflBq-0000rE-0Q; Thu, 20 Jan 2011 03:28:02 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 20 Jan 2011 03:28:02 +0000 Message-Id: <1295494082-3275-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Riku Voipio , patches@linaro.org Subject: [Qemu-devel] [PATCH] linux-user: Add support for -version option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add support to the linux-user qemu for the -version command line option, bringing it into line with the system emulation qemu. Signed-off-by: Peter Maydell --- linux-user/main.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 0d627d6..e651bfd 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -2624,14 +2624,21 @@ void cpu_loop (CPUState *env) } #endif /* TARGET_ALPHA */ +static void version(void) +{ + printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION + ", Copyright (c) 2003-2008 Fabrice Bellard\n"); +} + static void usage(void) { - printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n" - "usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" + version(); + printf("usage: qemu-" TARGET_ARCH " [options] program [arguments...]\n" "Linux CPU emulator (compiled for %s emulation)\n" "\n" "Standard options:\n" "-h print this help\n" + "-version display version information and exit\n" "-g port wait gdb connection to port\n" "-L path set the elf interpreter prefix (default=%s)\n" "-s size set the stack size in bytes (default=%ld)\n" @@ -2886,8 +2893,10 @@ int main(int argc, char **argv, char **envp) singlestep = 1; } else if (!strcmp(r, "strace")) { do_strace = 1; - } else - { + } else if (!strcmp(r, "version")) { + version(); + exit(0); + } else { usage(); } }