From 12f4f45d9b3fcc90ff13961d90770c062c65e42c Mon Sep 17 00:00:00 2001 From: Christophe Bothamy Date: Fri, 30 Apr 2004 17:26:38 +0000 Subject: [PATCH] - apply patch [ 903332 ] copy the bximage result to clipboard, etc by lukewarm --- bochs/misc/bxcommit.c | 21 +++++++++++++++++++-- bochs/misc/bximage.c | 23 ++++++++++++++++++----- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/bochs/misc/bxcommit.c b/bochs/misc/bxcommit.c index bd2877891..59b10a230 100644 --- a/bochs/misc/bxcommit.c +++ b/bochs/misc/bxcommit.c @@ -1,6 +1,6 @@ /* * misc/bximage.c - * $Id: bxcommit.c,v 1.6 2004-04-28 17:56:47 cbothamy Exp $ + * $Id: bxcommit.c,v 1.7 2004-04-30 17:26:38 cbothamy Exp $ * * Commits a redolog file in a flat file for bochs images. * @@ -27,6 +27,23 @@ #include +#if !BX_HAVE_SNPRINTF +#include +/* XXX use real snprintf */ +/* if they don't have snprintf, just use sprintf */ +int snprintf (char *s, size_t maxlen, const char *format, ...) +{ + va_list arg; + int done; + + va_start (arg, format); + done = vsprintf (s, format, arg); + va_end (arg); + + return done; +} +#endif /* !BX_HAVE_SNPRINTF */ + #define uint8 Bit8u #define uint16 Bit16u #define uint32 Bit32u @@ -35,7 +52,7 @@ #include "../iodev/harddrv.h" char *EOF_ERR = "ERROR: End of input"; -char *rcsid = "$Id: bxcommit.c,v 1.6 2004-04-28 17:56:47 cbothamy Exp $"; +char *rcsid = "$Id: bxcommit.c,v 1.7 2004-04-30 17:26:38 cbothamy Exp $"; char *divider = "========================================================================"; void myexit (int code) diff --git a/bochs/misc/bximage.c b/bochs/misc/bximage.c index 84502aace..72a2eca11 100644 --- a/bochs/misc/bximage.c +++ b/bochs/misc/bximage.c @@ -1,19 +1,20 @@ /* * misc/bximage.c - * $Id: bximage.c,v 1.19 2003-08-01 01:20:00 cbothamy Exp $ + * $Id: bximage.c,v 1.20 2004-04-30 17:26:37 cbothamy Exp $ * * Create empty hard disk or floppy disk images for bochs. * */ +#ifdef WIN32 +# include +# include +#endif #include #include #include #include #include -#ifdef WIN32 -# include -#endif #include "config.h" #include @@ -26,7 +27,7 @@ #include "../iodev/harddrv.h" char *EOF_ERR = "ERROR: End of input"; -char *rcsid = "$Id: bximage.c,v 1.19 2003-08-01 01:20:00 cbothamy Exp $"; +char *rcsid = "$Id: bximage.c,v 1.20 2004-04-30 17:26:37 cbothamy Exp $"; char *divider = "========================================================================"; /* menu data for choosing floppy/hard disk */ @@ -485,6 +486,18 @@ int main() printf ("\nI wrote %lld bytes to %s.\n", sectors*512, filename); printf ("\nThe following line should appear in your bochsrc:\n"); printf (" %s\n", bochsrc_line); +#ifdef WIN32 + if (OpenClipboard(NULL)) { + HGLOBAL hgClip; + + EmptyClipboard(); + hgClip = GlobalAlloc(GMEM_DDESHARE, (strlen(bochsrc_line) + 1)); + strcpy((char *)GlobalLock(hgClip), bochsrc_line); + GlobalUnlock(hgClip); + SetClipboardData(CF_TEXT, hgClip); + CloseClipboard(); + } +#endif myexit(0); // make picky compilers (c++, gcc) happy,