diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/qemud/conf.c libvirt-printf/qemud/conf.c
--- libvirt-cvs/qemud/conf.c	2007-03-12 10:39:24.000000000 +0000
+++ libvirt-printf/qemud/conf.c	2007-03-12 16:55:06.000000000 +0000
@@ -1408,14 +1408,14 @@
     towrite = strlen(xml);
     if (write(fd, xml, towrite) != towrite) {
         qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
-                         "cannot write config file %s",
+                         "cannot write config file %s: %s",
                          network->configFile, strerror(errno));
         goto cleanup;
     }
 
     if (close(fd) < 0) {
         qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
-                         "cannot save config file %s",
+                         "cannot save config file %s: %s",
                          network->configFile, strerror(errno));
         goto cleanup;
     }
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/qemud/driver.h libvirt-printf/qemud/driver.h
--- libvirt-cvs/qemud/driver.h	2007-03-12 10:39:26.000000000 +0000
+++ libvirt-printf/qemud/driver.h	2007-03-12 16:43:36.000000000 +0000
@@ -28,7 +28,8 @@
 #include "internal.h"
 
 void qemudReportError(struct qemud_server *server,
-                      int code, const char *fmt, ...);
+                      int code, const char *fmt, ...)
+    ATTRIBUTE_FORMAT(printf,3,4);
 
 int qemudGetCPUInfo(unsigned int *cpus, unsigned int *mhz,
                     unsigned int *nodes, unsigned int *sockets,
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/qemud/internal.h libvirt-printf/qemud/internal.h
--- libvirt-cvs/qemud/internal.h	2007-03-12 10:39:26.000000000 +0000
+++ libvirt-printf/qemud/internal.h	2007-03-12 16:47:26.000000000 +0000
@@ -37,10 +37,14 @@
 #include <ansidecl.h>
 #endif
 #ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__((unused))
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
+#endif
+#ifndef ATTRIBUTE_FORMAT
+#define ATTRIBUTE_FORMAT(args...) __attribute__((__format__ (args)))
 #endif
 #else
 #define ATTRIBUTE_UNUSED
+#define ATTRIBUTE_FORMAT(...)
 #endif
 
 #define UUID_LEN 16
@@ -333,12 +337,13 @@
 int qemudShutdownNetworkDaemon(struct qemud_server *server,
                                struct qemud_network *network);
 
-void qemudLog(int priority, const char *fmt, ...);
+void qemudLog(int priority, const char *fmt, ...)
+    ATTRIBUTE_FORMAT(printf,2,3);
 
 #ifdef ENABLE_DEBUG
 #define qemudDebug(...) qemudLog(QEMUD_DEBUG, __VA_ARGS__)
 #else
-#define qemudDebug(fmt, ...) do { } while(0);
+#define qemudDebug(fmt, ...)
 #endif
 
 static inline int
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/internal.h libvirt-printf/src/internal.h
--- libvirt-cvs/src/internal.h	2007-03-12 10:40:32.000000000 +0000
+++ libvirt-printf/src/internal.h	2007-03-12 17:02:39.000000000 +0000
@@ -26,33 +26,33 @@
 #define _N(str) dgettext(GETTEXT_PACKAGE, (str))
 #define gettext_noop(str) (str)
 
+#ifdef __GNUC__
+#ifdef HAVE_ANSIDECL_H
+#include <ansidecl.h>
+#endif
+
 /**
  * ATTRIBUTE_UNUSED:
  *
  * Macro to flag conciously unused parameters to functions
  */
-#ifdef __GNUC__
-#ifdef HAVE_ANSIDECL_H
-#include <ansidecl.h>
-#endif
 #ifndef ATTRIBUTE_UNUSED
-#define ATTRIBUTE_UNUSED __attribute__((unused))
+#define ATTRIBUTE_UNUSED __attribute__((__unused__))
 #endif
-#else
-#define ATTRIBUTE_UNUSED
+
+/**
+ * ATTRIBUTE_FORMAT
+ *
+ * Macro used to check printf/scanf-like functions, if compiling
+ * with gcc.
+ */
+#ifndef ATTRIBUTE_FORMAT
+#define ATTRIBUTE_FORMAT(args...) __attribute__((__format__ (args)))
 #endif
 
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
-# endif
+#else
+#define ATTRIBUTE_UNUSED
+#define ATTRIBUTE_FORMAT(...)
 #endif
 
 /**
@@ -62,7 +62,7 @@
  */
 #define TODO 								\
     fprintf(stderr, "Unimplemented block at %s:%d\n",			\
-            __FILE__, __LINE__);
+            __FILE__, __LINE__)
 
 /**
  * VIR_CONNECT_MAGIC:
@@ -211,7 +211,8 @@
 		     const char *str1,
 		     const char *str2,
 		     const char *str3,
-		     int int1, int int2, const char *msg, ...);
+		     int int1, int int2, const char *msg, ...)
+  ATTRIBUTE_FORMAT(printf, 12, 13);
 const char *__virErrorMsg(virErrorNumber error, const char *info);
 
 /************************************************************************
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/libvirt.c libvirt-printf/src/libvirt.c
--- libvirt-cvs/src/libvirt.c	2007-03-12 10:40:26.000000000 +0000
+++ libvirt-printf/src/libvirt.c	2007-03-12 17:07:43.000000000 +0000
@@ -1495,7 +1495,7 @@
     virConnectPtr conn;
 
     if (domain == NULL) {
-        TODO
+        TODO;
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
@@ -1549,8 +1549,8 @@
     virConnectPtr conn;
 
     if (domain == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
@@ -1868,8 +1868,8 @@
     int i, ret = -1;
     virConnectPtr conn;
     if (domain == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
@@ -1975,8 +1975,8 @@
     virConnectPtr conn;
 
     if (domain == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
@@ -2044,8 +2044,8 @@
     virConnectPtr conn;
 
     if (domain == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
@@ -2107,8 +2107,8 @@
     virConnectPtr conn;
 
     if (domain == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
         virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
@@ -2654,8 +2654,8 @@
     int i, ret = -1;
     virConnectPtr conn;
     if (network == NULL) {
-        TODO
-	return (-1);
+        TODO;
+        return (-1);
     }
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
         virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
@@ -2961,3 +2961,17 @@
     virLibConnError(network->conn, VIR_ERR_CALL_FAILED, __FUNCTION__);
     return (-1);
 }
+
+/*
+ * vim: set tabstop=4:
+ * vim: set shiftwidth=4:
+ * vim: set expandtab:
+ */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/proxy_internal.c libvirt-printf/src/proxy_internal.c
--- libvirt-cvs/src/proxy_internal.c	2007-03-12 10:40:33.000000000 +0000
+++ libvirt-printf/src/proxy_internal.c	2007-03-12 17:08:24.000000000 +0000
@@ -475,8 +475,8 @@
 	return(-1);
     }
     if (res->serial != serial) {
-        TODO /* Asynchronous communication */
-	fprintf(stderr, _("got asynchronous packet number %d\n"), res->serial);
+        TODO; /* Asynchronous communication */
+        fprintf(stderr, _("got asynchronous packet number %d\n"), res->serial);
         goto retry;
     }
     return(0);
@@ -1044,3 +1044,17 @@
 
     return(ostype);
 }
+
+/*
+ * vim: set tabstop=4:
+ * vim: set shiftwidth=4:
+ * vim: set expandtab:
+ */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/sexpr.h libvirt-printf/src/sexpr.h
--- libvirt-cvs/src/sexpr.h	2007-03-12 10:40:32.000000000 +0000
+++ libvirt-printf/src/sexpr.h	2007-03-12 16:52:54.000000000 +0000
@@ -13,6 +13,8 @@
 #ifndef _LIBVIR_SEXPR_H_
 #define _LIBVIR_SEXPR_H_
 
+#include "internal.h"
+
 #include <sys/types.h>
 
 enum sexpr_type {
@@ -45,6 +47,7 @@
 
 /* lookup in S-Expressions */
 const char *sexpr_node(struct sexpr *sexpr, const char *node);
-const char *sexpr_fmt_node(struct sexpr *sexpr, const char *fmt, ...);
+const char *sexpr_fmt_node(struct sexpr *sexpr, const char *fmt, ...)
+  ATTRIBUTE_FORMAT(printf,2,3);
 struct sexpr *sexpr_lookup(struct sexpr *sexpr, const char *node);
 #endif
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/test.c libvirt-printf/src/test.c
--- libvirt-cvs/src/test.c	2007-03-12 10:40:24.000000000 +0000
+++ libvirt-printf/src/test.c	2007-03-12 16:48:04.000000000 +0000
@@ -1263,7 +1263,7 @@
                       uuid[8], uuid[9], uuid[10], uuid[11],
                       uuid[12], uuid[13], uuid[14], uuid[15]);
 
-    virBufferVSprintf(buf, "  <memory>%d</memory>\n", con->domains[domidx].info.maxMem);
+    virBufferVSprintf(buf, "  <memory>%lu</memory>\n", con->domains[domidx].info.maxMem);
     virBufferVSprintf(buf, "  <vcpu>%d</vcpu>\n", con->domains[domidx].info.nrVirtCpu);
     virBufferVSprintf(buf, "  <on_reboot>%s</on_reboot>\n", testRestartFlagToString(con->domains[domidx].onReboot));
     virBufferVSprintf(buf, "  <on_poweroff>%s</on_poweroff>\n", testRestartFlagToString(con->domains[domidx].onPoweroff));
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/xm_internal.c libvirt-printf/src/xm_internal.c
--- libvirt-cvs/src/xm_internal.c	2007-03-12 10:40:31.000000000 +0000
+++ libvirt-printf/src/xm_internal.c	2007-03-12 16:53:19.000000000 +0000
@@ -950,7 +950,7 @@
 
     if (vnc) {
         virBufferVSprintf(buf,
-                          "    <graphics type='vnc' port='%d'",
+                          "    <graphics type='vnc' port='%ld'",
                           (vncunused ? -1 : 5900+vncdisplay));
         if (vnclisten) {
             virBufferVSprintf(buf, " listen='%s'", vnclisten);
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/xml.c libvirt-printf/src/xml.c
--- libvirt-cvs/src/xml.c	2007-03-12 10:40:29.000000000 +0000
+++ libvirt-printf/src/xml.c	2007-03-12 16:51:33.000000000 +0000
@@ -252,7 +252,7 @@
                     if (port == -1)
                         virBufferAdd(buf, "(vncunused 1)", 13);
                     else if (port >= 5900)
-                        virBufferVSprintf(buf, "(vncdisplay %d)", port - 5900);
+                        virBufferVSprintf(buf, "(vncdisplay %ld)", port - 5900);
                     xmlFree(vncport);
                 }
                 if (vnclisten != NULL) {
@@ -316,7 +316,7 @@
                 if (port == -1)
                     virBufferAdd(buf, "(vncunused 1)", 13);
                 else if (port >= 5900)
-                    virBufferVSprintf(buf, "(vncdisplay %d)", port - 5900);
+                    virBufferVSprintf(buf, "(vncdisplay %ld)", port - 5900);
                 xmlFree(vncport);
             }
             if (vnclisten != NULL) {
@@ -416,11 +416,11 @@
 
     if (boot_dev) {
         if (xmlStrEqual(boot_dev, BAD_CAST "fd")) {
-            virBufferVSprintf(buf, "(boot a)", (const char *) boot_dev);
+            virBufferVSprintf(buf, "(boot a)" /*, (const char *) boot_dev*/);
         } else if (xmlStrEqual(boot_dev, BAD_CAST "cdrom")) {
-            virBufferVSprintf(buf, "(boot d)", (const char *) boot_dev);
+            virBufferVSprintf(buf, "(boot d)" /*, (const char *) boot_dev*/);
         } else if (xmlStrEqual(boot_dev, BAD_CAST "hd")) {
-            virBufferVSprintf(buf, "(boot c)", (const char *) boot_dev);
+            virBufferVSprintf(buf, "(boot c)" /*, (const char *) boot_dev*/);
         } else {
             /* Any other type of boot dev is unsupported right now */
             virXMLError(conn, VIR_ERR_XML_ERROR, NULL, 0);
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/xml.h libvirt-printf/src/xml.h
--- libvirt-cvs/src/xml.h	2007-03-12 10:40:36.000000000 +0000
+++ libvirt-printf/src/xml.h	2007-03-12 16:55:57.000000000 +0000
@@ -6,6 +6,7 @@
 #define __VIR_XML_H__
 
 #include "libvirt/libvirt.h"
+#include "internal.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -27,7 +28,8 @@
 virBufferPtr virBufferNew(unsigned int size);
 void virBufferFree(virBufferPtr buf);
 int virBufferAdd(virBufferPtr buf, const char *str, int len);
-int virBufferVSprintf(virBufferPtr buf, const char *format, ...);
+int virBufferVSprintf(virBufferPtr buf, const char *format, ...)
+  ATTRIBUTE_FORMAT(printf, 2, 3);
 int virBufferStrcat(virBufferPtr buf, ...);
 char *virDomainParseXMLDesc(virConnectPtr conn, const char *xmldesc, char **name, int xendConfigVersion);
 unsigned char *virParseUUID(char **ptr, const char *uuid);
diff -urN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-cvs/src/xmlrpc.c libvirt-printf/src/xmlrpc.c
--- libvirt-cvs/src/xmlrpc.c	2007-03-12 10:40:37.000000000 +0000
+++ libvirt-printf/src/xmlrpc.c	2007-03-12 17:09:20.000000000 +0000
@@ -86,7 +86,7 @@
 static xmlRpcValuePtr xmlRpcValueUnmarshalDateTime(xmlNodePtr node ATTRIBUTE_UNUSED)
 {
     /* we don't need this */
-    TODO
+    TODO;
     return NULL;
 }
 
@@ -102,7 +102,7 @@
 static xmlRpcValuePtr xmlRpcValueUnmarshalBase64(xmlNodePtr node ATTRIBUTE_UNUSED)
 {
     /* we don't need this */
-    TODO
+    TODO;
     return NULL;
 }
 
@@ -346,11 +346,11 @@
 	break;
     case XML_RPC_DATE_TIME:
 	/* FIXME */
-	TODO
+    TODO;
 	break;
     case XML_RPC_BASE64:
 	/* FIXME */
-	TODO
+    TODO;
 	break;
     case XML_RPC_STRING:
 	virBufferStrcat(buf, 
@@ -694,3 +694,17 @@
 {
     return context->faultMessage;
 }
+
+/*
+ * vim: set tabstop=4:
+ * vim: set shiftwidth=4:
+ * vim: set expandtab:
+ */
+/*
+ * Local variables:
+ *  indent-tabs-mode: nil
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ *  tab-width: 4
+ * End:
+ */
