From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiDIe-0003ZX-1T for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:16:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiDIZ-0003Yz-DK for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:16:23 -0400 Received: from [199.232.76.173] (port=51903 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiDIZ-0003Yp-9i for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:16:19 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:61892) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiDIY-00017Y-PV for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:16:19 -0400 From: Stefan Weil Date: Mon, 31 Aug 2009 22:16:16 +0200 Message-Id: <1251749776-15230-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] [PATCH] qemu-io: Improve portability (win32 now supported). List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org * Add missing include for struct timeval. * Replace non-portable strsep by local qemu_strsep. * Use POSIX basename by including libgen.h. Signed-off-by: Stefan Weil --- cmd.c | 23 ++++++++++++++++++++++- configure | 2 ++ qemu-io.c | 2 ++ 3 files changed, 26 insertions(+), 1 deletions(-) diff --git a/cmd.c b/cmd.c index f3f4385..d86ba7c 100644 --- a/cmd.c +++ b/cmd.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "cmd.h" @@ -283,6 +284,26 @@ fetchline(void) } #endif +static char *qemu_strsep(char **input, const char *delim) +{ + char *result = *input; + if (result != NULL) { + char *p = result; + for (p = result; *p != '\0'; p++) { + if (strchr(delim, *p)) { + break; + } + } + if (*p == '\0') { + *input = NULL; + } else { + *p = '\0'; + *input = p + 1; + } + } + return result; +} + char ** breakline( char *input, @@ -292,7 +313,7 @@ breakline( char *p; char **rval = calloc(sizeof(char *), 1); - while (rval && (p = strsep(&input, " ")) != NULL) { + while (rval && (p = qemu_strsep(&input, " ")) != NULL) { if (!*p) continue; c++; diff --git a/configure b/configure index 47fb57c..61ce1f6 100755 --- a/configure +++ b/configure @@ -1919,6 +1919,8 @@ if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then tools="qemu-img\$(EXESUF) $tools" if [ "$linux" = "yes" ] ; then tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools" + elif test "$mingw32" = "yes" ; then + tools="qemu-io\$(EXESUF) $tools" fi fi echo "TOOLS=$tools" >> $config_host_mak diff --git a/qemu-io.c b/qemu-io.c index f96a4de..cac72e9 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -7,10 +7,12 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include #include #include #include #include +#include #include "qemu-common.h" #include "block_int.h" -- 1.5.6.5