View Issue Details

IDProjectCategoryView StatusLast Update
0002051GNUnetWin32 port (deprecated)public2012-02-28 11:05
ReporterLRN Assigned ToLRN  
PrioritynormalSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.9.2Fixed in Version0.9.2 
Summary0002051: [patch] UTF8ization for GNUnet core package
DescriptionI'll attach the patches below. This requires plibc UTF8ization to be performed first.

There's also a question of other platforms. I've made plibc return UTF-8 on W32 (which is what UTF8ization patch for plibc did), but on other platforms local libc (which is what plibc calls resolve to) is not guaranteed to use UTF-8.

The only way to make it 100% fool-proof is to extend plibc to support other platforms (instead of just being a set of macros there) with actual code that converts strings back and forth from UTF-8 to the system encoding (if it's not UTF-8 already), roughly the same way it is done for W32 now. But that is not only a good bit of work, it is also a far cry from what plibc currently does on non-W32 platforms.

So right now the cone just assumes that plibc/CRT produces UTF-8 strings on non-W32, and that plibc produces UTF-8 strings on W32, while CRT does not.
TagsNo tags attached.
Attached Files
0006-FPRINTFification.patch (188,551 bytes)   
From 51279b74bd6c8ad4eff0875929381c2f8fcc44e0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 30 Dec 2011 23:00:05 +0400
Subject: [PATCH 06/10] FPRINTFification

* Replace all fprintf() with FPRINTF()
* Convert fprintf(file, "string") to FPRINTF(file, "%s", "string")
---
 src/arm/gnunet-arm.c                               |   22 ++++----
 src/arm/test_exponential_backoff.c                 |    8 +-
 src/arm/test_gnunet_service_manager.c              |    6 +-
 src/ats-test/test_transport_ats_multiple_peers.c   |   16 +++---
 src/block/test_block.c                             |    2 +-
 src/chat/gnunet-chat.c                             |   46 +++++++-------
 src/core/gnunet-core-list-connections.c            |    8 +-
 src/core/test_core_api.c                           |    2 +-
 src/core/test_core_api_reliability.c               |    4 +-
 src/core/test_core_api_start_only.c                |    4 +-
 src/core/test_core_quota_compliance.c              |    4 +-
 src/datacache/perf_datacache.c                     |   17 +++---
 src/datacache/test_datacache.c                     |    6 +-
 src/datacache/test_datacache_quota.c               |   13 ++--
 src/datastore/perf_datastore_api.c                 |   10 ++--
 src/datastore/perf_plugin_datastore.c              |   14 ++--
 src/datastore/test_datastore_api.c                 |   12 ++--
 src/datastore/test_datastore_api_management.c      |    6 +-
 src/datastore/test_plugin_datastore.c              |   16 +++---
 src/dht/gnunet-dht-get.c                           |   10 ++--
 src/dht/gnunet-dht-put.c                           |   10 ++--
 src/dht/test_dht_api.c                             |    4 +-
 src/dht/test_dht_multipeer.c                       |   36 ++++++------
 src/dht/test_dht_twopeer.c                         |   12 ++--
 src/dht/test_dht_twopeer_path_tracking.c           |   12 ++--
 src/dv/test_transport_api_dv.c                     |   16 +++---
 src/fragmentation/test_fragmentation.c             |   18 +++---
 src/fs/gnunet-directory.c                          |    2 +-
 src/fs/gnunet-download.c                           |   20 +++---
 src/fs/gnunet-fs.c                                 |    4 +-
 src/fs/gnunet-pseudonym.c                          |   14 ++--
 src/fs/gnunet-publish.c                            |   44 +++++++-------
 src/fs/gnunet-search.c                             |   12 ++--
 src/fs/gnunet-unindex.c                            |   12 ++--
 src/fs/perf_gnunet_service_fs_p2p.c                |    4 +-
 src/fs/perf_gnunet_service_fs_p2p_trust.c          |    4 +-
 src/fs/test_fs_directory.c                         |    4 +-
 src/fs/test_fs_download.c                          |    4 +-
 src/fs/test_fs_download_indexed.c                  |    4 +-
 src/fs/test_fs_download_persistence.c              |    4 +-
 src/fs/test_fs_download_recursive.c                |   14 ++--
 src/fs/test_fs_file_information.c                  |    4 +-
 src/fs/test_fs_getopt.c                            |    2 +-
 src/fs/test_fs_list_indexed.c                      |    2 +-
 src/fs/test_fs_namespace.c                         |   22 ++++----
 src/fs/test_fs_publish.c                           |    4 +-
 src/fs/test_fs_publish_persistence.c               |    2 +-
 src/fs/test_fs_search.c                            |    6 +-
 src/fs/test_fs_search_persistence.c                |    6 +-
 src/fs/test_fs_search_ranking.c                    |    2 +-
 src/fs/test_fs_unindex.c                           |    4 +-
 src/fs/test_fs_unindex_persistence.c               |    4 +-
 src/fs/test_fs_uri.c                               |    6 +-
 src/fs/test_gnunet_service_fs_migration.c          |    4 +-
 src/fs/test_gnunet_service_fs_p2p.c                |    2 +-
 src/hello/test_hello.c                             |   26 ++++----
 .../test_gnunet_daemon_hostlist_reconnect.c        |    6 +-
 src/mesh/mesh_tunnel_tree.c                        |   16 +++---
 src/nat/gnunet-nat-server.c                        |    2 +-
 src/nse/gnunet-nse-profiler.c                      |    4 +-
 src/nse/test_nse_api.c                             |    4 +-
 src/nse/test_nse_multipeer.c                       |    6 +-
 src/peerinfo-tool/gnunet-peerinfo.c                |   10 ++--
 src/peerinfo/perf_peerinfo_api.c                   |    8 +-
 src/statistics/gnunet-statistics.c                 |    2 +-
 src/testing/test_testing_large_topology.c          |   62 ++++++++++----------
 src/testing/test_testing_reconnect.c               |    8 +-
 src/testing/test_testing_topology.c                |   64 ++++++++++----------
 src/testing/test_testing_topology_blacklist.c      |    8 +-
 src/testing/testing_group.c                        |   16 +++---
 src/testing/testing_peergroup.c                    |    8 +-
 src/topology/test_gnunet_daemon_topology.c         |    2 +-
 .../gnunet-transport-connect-running-peers.c       |    4 +-
 src/transport/gnunet-transport.c                   |   28 ++++----
 src/transport/test_quota_compliance.c              |   10 ++--
 src/transport/test_transport_api.c                 |    2 +-
 .../test_transport_api_bidirectional_connect.c     |    2 +-
 src/transport/test_transport_api_disconnect.c      |    2 +-
 src/transport/test_transport_api_limited_sockets.c |    2 +-
 src/transport/test_transport_api_reliability.c     |    8 +-
 src/transport/test_transport_api_restart_1peer.c   |    2 +-
 src/transport/test_transport_api_restart_2peers.c  |    2 +-
 src/transport/test_transport_api_timeout.c         |    6 +-
 src/transport/test_transport_api_unreliability.c   |    8 +-
 .../test_transport_api_unreliability_constant.c    |   10 ++--
 src/transport/test_transport_startonly.c           |    6 +-
 src/util/common_logging.c                          |    2 +-
 src/util/configuration.c                           |    6 +-
 src/util/crypto_random.c                           |    2 +-
 src/util/getopt.c                                  |   28 ++++----
 src/util/getopt_helpers.c                          |    4 +-
 src/util/plugin.c                                  |    2 +-
 src/util/test_common_allocation.c                  |    2 +-
 src/util/test_common_logging.c                     |    8 +-
 src/util/test_common_logging_dummy.c               |    2 +-
 src/util/test_common_logging_runtime_loglevels.c   |    6 +-
 src/util/test_configuration.c                      |   12 ++--
 src/util/test_crypto_aes_weak.c                    |    2 +-
 src/util/test_crypto_ksk.c                         |   30 +++++-----
 src/util/test_crypto_random.c                      |    2 +-
 src/util/test_crypto_rsa.c                         |   34 +++++-----
 src/util/test_disk.c                               |   10 ++--
 src/util/test_os_start_process.c                   |    4 +-
 src/util/test_peer.c                               |    4 +-
 src/util/test_resolver_api.c                       |    6 +-
 src/util/test_scheduler_delay.c                    |   12 ++--
 src/util/test_service.c                            |    2 +-
 src/util/test_strings.c                            |    2 +-
 108 files changed, 537 insertions(+), 539 deletions(-)

diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 13b1fdc..65700ee 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -146,47 +146,47 @@ confirm_cb (void *cls,
   switch (result)
   {
   case GNUNET_ARM_PROCESS_UNKNOWN:
-    fprintf (stderr, _("Service `%s' is unknown to ARM.\n"), service);
+    FPRINTF (stderr, _("Service `%s' is unknown to ARM.\n"), service);
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_DOWN:
     if (quiet != GNUNET_YES)
-      fprintf (stdout, _("Service `%s' has been stopped.\n"), service);
+      FPRINTF (stdout, _("Service `%s' has been stopped.\n"), service);
     break;
   case GNUNET_ARM_PROCESS_ALREADY_RUNNING:
-    fprintf (stderr, _("Service `%s' was already running.\n"), service);
+    FPRINTF (stderr, _("Service `%s' was already running.\n"), service);
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_STARTING:
     if (quiet != GNUNET_YES)
-      fprintf (stdout, _("Service `%s' has been started.\n"), service);
+      FPRINTF (stdout, _("Service `%s' has been started.\n"), service);
     break;
   case GNUNET_ARM_PROCESS_ALREADY_STOPPING:
-    fprintf (stderr, _("Service `%s' was already being stopped.\n"), service);
+    FPRINTF (stderr, _("Service `%s' was already being stopped.\n"), service);
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_ALREADY_DOWN:
-    fprintf (stderr, _("Service `%s' was already not running.\n"), service);
+    FPRINTF (stderr, _("Service `%s' was already not running.\n"), service);
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_SHUTDOWN:
-    fprintf (stderr, _("Request ignored as ARM is shutting down.\n"));
+    FPRINTF (stderr, "%s", _("Request ignored as ARM is shutting down.\n"));
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_COMMUNICATION_ERROR:
-    fprintf (stderr, _("Error communicating with ARM service.\n"));
+    FPRINTF (stderr, "%s", _("Error communicating with ARM service.\n"));
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_COMMUNICATION_TIMEOUT:
-    fprintf (stderr, _("Timeout communicating with ARM service.\n"));
+    FPRINTF (stderr, "%s",  _("Timeout communicating with ARM service.\n"));
     ret = 1;
     break;
   case GNUNET_ARM_PROCESS_FAILURE:
-    fprintf (stderr, _("Operation failed.\n"));
+    FPRINTF (stderr, "%s",  _("Operation failed.\n"));
     ret = 1;
     break;
   default:
-    fprintf (stderr, _("Unknown response code from ARM.\n"));
+    FPRINTF (stderr, "%s",  _("Unknown response code from ARM.\n"));
     break;
   }
   GNUNET_SCHEDULER_add_continuation (&cps_loop, NULL,
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 029ed14..df0efb7 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -303,15 +303,15 @@ do_nothing_restarted_notify_task (void *cls,
 #if LOG_BACKOFF
   if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
     {
-      fprintf (killLogFilePtr, "%d.Reason is shutdown!\n", trialCount);
+      FPRINTF (killLogFilePtr, "%d.Reason is shutdown!\n", trialCount);
     }
   else if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0)
     {
-      fprintf (killLogFilePtr, "%d.Reason is timeout!\n", trialCount);
+      FPRINTF (killLogFilePtr, "%d.Reason is timeout!\n", trialCount);
     }
   else if ((tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE) != 0)
     {
-      fprintf (killLogFilePtr, "%d.Service is running!\n", trialCount);
+      FPRINTF (killLogFilePtr, "%d.Service is running!\n", trialCount);
     }
 #endif
   GNUNET_SCHEDULER_add_now (&kill_task, &a);
@@ -345,7 +345,7 @@ kill_task (void *cbData, const struct GNUNET_SCHEDULER_TaskContext *tc)
       waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
 
 #if LOG_BACKOFF
-      fprintf (killLogFilePtr, "Waited for: %llu ms\n",
+      FPRINTF (killLogFilePtr, "Waited for: %llu ms\n",
 	       (unsigned long long) waitedFor.rel_value);
 #endif
     }
diff --git a/src/arm/test_gnunet_service_manager.c b/src/arm/test_gnunet_service_manager.c
index 2be86e7..dd12bbd 100644
--- a/src/arm/test_gnunet_service_manager.c
+++ b/src/arm/test_gnunet_service_manager.c
@@ -161,13 +161,13 @@ main (int argc, char *argv[])
     {
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
 			   "gethostname");
-      fprintf (stderr,
-	       "Failed to determine my own hostname, testcase not run.\n");
+      FPRINTF (stderr,
+	       "Failed to determine my own hostname, testcase not run.\n", NULL);
       return 0;
     }
   if (NULL == gethostbyname (hostname))
     {
-      fprintf (stderr,
+      FPRINTF (stderr,
 	       "Failed to resolve my hostname `%s', testcase not run.\n",
 	       hostname);
       return 0;
diff --git a/src/ats-test/test_transport_ats_multiple_peers.c b/src/ats-test/test_transport_ats_multiple_peers.c
index e9d0baf..7425ff4 100644
--- a/src/ats-test/test_transport_ats_multiple_peers.c
+++ b/src/ats-test/test_transport_ats_multiple_peers.c
@@ -225,7 +225,7 @@ evaluate_measurements ()
   stddev[0] /= c_new;
   stddev[0] = sqrt (stddev[0]);
   if (!machine_parsable)
-    fprintf (stderr, "new, %i measurements, average: %f stddev: %f\n", c_new,
+    FPRINTF (stderr, "new, %i measurements, average: %f stddev: %f\n", c_new,
              average[0], stddev[0]);
 
   average[1] = 0.0;
@@ -245,7 +245,7 @@ evaluate_measurements ()
   stddev[1] /= c_modified;
   stddev[1] = sqrt (stddev[1]);
   if (!machine_parsable)
-    fprintf (stderr, "modified, %i measurements, average: %f stddev: %f\n",
+    FPRINTF (stderr, "modified, %i measurements, average: %f stddev: %f\n",
              c_modified, average[1], stddev[1]);
 
   average[2] = 0.0;
@@ -265,11 +265,11 @@ evaluate_measurements ()
   stddev[2] = sqrt (stddev[2]);
 
   if (!machine_parsable)
-    fprintf (stderr, "unmodified, %i measurements, average: %f stddev: %f\n",
+    FPRINTF (stderr, "unmodified, %i measurements, average: %f stddev: %f\n",
              c_unmodified, average[2], stddev[2]);
 
   if (machine_parsable)
-    fprintf (stderr,
+    FPRINTF (stderr,
              "peers,%i,mechs,%llu," "new,%i,%f,%f," "mod,%i,%f,%f,"
              "unmod,%i,%f,%f\n", peers - 1,
              (unsigned long long) results_unmodified[0].mechs, c_new,
@@ -337,7 +337,7 @@ stats_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All %llu peers connected\n", value);
 #if !VERBOSE
     if (!machine_parsable)
-      fprintf (stderr, "%i", count);
+      FPRINTF (stderr, "%i", count);
 #endif
   }
 
@@ -395,7 +395,7 @@ stats_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
         }
         count++;
 #if VERBOSE
-        fprintf (stderr, "(new: %i / modified: %i / unmodified: %i) of %i \n",
+        FPRINTF (stderr, "(new: %i / modified: %i / unmodified: %i) of %i \n",
                  c_new, c_modified, c_unmodified, MEASUREMENTS);
 #endif
         if ((c_modified >= MEASUREMENTS) && (c_new >= MEASUREMENTS) &&
@@ -403,7 +403,7 @@ stats_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
         {
 #if !VERBOSE
           if (!machine_parsable)
-            fprintf (stdout, "\n");
+            FPRINTF (stdout, "\n");
 #endif
           if (stats_task != GNUNET_SCHEDULER_NO_TASK)
           {
@@ -418,7 +418,7 @@ stats_cb (void *cls, const char *subsystem, const char *name, uint64_t value,
         current.timestamp = value;
 #if !VERBOSE
         if (!machine_parsable)
-          fprintf (stderr, "..%i", count);
+          FPRINTF (stderr, "..%i", count);
 #endif
         return GNUNET_OK;
       }
diff --git a/src/block/test_block.c b/src/block/test_block.c
index d1d3edb..927029e 100644
--- a/src/block/test_block.c
+++ b/src/block/test_block.c
@@ -72,6 +72,6 @@ main (int argc, char *argv[])
   GNUNET_BLOCK_context_destroy (ctx);
   GNUNET_CONFIGURATION_destroy (cfg);
   if (ret != 0)
-    fprintf (stderr, "Tests failed: %d\n", ret);
+    FPRINTF (stderr, "Tests failed: %d\n", ret);
   return ret;
 }
diff --git a/src/chat/gnunet-chat.c b/src/chat/gnunet-chat.c
index 53884a2..af4eb53 100644
--- a/src/chat/gnunet-chat.c
+++ b/src/chat/gnunet-chat.c
@@ -89,7 +89,7 @@ do_help (const char *args, const void *xtra);
 static int
 join_cb (void *cls)
 {
-  fprintf (stdout, _("Joined\n"));
+  FPRINTF (stdout, "%s",  _("Joined\n"));
   return GNUNET_OK;
 }
 
@@ -163,7 +163,7 @@ receive_cb (void *cls, struct GNUNET_CHAT_Room *room,
     break;
   }
   time = GNUNET_STRINGS_absolute_time_to_string (timestamp);
-  fprintf (stdout, fmt, time, nick, message);
+  FPRINTF (stdout, fmt, time, nick, message);
   GNUNET_free (nick);
   GNUNET_free (time);
   return GNUNET_OK;
@@ -190,7 +190,7 @@ confirmation_cb (void *cls, struct GNUNET_CHAT_Room *room,
   char *nick;
 
   nick = GNUNET_PSEUDONYM_id_to_name (cfg, receiver);
-  fprintf (stdout, _("'%s' acknowledged message #%d\n"), nick, orig_seq_number);
+  FPRINTF (stdout, _("'%s' acknowledged message #%d\n"), nick, orig_seq_number);
   return GNUNET_OK;
 }
 
@@ -219,7 +219,7 @@ member_list_cb (void *cls, const struct GNUNET_CONTAINER_MetaData *member_info,
                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
                       &id);
   nick = GNUNET_PSEUDONYM_id_to_name (cfg, &id);
-  fprintf (stdout,
+  FPRINTF (stdout,
            member_info !=
            NULL ? _("`%s' entered the room\n") : _("`%s' left the room\n"),
            nick);
@@ -281,11 +281,11 @@ do_join (const char *arg, const void *xtra)
                              &confirmation_cb, NULL, &me);
   if (NULL == room)
   {
-    fprintf (stdout, _("Could not change username\n"));
+    FPRINTF (stdout, "%s",  _("Could not change username\n"));
     return GNUNET_SYSERR;
   }
   my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
-  fprintf (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
+  FPRINTF (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
            my_name);
   GNUNET_free (my_name);
   return GNUNET_OK;
@@ -313,11 +313,11 @@ do_nick (const char *msg, const void *xtra)
                              &confirmation_cb, NULL, &me);
   if (NULL == room)
   {
-    fprintf (stdout, _("Could not change username\n"));
+    FPRINTF (stdout, "%s",  _("Could not change username\n"));
     return GNUNET_SYSERR;
   }
   my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
-  fprintf (stdout, _("Changed username to `%s'\n"), my_name);
+  FPRINTF (stdout, _("Changed username to `%s'\n"), my_name);
   GNUNET_free (my_name);
   return GNUNET_OK;
 }
@@ -330,7 +330,7 @@ do_names (const char *msg, const void *xtra)
   struct UserList *pos;
   GNUNET_HashCode pid;
 
-  fprintf (stdout, _("Users in room `%s': "), room_name);
+  FPRINTF (stdout, _("Users in room `%s': "), room_name);
   pos = users;
   while (NULL != pos)
   {
@@ -338,11 +338,11 @@ do_names (const char *msg, const void *xtra)
                         sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
                         &pid);
     name = GNUNET_PSEUDONYM_id_to_name (cfg, &pid);
-    fprintf (stdout, "`%s' ", name);
+    FPRINTF (stdout, "`%s' ", name);
     GNUNET_free (name);
     pos = pos->next;
   }
-  fprintf (stdout, "\n");
+  FPRINTF (stdout, "%s",  "\n");
   return GNUNET_OK;
 }
 
@@ -368,7 +368,7 @@ do_send_pm (const char *msg, const void *xtra)
 
   if (NULL == strstr (msg, " "))
   {
-    fprintf (stderr, _("Syntax: /msg USERNAME MESSAGE"));
+    FPRINTF (stderr, "%s",  _("Syntax: /msg USERNAME MESSAGE"));
     return GNUNET_OK;
   }
   user = GNUNET_strdup (msg);
@@ -376,7 +376,7 @@ do_send_pm (const char *msg, const void *xtra)
   msg += strlen (user) + 1;
   if (GNUNET_OK != GNUNET_PSEUDONYM_name_to_id (cfg, user, &uid))
   {
-    fprintf (stderr, _("Unknown user `%s'\n"), user);
+    FPRINTF (stderr, _("Unknown user `%s'\n"), user);
     GNUNET_free (user);
     return GNUNET_OK;
   }
@@ -392,7 +392,7 @@ do_send_pm (const char *msg, const void *xtra)
   }
   if (NULL == pos)
   {
-    fprintf (stderr, _("User `%s' is currently not in the room!\n"), user);
+    FPRINTF (stderr, _("User `%s' is currently not in the room!\n"), user);
     GNUNET_free (user);
     return GNUNET_OK;
   }
@@ -445,7 +445,7 @@ do_quit (const char *args, const void *xtra)
 static int
 do_unknown (const char *msg, const void *xtra)
 {
-  fprintf (stderr, _("Unknown command `%s'\n"), msg);
+  FPRINTF (stderr, _("Unknown command `%s'\n"), msg);
   return GNUNET_OK;
 }
 
@@ -510,20 +510,20 @@ do_help (const char *args, const void *xtra)
   {
     if (0 == strncasecmp (&args[1], &commands[i].command[1], strlen (args) - 1))
     {
-      fprintf (stdout, "%s\n", gettext (commands[i].helptext));
+      FPRINTF (stdout, "%s\n", gettext (commands[i].helptext));
       return GNUNET_OK;
     }
     i++;
   }
   i = 0;
-  fprintf (stdout, "Available commands:");
+  FPRINTF (stdout, "%s",  "Available commands:");
   while (commands[i].Action != &do_help)
   {
-    fprintf (stdout, " %s", gettext (commands[i].command));
+    FPRINTF (stdout, " %s", gettext (commands[i].command));
     i++;
   }
-  fprintf (stdout, "\n");
-  fprintf (stdout, "%s\n", gettext (commands[i].helptext));
+  FPRINTF (stdout, "%s",  "\n");
+  FPRINTF (stdout, "%s\n", gettext (commands[i].helptext));
   return GNUNET_OK;
 }
 
@@ -602,7 +602,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   /* check arguments */
   if (NULL == nickname)
   {
-    fprintf (stderr, _("You must specify a nickname\n"));
+    FPRINTF (stderr, "%s",  _("You must specify a nickname\n"));
     ret = -1;
     return;
   }
@@ -618,7 +618,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                              &confirmation_cb, NULL, &me);
   if (NULL == room)
   {
-    fprintf (stderr, _("Failed to join room `%s'\n"), room_name);
+    FPRINTF (stderr, _("Failed to join room `%s'\n"), room_name);
     GNUNET_free (room_name);
     GNUNET_free (nickname);
     GNUNET_CONTAINER_meta_data_destroy (meta);
@@ -626,7 +626,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     return;
   }
   my_name = GNUNET_PSEUDONYM_id_to_name (cfg, &me);
-  fprintf (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
+  FPRINTF (stdout, _("Joining room `%s' as user `%s'...\n"), room_name,
            my_name);
   GNUNET_free (my_name);
   handle_cmd_task =
diff --git a/src/core/gnunet-core-list-connections.c b/src/core/gnunet-core-list-connections.c
index c93f509..fcd0765 100644
--- a/src/core/gnunet-core-list-connections.c
+++ b/src/core/gnunet-core-list-connections.c
@@ -115,7 +115,7 @@ process_resolved_address (void *cls, const struct GNUNET_PeerIdentity *peer,
   /*
    * new_address = GNUNET_malloc (sizeof (struct AddressStringList));
    * #if VERBOSE
-   * fprintf (stderr, "Received address %s\n", address);
+   * FPRINTF (stderr, "Received address %s\n", address);
    * #endif
    *
    * new_address->address_string = GNUNET_strdup ("FIXME");
@@ -138,7 +138,7 @@ connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (peer != NULL)             /* Not yet finished */
   {
 #if VERBOSE
-    fprintf (stderr, "Learned about peer %s\n", GNUNET_i2s (peer));
+    FPRINTF (stderr, "Learned about peer %s\n", GNUNET_i2s (peer));
     peer_count++;
 #endif
     pc = GNUNET_malloc (sizeof (struct PrintContext));
@@ -150,7 +150,7 @@ connected_peer_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
 #if VERBOSE
   else
   {
-    fprintf (stderr, "Counted %u total connected peers.\n", peer_count);
+    FPRINTF (stderr, "Counted %u total connected peers.\n", peer_count);
   }
 #endif
 }
@@ -172,7 +172,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   cfg = c;
   if (args[0] != NULL)
   {
-    fprintf (stderr, _("Invalid command line argument `%s'\n"), args[0]);
+    FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]);
     return;
   }
 
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index e63fc9f..df29d52 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -112,7 +112,7 @@ static void
 terminate_task_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
 #if VERBOSE
-  fprintf (stderr, "ENDING ANGRILY %u\n", ok);
+  FPRINTF (stderr, "ENDING ANGRILY %u\n", ok);
 #endif
   GNUNET_break (0);
   if (NULL != p1.ch)
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index b2079ba..434886d 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -134,7 +134,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   GNUNET_TRANSPORT_disconnect (p2.th);
   p2.th = NULL;
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
-  fprintf (stderr, "\nThroughput was %llu kb/s\n",
+  FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
   GAUGER ("CORE", "Core throughput/s", total_bytes * 1000 / 1024 / delta,
           "kb/s");
@@ -353,7 +353,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
 #endif
   n++;
   if (0 == (n % (TOTAL_MSGS / 100)))
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
   if (n == TOTAL_MSGS)
   {
     GNUNET_SCHEDULER_cancel (err_task);
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c
index b06b978..75ba73c 100644
--- a/src/core/test_core_api_start_only.c
+++ b/src/core/test_core_api_start_only.c
@@ -58,7 +58,7 @@ static GNUNET_SCHEDULER_TaskIdentifier timeout_task_id;
 static int ok;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -162,7 +162,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
 static void
 timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  fprintf (stderr, "Timeout.\n");
+  FPRINTF (stderr, "%s",  "Timeout.\n");
   if (p1.ch != NULL)
   {
     GNUNET_CORE_disconnect (p1.ch);
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index adfa93f..c45863f 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -227,7 +227,7 @@ measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG;
 
   measure_task = GNUNET_SCHEDULER_NO_TASK;
-  fprintf (stdout, "\n");
+  FPRINTF (stdout, "%s",  "\n");
   running = GNUNET_NO;
 
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
@@ -498,7 +498,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
 #endif
   n++;
   if (0 == (n % 10))
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
 
 
   if (running == GNUNET_YES)
diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c
index 6fc0a72..0f4fea4 100644
--- a/src/datacache/perf_datacache.c
+++ b/src/datacache/perf_datacache.c
@@ -71,8 +71,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (h == NULL)
   {
-    fprintf (stderr,
-             "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
+    FPRINTF (stderr, "%s", "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
     return;
   }
   exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
@@ -81,15 +80,15 @@ run (void *cls, char *const *args, const char *cfgfile,
   for (i = 0; i < ITERATIONS; i++)
   {
     if (0 == i % (ITERATIONS / 80))
-      fprintf (stderr, ".");
+      FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     ASSERT (GNUNET_OK ==
             GNUNET_DATACACHE_put (h, &k, sizeof (GNUNET_HashCode),
                                   (const char *) &n, 1 + i % 16, exp));
     k = n;
   }
-  fprintf (stderr, "\n");
-  fprintf (stdout, "Stored %u items in %llums\n", ITERATIONS,
+  FPRINTF (stderr, "%s",  "\n");
+  FPRINTF (stdout, "Stored %u items in %llums\n", ITERATIONS,
            (unsigned long long)
            GNUNET_TIME_absolute_get_duration (start).rel_value);
   GNUNET_snprintf (gstr, sizeof (gstr), "DATACACHE-%s", plugin_name);
@@ -101,13 +100,13 @@ run (void *cls, char *const *args, const char *cfgfile,
   for (i = 0; i < ITERATIONS; i++)
   {
     if (0 == i % (ITERATIONS / 80))
-      fprintf (stderr, ".");
+      FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     GNUNET_DATACACHE_get (h, &k, 1 + i % 16, &checkIt, &n);
     k = n;
   }
-  fprintf (stderr, "\n");
-  fprintf (stdout,
+  FPRINTF (stderr, "%s",  "\n");
+  FPRINTF (stdout,
            "Found %u/%u items in %llums (%u were deleted during storage processing)\n",
            found, ITERATIONS,
            (unsigned long long)
@@ -169,7 +168,7 @@ main (int argc, char *argv[])
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "perf-datacache", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some perfcases: %d\n", ok);
+    FPRINTF (stderr, "Missed some perfcases: %d\n", ok);
   return ok;
 }
 
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c
index 6c70807..ff3640b 100644
--- a/src/datacache/test_datacache.c
+++ b/src/datacache/test_datacache.c
@@ -71,8 +71,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   h = GNUNET_DATACACHE_create (cfg, "testcache");
   if (h == NULL)
   {
-    fprintf (stderr,
-             "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
+    FPRINTF (stderr,
+             "Failed to initialize datacache.  Database likely not setup, skipping test.\n", NULL);
     return;
   }
   exp = GNUNET_TIME_absolute_get ();
@@ -154,7 +154,7 @@ main (int argc, char *argv[])
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "test-datacache", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %d\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %d\n", ok);
   return ok;
 }
 
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c
index d3681da..468972c 100644
--- a/src/datacache/test_datacache_quota.c
+++ b/src/datacache/test_datacache_quota.c
@@ -60,8 +60,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (h == NULL)
   {
-    fprintf (stderr,
-             "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
+    FPRINTF (stderr, "%s", "Failed to initialize datacache.  Database likely not setup, skipping test.\n");
     return;
   }
   exp = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS);
@@ -69,7 +68,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   memset (&k, 0, sizeof (GNUNET_HashCode));
   for (i = 0; i < 10; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     for (j = i; j < sizeof (buf); j += 10)
     {
@@ -80,11 +79,11 @@ run (void *cls, char *const *args, const char *cfgfile,
     }
     k = n;
   }
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
   memset (&k, 0, sizeof (GNUNET_HashCode));
   for (i = 0; i < 10; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_hash (&k, sizeof (GNUNET_HashCode), &n);
     if (i < 2)
       ASSERT (0 == GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
@@ -92,7 +91,7 @@ run (void *cls, char *const *args, const char *cfgfile,
       ASSERT (0 < GNUNET_DATACACHE_get (h, &k, 1 + i, NULL, NULL));
     k = n;
   }
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
   GNUNET_DATACACHE_destroy (h);
   return;
 FAILURE:
@@ -145,7 +144,7 @@ main (int argc, char *argv[])
   GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, xargv,
                       "test-datacache-quota", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %d\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %d\n", ok);
   return ok;
 }
 
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c
index 372a61f..106d406 100644
--- a/src/datastore/perf_datastore_api.c
+++ b/src/datastore/perf_datastore_api.c
@@ -123,7 +123,7 @@ check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiratio
     return;
   }
 #if REPORT_ID
-  fprintf (stderr, "I");
+  FPRINTF (stderr, "%s",  "I");
 #endif
   stored_bytes += crc->size;
   stored_ops++;
@@ -166,7 +166,7 @@ remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration,
     return;
   }
 #if REPORT_ID
-  fprintf (stderr, "D");
+  FPRINTF (stderr, "%s",  "D");
 #endif
   GNUNET_assert (GNUNET_OK == success);
   GNUNET_SCHEDULER_add_now (&run_continuation, crc);
@@ -284,7 +284,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
 
   if (success != GNUNET_YES)
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Test 'put' operation failed with error `%s' database likely not setup, skipping test.",
              msg);
     GNUNET_free (crc);
@@ -314,7 +314,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                             (GNUNET_TIME_UNIT_SECONDS), 0, 1,
                             GNUNET_TIME_UNIT_MINUTES, &run_tests, crc))
   {
-    fprintf (stderr, "Test 'put' operation failed.\n");
+    FPRINTF (stderr, "%s",  "Test 'put' operation failed.\n");
     ok = 1;
     GNUNET_free (crc);
   }
@@ -396,7 +396,7 @@ main (int argc, char *argv[])
   if (pos != plugin_name)
     pos[0] = '.';
 #if REPORT_ID
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
 #endif
   GNUNET_DISK_directory_remove (dir_name);
   return ret;
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c
index 8f552c4..6106b11 100644
--- a/src/datastore/perf_plugin_datastore.c
+++ b/src/datastore/perf_plugin_datastore.c
@@ -135,7 +135,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
                                GNUNET_CRYPTO_random_u32
                                (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg))
   {
-    fprintf (stderr, "ERROR: `%s'\n", msg);
+    FPRINTF (stderr, "ERROR: `%s'\n", msg);
     GNUNET_free_non_null (msg);
     return;
   }
@@ -165,7 +165,7 @@ iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size,
   hits[i / 8] |= (1 << (i % 8));
 
 #if VERBOSE
-  fprintf (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n",
+  FPRINTF (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n",
            type, priority, size, (unsigned long long) expiration.abs_value);
 #endif
   crc->cnt++;
@@ -344,7 +344,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     crc->phase = RP_ERROR;
   }
 #if VERBOSE
-  fprintf (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
+  FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
 #endif
   switch (crc->phase)
   {
@@ -422,7 +422,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
   GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
   if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
   {
-    fprintf (stderr, "Failed to load plugin `%s'!\n", name);
+    FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
     return NULL;
   }
   GNUNET_free (libname);
@@ -441,8 +441,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   api = load_plugin (c);
   if (api == NULL)
   {
-    fprintf (stderr,
-             "Could not initialize plugin, assuming database not configured. Test not run!\n");
+    FPRINTF (stderr,
+             "Could not initialize plugin, assuming database not configured. Test not run!\n", NULL);
     return;
   }
   crc = GNUNET_malloc (sizeof (struct CpsRunContext));
@@ -478,7 +478,7 @@ check ()
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                       "perf-plugin-datastore", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %u\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %u\n", ok);
   return ok;
 }
 
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index 942e0a1..df6d3af 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -193,10 +193,10 @@ check_value (void *cls, const GNUNET_HashCode * key, size_t size,
     return;
   }
 #if 0
-  fprintf (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n",
+  FPRINTF (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n",
            GNUNET_h2s (key), (unsigned int) size, type,
            (unsigned long long) expiration.abs_value);
-  fprintf (stderr,
+  FPRINTF (stderr,
            "Check value iteration %d wants size %u, type %d, expire %llu\n", i,
            (unsigned int) get_size (i), get_type (i),
            (unsigned long long) get_expiration (i).abs_value);
@@ -461,11 +461,11 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     return;
   case GNUNET_NO:
-    fprintf (stderr, "Test 'put' operation failed, key already exists (!?)\n");
+    FPRINTF (stderr, "%s", "Test 'put' operation failed, key already exists (!?)\n");
     GNUNET_free (crc);
     return;
   case GNUNET_SYSERR:
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Test 'put' operation failed with error `%s' database likely not setup, skipping test.\n",
              msg);
     GNUNET_free (crc);
@@ -495,7 +495,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                             (GNUNET_TIME_UNIT_SECONDS), 0, 1,
                             GNUNET_TIME_UNIT_MINUTES, &run_tests, crc))
   {
-    fprintf (stderr, "Test 'put' operation failed.\n");
+    FPRINTF (stderr, "%s",  "Test 'put' operation failed.\n");
     ok = 1;
     GNUNET_free (crc);
   }
@@ -548,7 +548,7 @@ check ()
   proc = NULL;
 #endif
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %u\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %u\n", ok);
   return ok;
 }
 
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c
index 3cb8ed9..20a405d 100644
--- a/src/datastore/test_datastore_api_management.c
+++ b/src/datastore/test_datastore_api_management.c
@@ -252,7 +252,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c
 
   if (success != GNUNET_YES)
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Test 'put' operation failed with error `%s' database likely not setup, skipping test.",
              msg);
     GNUNET_free (crc);
@@ -282,7 +282,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                             (GNUNET_TIME_UNIT_SECONDS), 0, 1,
                             GNUNET_TIME_UNIT_MINUTES, &run_tests, crc))
   {
-    fprintf (stderr, "Test 'put' operation failed.\n");
+    FPRINTF (stderr, "%s",  "Test 'put' operation failed.\n");
     GNUNET_free (crc);
     ok = 1;
   }
@@ -331,7 +331,7 @@ check ()
   GNUNET_OS_process_close (proc);
   proc = NULL;
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %u\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %u\n", ok);
   return ok;
 }
 
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c
index 3504945..ca894ff 100644
--- a/src/datastore/test_plugin_datastore.c
+++ b/src/datastore/test_plugin_datastore.c
@@ -118,7 +118,7 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
   msg = NULL;
   prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
 #if VERBOSE
-  fprintf (stderr, "putting type %u, anon %u under key %s\n", i + 1, i,
+  FPRINTF (stderr, "putting type %u, anon %u under key %s\n", i + 1, i,
            GNUNET_h2s (&key));
 #endif
   if (GNUNET_OK != api->put (api->cls, &key, size, value, i + 1 /* type */ ,
@@ -131,7 +131,7 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k)
                                GNUNET_CRYPTO_random_u32
                                (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg))
   {
-    fprintf (stderr, "ERROR: `%s'\n", msg);
+    FPRINTF (stderr, "ERROR: `%s'\n", msg);
     GNUNET_free_non_null (msg);
     return;
   }
@@ -160,7 +160,7 @@ iterate_one_shot (void *cls, const GNUNET_HashCode * key, uint32_t size,
   guid = uid;
   crc->phase++;
 #if VERBOSE
-  fprintf (stderr,
+  FPRINTF (stderr,
            "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n",
            type, priority, size, (unsigned long long) expiration.abs_value,
            GNUNET_h2s (key));
@@ -230,7 +230,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     crc->phase = RP_ERROR;
   }
 #if VERBOSE
-  fprintf (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
+  FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt);
 #endif
   switch (crc->phase)
   {
@@ -324,7 +324,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
   GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
   if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
   {
-    fprintf (stderr, "Failed to load plugin `%s'!\n", name);
+    FPRINTF (stderr, "Failed to load plugin `%s'!\n", name);
     return NULL;
   }
   GNUNET_free (libname);
@@ -343,8 +343,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   api = load_plugin (c);
   if (api == NULL)
   {
-    fprintf (stderr,
-             "Could not initialize plugin, assuming database not configured. Test not run!\n");
+    FPRINTF (stderr,
+             "Could not initialize plugin, assuming database not configured. Test not run!\n", NULL);
     return;
   }
   crc = GNUNET_malloc (sizeof (struct CpsRunContext));
@@ -378,7 +378,7 @@ check ()
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                       "test-plugin-datastore", "nohelp", options, &run, NULL);
   if (ok != 0)
-    fprintf (stderr, "Missed some testcases: %u\n", ok);
+    FPRINTF (stderr, "Missed some testcases: %u\n", ok);
   return ok;
 }
 
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index 763ff8e..6ad4b30 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -129,7 +129,7 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                      unsigned int put_path_length, enum GNUNET_BLOCK_Type type,
                      size_t size, const void *data)
 {
-  fprintf (stdout, "Result %d, type %d:\n%.*s\n", result_count, type,
+  FPRINTF (stdout, "Result %d, type %d:\n%.*s\n", result_count, type,
            (unsigned int) size, (char *) data);
   result_count++;
 }
@@ -155,7 +155,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (query_key == NULL)
   {
     if (verbose)
-      fprintf (stderr, "Must provide key for DHT GET!\n");
+      FPRINTF (stderr, "%s",  "Must provide key for DHT GET!\n");
     ret = 1;
     return;
   }
@@ -165,12 +165,12 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (dht_handle == NULL)
   {
     if (verbose)
-      fprintf (stderr, "Couldn't connect to DHT service!\n");
+      FPRINTF (stderr, "%s",  "Couldn't connect to DHT service!\n");
     ret = 1;
     return;
   }
   else if (verbose)
-    fprintf (stderr, "Connected to DHT service!\n");
+    FPRINTF (stderr, "%s",  "Connected to DHT service!\n");
 
   if (query_type == GNUNET_BLOCK_TYPE_ANY)      /* Type of data not set */
     query_type = GNUNET_BLOCK_TYPE_TEST;
@@ -182,7 +182,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   absolute_timeout = GNUNET_TIME_relative_to_absolute (timeout);
 
   if (verbose)
-    fprintf (stderr, "Issuing GET request for %s!\n", query_key);
+    FPRINTF (stderr, "Issuing GET request for %s!\n", query_key);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
                                 (absolute_timeout), &cleanup_task, NULL);
   get_handle =
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 079a886..ef5ae5e 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -97,7 +97,7 @@ void
 message_sent_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   if (verbose)
-    fprintf (stderr, _("PUT request sent!\n"));
+    FPRINTF (stderr, "%s",  _("PUT request sent!\n"));
   GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
 }
 
@@ -121,7 +121,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if ((query_key == NULL) || (data == NULL))
   {
-    fprintf (stderr, _("Must provide KEY and DATA for DHT put!\n"));
+    FPRINTF (stderr, "%s",  _("Must provide KEY and DATA for DHT put!\n"));
     ret = 1;
     return;
   }
@@ -129,12 +129,12 @@ run (void *cls, char *const *args, const char *cfgfile,
   dht_handle = GNUNET_DHT_connect (cfg, 1);
   if (dht_handle == NULL)
   {
-    fprintf (stderr, _("Could not connect to %s service!\n"), "DHT");
+    FPRINTF (stderr, _("Could not connect to %s service!\n"), "DHT");
     ret = 1;
     return;
   }
   else if (verbose)
-    fprintf (stderr, _("Connected to %s service!\n"), "DHT");
+    FPRINTF (stderr, _("Connected to %s service!\n"), "DHT");
 
   if (query_type == GNUNET_BLOCK_TYPE_ANY)      /* Type of data not set */
     query_type = GNUNET_BLOCK_TYPE_TEST;
@@ -149,7 +149,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                          expiration_seconds));
 
   if (verbose)
-    fprintf (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
+    FPRINTF (stderr, _("Issuing put request for `%s' with data `%s'!\n"),
              query_key, data);
   GNUNET_DHT_put (dht_handle, &key, replication, GNUNET_DHT_RO_NONE, query_type,
                   strlen (data), data, expiration, timeout, &message_sent_cont,
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c
index e636c08..4ec2f2a 100644
--- a/src/dht/test_dht_api.c
+++ b/src/dht/test_dht_api.c
@@ -97,7 +97,7 @@ static int ok;
 static GNUNET_SCHEDULER_TaskIdentifier die_task;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -133,7 +133,7 @@ end_badly ()
 {
   /* do work here */
 #if VERBOSE
-  fprintf (stderr, "Ending on an unhappy note.\n");
+  FPRINTF (stderr, "%s",  "Ending on an unhappy note.\n");
 #endif
 
   if ((retry_context.peer_ctx != NULL) &&
diff --git a/src/dht/test_dht_multipeer.c b/src/dht/test_dht_multipeer.c
index 1a4fbaf..8aba274 100644
--- a/src/dht/test_dht_multipeer.c
+++ b/src/dht/test_dht_multipeer.c
@@ -220,7 +220,7 @@ shutdown_callback (void *cls, const char *emsg)
 {
   if (emsg != NULL)
   {
-    fprintf (stderr, "Failed to shutdown testing topology: %s\n", emsg);
+    FPRINTF (stderr, "Failed to shutdown testing topology: %s\n", emsg);
     if (ok == 0)
       ok = 2;
   }
@@ -311,7 +311,7 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
   struct StatMaster *sm = cls;
 
   stats[sm->value].total += value;
-  fprintf (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
+  FPRINTF (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
            name, (unsigned long long) value);
   return GNUNET_OK;
 }
@@ -369,7 +369,7 @@ stat_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     i = 0;
     while (stats[i].name != NULL)
     {
-      fprintf (stderr, "Total  : %12s/%50s = %12llu\n", stats[i].subsystem,
+      FPRINTF (stderr, "Total  : %12s/%50s = %12llu\n", stats[i].subsystem,
                stats[i].name, (unsigned long long) stats[i].total);
       i++;
     }
@@ -439,7 +439,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct TestGetContext *test_get;
 
   die_task = GNUNET_SCHEDULER_NO_TASK;
-  fprintf (stderr, "Failing test with error: `%s'!\n", emsg);
+  FPRINTF (stderr, "Failing test with error: `%s'!\n", emsg);
   while (NULL != (test_put = all_puts_head))
   {
     if (test_put->task != GNUNET_SCHEDULER_NO_TASK)
@@ -484,7 +484,7 @@ get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (test_get->succeeded != GNUNET_YES)
   {
     gets_failed++;
-    fprintf (stderr, "Get from peer %s for key %s failed!\n",
+    FPRINTF (stderr, "Get from peer %s for key %s failed!\n",
              GNUNET_i2s (&test_get->daemon->id), GNUNET_h2s (&search_key));
   }
   GNUNET_assert (test_get->get_handle != NULL);
@@ -500,7 +500,7 @@ get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if ((gets_failed > 10) && (outstanding_gets == 0))
   {
     /* Had more than 10% failures */
-    fprintf (stderr, "%llu gets succeeded, %llu gets failed!\n", gets_completed,
+    FPRINTF (stderr, "%llu gets succeeded, %llu gets failed!\n", gets_completed,
              gets_failed);
     GNUNET_SCHEDULER_cancel (die_task);
     ok = 1;
@@ -510,7 +510,7 @@ get_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   }
   if ((gets_completed + gets_failed == num_peers * num_peers) && (outstanding_gets == 0))       /* All gets successful */
   {
-    fprintf (stderr, "%llu gets succeeded, %llu gets failed!\n", gets_completed,
+    FPRINTF (stderr, "%llu gets succeeded, %llu gets failed!\n", gets_completed,
              gets_failed);
     GNUNET_SCHEDULER_cancel (die_task);
     ok = 0;
@@ -552,19 +552,19 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   {
     unsigned int i;
 
-    fprintf (stderr, "PUT (%u) Path: ", test_get->uid);
+    FPRINTF (stderr, "PUT (%u) Path: ", test_get->uid);
     for (i = 0; i < put_path_length; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
-    fprintf (stderr, "\n");
+      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
+    FPRINTF (stderr, "%s",  "\n");
   }
   if (get_path != NULL)
   {
     unsigned int i;
 
-    fprintf (stderr, "GET (%u) Path: ", test_get->uid);
+    FPRINTF (stderr, "GET (%u) Path: ", test_get->uid);
     for (i = 0; i < get_path_length; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
-    fprintf (stderr, "%s%s\n", get_path_length > 0 ? "->" : "",
+      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
+    FPRINTF (stderr, "%s%s\n", get_path_length > 0 ? "->" : "",
              GNUNET_i2s (&test_get->daemon->id));
   }
 #endif
@@ -572,7 +572,7 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   if ((0 != memcmp (&search_key, key, sizeof (GNUNET_HashCode))) ||
       (0 != memcmp (original_data, data, sizeof (original_data))))
   {
-    fprintf (stderr, "Key or data is not the same as was inserted!\n");
+    FPRINTF (stderr, "%s",  "Key or data is not the same as was inserted!\n");
     return;
   }
   gets_completed++;
@@ -639,7 +639,7 @@ start_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct TestGetContext *test_get;
 
 #if VERBOSE
-  fprintf (stderr, "Issuing %llu GETs\n",
+  FPRINTF (stderr, "Issuing %llu GETs\n",
            (unsigned long long) (num_peers * num_peers));
 #endif
   for (i = 0; i < num_peers; i++)
@@ -697,7 +697,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   GNUNET_assert (test_put->dht_handle != NULL);
   outstanding_puts++;
 #if VERBOSE > 2
-  fprintf (stderr, "PUT %u at `%s'\n", test_put->uid,
+  FPRINTF (stderr, "PUT %u at `%s'\n", test_put->uid,
            GNUNET_i2s (&test_put->daemon->id));
 #endif
   GNUNET_DHT_put (test_put->dht_handle, &key, 1, route_option,
@@ -725,7 +725,7 @@ run_dht_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   die_task =
       GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
                                     "from setup puts/gets");
-  fprintf (stderr, "Issuing %llu PUTs (one per peer)\n",
+  FPRINTF (stderr, "Issuing %llu PUTs (one per peer)\n",
            (unsigned long long) (num_peers * num_peers));
   for (i = 0; i < num_peers * num_peers; i++)
   {
@@ -750,7 +750,7 @@ startup_done (void *cls, const char *emsg)
 {
   if (emsg != NULL)
   {
-    fprintf (stderr, "Failed to setup topology: %s\n", emsg);
+    FPRINTF (stderr, "Failed to setup topology: %s\n", emsg);
     die_task = GNUNET_SCHEDULER_add_now (&end_badly, "topology setup failed");
     return;
   }
diff --git a/src/dht/test_dht_twopeer.c b/src/dht/test_dht_twopeer.c
index 04198b4..2adfda0 100644
--- a/src/dht/test_dht_twopeer.c
+++ b/src/dht/test_dht_twopeer.c
@@ -138,7 +138,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   const char *emsg = cls;
 
-  fprintf (stderr, "Error: %s\n", emsg);
+  FPRINTF (stderr, "Error: %s\n", emsg);
   if (curr_get_ctx.retry_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (curr_get_ctx.retry_task);
@@ -183,7 +183,7 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
   if (0 !=
       memcmp (&get_context->peer->hashPubKey, key, sizeof (GNUNET_HashCode)))
   {
-    fprintf (stderr, "??\n");
+    FPRINTF (stderr, "%s",  "??\n");
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Key returned is not the same key as was searched for!\n");
     GNUNET_SCHEDULER_cancel (die_task);
@@ -192,7 +192,7 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
                                   "key mismatch in get response!\n");
     return;
   }
-  fprintf (stderr, "!\n");
+  FPRINTF (stderr, "%s",  "!\n");
   if (get_context->retry_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (get_context->retry_task);
@@ -234,7 +234,7 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                 get_context->get_attempts);
   else
   {
-    fprintf (stderr, "?\n");
+    FPRINTF (stderr, "%s",  "?\n");
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Too many attempts failed, ending test!\n",
                 get_context->get_attempts);
@@ -244,7 +244,7 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                   "GET attempt failed, ending test!\n");
     return;
   }
-  fprintf (stderr, ".");
+  FPRINTF (stderr, "%s",  ".");
   get_context->get_attempts++;
   get_context->retry_task =
       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -381,7 +381,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
 {
   if (emsg != NULL)
   {
-    fprintf (stderr, "Failed to start daemon: `%s'\n", emsg);
+    FPRINTF (stderr, "Failed to start daemon: `%s'\n", emsg);
     return;
   }
   GNUNET_assert (id != NULL);
diff --git a/src/dht/test_dht_twopeer_path_tracking.c b/src/dht/test_dht_twopeer_path_tracking.c
index 61a3df0..c30a3f3 100644
--- a/src/dht/test_dht_twopeer_path_tracking.c
+++ b/src/dht/test_dht_twopeer_path_tracking.c
@@ -219,17 +219,17 @@ get_result_iterator (void *cls, struct GNUNET_TIME_Absolute exp,
 #if VERBOSE
   if (put_path != NULL)
   {
-    fprintf (stderr, "PUT Path: ");
+    FPRINTF (stderr, "%s",  "PUT Path: ");
     for (i = 0; i < put_path_length; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
-    fprintf (stderr, "\n");
+      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&put_path[i]));
+    FPRINTF (stderr, "%s",  "\n");
   }
   if (get_path != NULL)
   {
-    fprintf (stderr, "GET Path: ");
+    FPRINTF (stderr, "%s",  "GET Path: ");
     for (i = 0; i < get_path_length; i++)
-      fprintf (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
-    fprintf (stderr, "\n");
+      FPRINTF (stderr, "%s%s", i == 0 ? "" : "->", GNUNET_i2s (&get_path[i]));
+    FPRINTF (stderr, "%s",  "\n");
   }
 #endif
 
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c
index 2e49629..435bb2a 100644
--- a/src/dv/test_transport_api_dv.c
+++ b/src/dv/test_transport_api_dv.c
@@ -274,8 +274,8 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #endif
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
     fclose (dotOutFile);
+    FPRINTF (dotOutFile, "%s",  "}");
   }
 
   ok = 0;
@@ -382,7 +382,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 }
@@ -896,18 +896,18 @@ all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (dotOutFile != NULL)
   {
     if (distance == 1)
-      fprintf (dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
+      FPRINTF (dotOutFile, "\tn%s -- n%s;\n", d->shortname, second_shortname);
     else if (distance == 2)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=blue];\n", d->shortname,
                second_shortname);
     else if (distance == 3)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=red];\n", d->shortname,
                second_shortname);
     else if (distance == 4)
-      fprintf (dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=green];\n", d->shortname,
                second_shortname);
     else
-      fprintf (dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s [color=brown];\n", d->shortname,
                second_shortname);
   }
   GNUNET_free (second_shortname);
@@ -1067,7 +1067,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dotOutFile = fopen (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "strict graph G {\n");
+    FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
   }
 
 #if VERBOSE
diff --git a/src/fragmentation/test_fragmentation.c b/src/fragmentation/test_fragmentation.c
index 1f7a177..cbfb8ef 100644
--- a/src/fragmentation/test_fragmentation.c
+++ b/src/fragmentation/test_fragmentation.c
@@ -91,7 +91,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
   const char *buf;
 
 #if DETAILS
-  fprintf (stderr, "!");        /* message complete, good! */
+  FPRINTF (stderr, "%s",  "!");        /* message complete, good! */
 #endif
   buf = (const char *) hdr;
   for (i = sizeof (struct GNUNET_MessageHeader); i < ntohs (hdr->size); i++)
@@ -99,7 +99,7 @@ proc_msgs (void *cls, const struct GNUNET_MessageHeader *hdr)
   total++;
 #if ! DETAILS
   if (0 == (total % (NUM_MSGS / 100)))
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
 #endif
   /* tolerate 10% loss, i.e. due to duplicate fragment IDs */
   if ((total >= NUM_MSGS - (NUM_MSGS / 10)) && (ret != 0))
@@ -132,7 +132,7 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
     if (ret == GNUNET_OK)
     {
 #if DETAILS
-      fprintf (stderr, "@");    /* good ACK */
+      FPRINTF (stderr, "%s",  "@");    /* good ACK */
 #endif
       GNUNET_FRAGMENT_context_destroy (frags[i]);
       frags[i] = NULL;
@@ -142,14 +142,14 @@ proc_acks (void *cls, uint32_t msg_id, const struct GNUNET_MessageHeader *hdr)
     if (ret == GNUNET_NO)
     {
 #if DETAILS
-      fprintf (stderr, "@");    /* good ACK */
+      FPRINTF (stderr, "%s",  "@");    /* good ACK */
 #endif
       acks++;
       return;
     }
   }
 #if DETAILS
-  fprintf (stderr, "_");        /* BAD: ack that nobody feels responsible for... */
+  FPRINTF (stderr, "%s",  "_");        /* BAD: ack that nobody feels responsible for... */
 #endif
 }
 
@@ -171,21 +171,21 @@ proc_frac (void *cls, const struct GNUNET_MessageHeader *hdr)
   }
   if (NULL == defrag)
   {
-    fprintf (stderr, "E");      /* Error: frag after shutdown!? */
+    FPRINTF (stderr, "%s",  "E");      /* Error: frag after shutdown!? */
     return;
   }
   ret = GNUNET_DEFRAGMENT_process_fragment (defrag, hdr);
   if (ret == GNUNET_NO)
   {
 #if DETAILS
-    fprintf (stderr, "?");      /* duplicate fragment */
+    FPRINTF (stderr, "%s",  "?");      /* duplicate fragment */
 #endif
     dups++;
   }
   else if (ret == GNUNET_OK)
   {
 #if DETAILS
-    fprintf (stderr, ".");      /* good fragment */
+    FPRINTF (stderr, "%s",  ".");      /* good fragment */
 #endif
     fragc++;
   }
@@ -254,7 +254,7 @@ main (int argc, char *argv[])
                                    100);
   GNUNET_PROGRAM_run (5, argv_prog, "test-fragmentation", "nohelp", options,
                       &run, NULL);
-  fprintf (stderr,
+  FPRINTF (stderr,
            "\nHad %u good fragments, %u duplicate fragments, %u acks and %u simulated drops of acks\n",
            fragc, dups, acks, ack_drops);
   return ret;
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index f2b99f4..adb071e 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -129,7 +129,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (NULL == args[0])
   {
-    fprintf (stderr, _("You must specify a filename to inspect."));
+    FPRINTF (stderr, "%s",  _("You must specify a filename to inspect."));
     ret = 1;
     return;
   }
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index f38805c..9e4a8c2 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -97,7 +97,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
   {
   case GNUNET_FS_STATUS_DOWNLOAD_START:
     if (verbose > 1)
-      fprintf (stderr, _("Starting download `%s'.\n"),
+      FPRINTF (stderr, _("Starting download `%s'.\n"),
                info->value.download.filename);
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
@@ -108,7 +108,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
                                           1000LL /
                                           (info->value.download.
                                            duration.rel_value + 1));
-      fprintf (stdout,
+      FPRINTF (stdout,
                _("Downloading `%s' at %llu/%llu (%s remaining, %s/s)\n"),
                info->value.download.filename,
                (unsigned long long) info->value.download.completed,
@@ -118,7 +118,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     }
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
-    fprintf (stderr, _("Error downloading: %s.\n"),
+    FPRINTF (stderr, _("Error downloading: %s.\n"),
              info->value.download.specifics.error.message);
     GNUNET_SCHEDULER_shutdown ();
     break;
@@ -126,7 +126,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     s = GNUNET_STRINGS_byte_size_fancy (info->value.download.completed * 1000 /
                                         (info->value.download.
                                          duration.rel_value + 1));
-    fprintf (stdout, _("Downloading `%s' done (%s/s).\n"),
+    FPRINTF (stdout, _("Downloading `%s' done (%s/s).\n"),
              info->value.download.filename, s);
     GNUNET_free (s);
     if (info->value.download.dc == dc)
@@ -141,7 +141,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
   case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
     break;
   default:
-    fprintf (stderr, _("Unexpected status: %d\n"), info->status);
+    FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
     break;
   }
   return NULL;
@@ -166,27 +166,27 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (NULL == args[0])
   {
-    fprintf (stderr, _("You need to specify a URI argument.\n"));
+    FPRINTF (stderr, "%s",  _("You need to specify a URI argument.\n"));
     return;
   }
   uri = GNUNET_FS_uri_parse (args[0], &emsg);
   if (NULL == uri)
   {
-    fprintf (stderr, _("Failed to parse URI: %s\n"), emsg);
+    FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
     GNUNET_free (emsg);
     ret = 1;
     return;
   }
   if ((!GNUNET_FS_uri_test_chk (uri)) && (!GNUNET_FS_uri_test_loc (uri)))
   {
-    fprintf (stderr, _("Only CHK or LOC URIs supported.\n"));
+    FPRINTF (stderr, "%s",  _("Only CHK or LOC URIs supported.\n"));
     ret = 1;
     GNUNET_FS_uri_destroy (uri);
     return;
   }
   if (NULL == filename)
   {
-    fprintf (stderr, _("Target filename must be specified.\n"));
+    FPRINTF (stderr, "%s",  _("Target filename must be specified.\n"));
     ret = 1;
     GNUNET_FS_uri_destroy (uri);
     return;
@@ -200,7 +200,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                        request_parallelism, GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    fprintf (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
     GNUNET_FS_uri_destroy (uri);
     ret = 1;
     return;
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c
index dc86ce9..8cf08ec 100644
--- a/src/fs/gnunet-fs.c
+++ b/src/fs/gnunet-fs.c
@@ -72,9 +72,9 @@ static int
 print_indexed (void *cls, const char *filename, const GNUNET_HashCode * file_id)
 {
   if (verbose)
-    fprintf (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
+    FPRINTF (stdout, "%s: %s\n", GNUNET_h2s (file_id), filename);
   else
-    fprintf (stdout, "%s\n", filename);
+    FPRINTF (stdout, "%s\n", filename);
   return GNUNET_OK;
 }
 
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c
index ce0d245..412ddd2 100644
--- a/src/fs/gnunet-pseudonym.c
+++ b/src/fs/gnunet-pseudonym.c
@@ -100,7 +100,7 @@ ns_printer (void *cls, const char *name, const GNUNET_HashCode * id)
   struct GNUNET_CRYPTO_HashAsciiEncoded enc;
 
   GNUNET_CRYPTO_hash_to_enc (id, &enc);
-  fprintf (stdout, "%s (%s)\n", name, (const char *) &enc);
+  FPRINTF (stdout, "%s (%s)\n", name, (const char *) &enc);
 }
 
 
@@ -116,9 +116,9 @@ pseudo_printer (void *cls, const GNUNET_HashCode * pseudonym,
     GNUNET_break (0);
     return GNUNET_OK;
   }
-  fprintf (stdout, "%s (%d):\n", id, rating);
+  FPRINTF (stdout, "%s (%d):\n", id, rating);
   GNUNET_CONTAINER_meta_data_iterate (md, &EXTRACTOR_meta_data_print, stdout);
-  fprintf (stdout, "\n");
+  FPRINTF (stdout, "%s",  "\n");
   GNUNET_free (id);
   return GNUNET_OK;
 }
@@ -133,7 +133,7 @@ post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
 
   if (emsg != NULL)
   {
-    fprintf (stderr, "%s", emsg);
+    FPRINTF (stderr, "%s", emsg);
     ret = 1;
   }
   if (ns != NULL)
@@ -237,16 +237,16 @@ run (void *cls, char *const *args, const char *cfgfile,
       else
       {
         if (ksk_uri != NULL)
-          fprintf (stderr, _("Option `%s' ignored\n"), "-k");
+          FPRINTF (stderr, _("Option `%s' ignored\n"), "-k");
       }
     }
   }
   else
   {
     if (root_identifier != NULL)
-      fprintf (stderr, _("Option `%s' ignored\n"), "-r");
+      FPRINTF (stderr, _("Option `%s' ignored\n"), "-r");
     if (ksk_uri != NULL)
-      fprintf (stderr, _("Option `%s' ignored\n"), "-k");
+      FPRINTF (stderr, _("Option `%s' ignored\n"), "-k");
   }
 
   post_advertising (NULL, NULL, NULL);
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index ffcdefd..dd3bf68 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -115,7 +115,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     if (verbose)
     {
       s = GNUNET_STRINGS_relative_time_to_string (info->value.publish.eta);
-      fprintf (stdout, _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
+      FPRINTF (stdout, _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
                info->value.publish.filename,
                (unsigned long long) info->value.publish.completed,
                (unsigned long long) info->value.publish.size, s);
@@ -123,7 +123,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     }
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, _("Error publishing: %s.\n"),
+    FPRINTF (stderr, _("Error publishing: %s.\n"),
              info->value.publish.specifics.error.message);
     if (kill_task != GNUNET_SCHEDULER_NO_TASK)
     {
@@ -134,11 +134,11 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
-    fprintf (stdout, _("Publishing `%s' done.\n"),
+    FPRINTF (stdout, _("Publishing `%s' done.\n"),
              info->value.publish.filename);
     s = GNUNET_FS_uri_to_string (info->value.publish.specifics.
                                  completed.chk_uri);
-    fprintf (stdout, _("URI is `%s'.\n"), s);
+    FPRINTF (stdout, _("URI is `%s'.\n"), s);
     GNUNET_free (s);
     if (info->value.publish.pctx == NULL)
     {
@@ -157,10 +157,10 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
   case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
     return NULL;
   case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
-    fprintf (stderr, _("Cleanup after abort complete.\n"));
+    FPRINTF (stderr, "%s",  _("Cleanup after abort complete.\n"));
     return NULL;
   default:
-    fprintf (stderr, _("Unexpected status: %d\n"), info->status);
+    FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
     return NULL;
   }
   return "";                    /* non-null */
@@ -190,7 +190,7 @@ meta_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
     return 0;
   if (type == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME)
     return 0;
-  fprintf (stdout, "\t%s - %s\n", EXTRACTOR_metatype_to_string (type), data);
+  FPRINTF (stdout, "\t%s - %s\n", EXTRACTOR_metatype_to_string (type), data);
   return 0;
 }
 
@@ -206,7 +206,7 @@ meta_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
 static int
 keyword_printer (void *cls, const char *keyword, int is_mandatory)
 {
-  fprintf (stdout, "\t%s\n", keyword);
+  FPRINTF (stdout, "\t%s\n", keyword);
   return GNUNET_OK;
 }
 
@@ -269,14 +269,14 @@ publish_inspector (void *cls, struct GNUNET_FS_FileInformation *fi,
     fn = GNUNET_CONTAINER_meta_data_get_by_type (m,
                                                  EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
     fs = GNUNET_STRINGS_byte_size_fancy (length);
-    fprintf (stdout, _("Meta data for file `%s' (%s)\n"), fn, fs);
+    FPRINTF (stdout, _("Meta data for file `%s' (%s)\n"), fn, fs);
     GNUNET_CONTAINER_meta_data_iterate (m, &meta_printer, NULL);
-    fprintf (stdout, _("Keywords for file `%s' (%s)\n"), fn, fs);
+    FPRINTF (stdout, _("Keywords for file `%s' (%s)\n"), fn, fs);
     GNUNET_free (fn);
     GNUNET_free (fs);
     if (NULL != *uri)
       GNUNET_FS_uri_ksk_get_keywords (*uri, &keyword_printer, NULL);
-    fprintf (stdout, "\n");
+    FPRINTF (stdout, "%s",  "\n");
   }
   if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (m))
     GNUNET_FS_file_information_inspect (fi, &publish_inspector, fi);
@@ -293,7 +293,7 @@ uri_sks_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri,
 {
   if (emsg != NULL)
   {
-    fprintf (stderr, "%s\n", emsg);
+    FPRINTF (stderr, "%s\n", emsg);
     ret = 1;
   }
   GNUNET_FS_uri_destroy (uri);
@@ -314,7 +314,7 @@ uri_ksk_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri,
 
   if (emsg != NULL)
   {
-    fprintf (stderr, "%s\n", emsg);
+    FPRINTF (stderr, "%s\n", emsg);
     ret = 1;
   }
   if (pseudonym != NULL)
@@ -322,7 +322,7 @@ uri_ksk_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri,
     ns = GNUNET_FS_namespace_create (ctx, pseudonym);
     if (ns == NULL)
     {
-      fprintf (stderr, _("Failed to create namespace `%s'\n"), pseudonym);
+      FPRINTF (stderr, _("Failed to create namespace `%s'\n"), pseudonym);
       ret = 1;
     }
     else
@@ -385,7 +385,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   {
     if (NULL == this_id)
     {
-      fprintf (stderr, _("Option `%s' is required when using option `%s'.\n"),
+      FPRINTF (stderr, _("Option `%s' is required when using option `%s'.\n"),
                "-t", "-P");
       ret = -1;
       return;
@@ -395,14 +395,14 @@ run (void *cls, char *const *args, const char *cfgfile,
   {                             /* ordinary insertion checks */
     if (NULL != next_id)
     {
-      fprintf (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+      FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
                "-N", "-P");
       ret = -1;
       return;
     }
     if (NULL != this_id)
     {
-      fprintf (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+      FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
                "-t", "-P");
       ret = -1;
       return;
@@ -414,7 +414,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                        GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    fprintf (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
     ret = 1;
     return;
   }
@@ -424,7 +424,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     namespace = GNUNET_FS_namespace_create (ctx, pseudonym);
     if (NULL == namespace)
     {
-      fprintf (stderr, _("Could not create namespace `%s'\n"), pseudonym);
+      FPRINTF (stderr, _("Could not create namespace `%s'\n"), pseudonym);
       GNUNET_FS_stop (ctx);
       ret = 1;
       return;
@@ -436,7 +436,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     uri = GNUNET_FS_uri_parse (uri_string, &emsg);
     if (uri == NULL)
     {
-      fprintf (stderr, _("Failed to parse URI: %s\n"), emsg);
+      FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
       GNUNET_free (emsg);
       if (namespace != NULL)
         GNUNET_FS_namespace_delete (namespace, GNUNET_NO);
@@ -494,7 +494,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   EXTRACTOR_plugin_remove_all (plugins);
   if (fi == NULL)
   {
-    fprintf (stderr, _("Could not publish `%s': %s\n"), args[0], emsg);
+    FPRINTF (stderr, _("Could not publish `%s': %s\n"), args[0], emsg);
     GNUNET_free (emsg);
     if (namespace != NULL)
       GNUNET_FS_namespace_delete (namespace, GNUNET_NO);
@@ -517,7 +517,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                 GNUNET_FS_PUBLISH_OPTION_NONE);
   if (NULL == pc)
   {
-    fprintf (stderr, _("Could not start publishing.\n"));
+    FPRINTF (stderr, "%s",  _("Could not start publishing.\n"));
     GNUNET_FS_stop (ctx);
     ret = 1;
     return;
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index 3a30f6c..c221a30 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -107,7 +107,7 @@ clean_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                             GNUNET_DISK_PERM_USER_READ |
                             GNUNET_DISK_PERM_USER_WRITE))
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              _("Failed to write directory with search results to `%s'\n"),
              output_filename);
   }
@@ -178,7 +178,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     /* ignore */
     break;
   case GNUNET_FS_STATUS_SEARCH_ERROR:
-    fprintf (stderr, _("Error searching: %s.\n"),
+    FPRINTF (stderr, _("Error searching: %s.\n"),
              info->value.search.specifics.error.message);
     GNUNET_SCHEDULER_shutdown ();
     break;
@@ -187,7 +187,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   default:
-    fprintf (stderr, _("Unexpected status: %d\n"), info->status);
+    FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
     break;
   }
   return NULL;
@@ -228,7 +228,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   uri = GNUNET_FS_uri_ksk_create_from_args (argc, (const char **) args);
   if (NULL == uri)
   {
-    fprintf (stderr, _("Could not create keyword URI from arguments.\n"));
+    FPRINTF (stderr, "%s",  _("Could not create keyword URI from arguments.\n"));
     ret = 1;
     return;
   }
@@ -238,7 +238,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                        GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    fprintf (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
     GNUNET_FS_uri_destroy (uri);
     ret = 1;
     return;
@@ -252,7 +252,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   GNUNET_FS_uri_destroy (uri);
   if (NULL == sc)
   {
-    fprintf (stderr, _("Could not start searching.\n"));
+    FPRINTF (stderr, "%s",  _("Could not start searching.\n"));
     GNUNET_FS_stop (ctx);
     ret = 1;
     return;
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c
index 25560ca..3e8308d 100644
--- a/src/fs/gnunet-unindex.c
+++ b/src/fs/gnunet-unindex.c
@@ -86,19 +86,19 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
     if (verbose)
     {
       s = GNUNET_STRINGS_relative_time_to_string (info->value.unindex.eta);
-      fprintf (stdout, _("Unindexing at %llu/%llu (%s remaining)\n"),
+      FPRINTF (stdout, _("Unindexing at %llu/%llu (%s remaining)\n"),
                (unsigned long long) info->value.unindex.completed,
                (unsigned long long) info->value.unindex.size, s);
       GNUNET_free (s);
     }
     break;
   case GNUNET_FS_STATUS_UNINDEX_ERROR:
-    fprintf (stderr, _("Error unindexing: %s.\n"),
+    FPRINTF (stderr, _("Error unindexing: %s.\n"),
              info->value.unindex.specifics.error.message);
     GNUNET_SCHEDULER_shutdown ();
     break;
   case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
-    fprintf (stdout, _("Unindexing done.\n"));
+    FPRINTF (stdout, "%s",  _("Unindexing done.\n"));
     GNUNET_SCHEDULER_shutdown ();
     break;
   case GNUNET_FS_STATUS_UNINDEX_STOPPED:
@@ -106,7 +106,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   default:
-    fprintf (stderr, _("Unexpected status: %d\n"), info->status);
+    FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
     break;
   }
   return NULL;
@@ -138,14 +138,14 @@ run (void *cls, char *const *args, const char *cfgfile,
                        GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    fprintf (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
     ret = 1;
     return;
   }
   uc = GNUNET_FS_unindex_start (ctx, args[0], NULL);
   if (NULL == uc)
   {
-    fprintf (stderr, _("Could not start unindex operation.\n"));
+    FPRINTF (stderr, "%s",  _("Could not start unindex operation.\n"));
     GNUNET_FS_stop (ctx);
     return;
   }
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c
index bb8c8d8..6b9b1ab 100644
--- a/src/fs/perf_gnunet_service_fs_p2p.c
+++ b/src/fs/perf_gnunet_service_fs_p2p.c
@@ -120,7 +120,7 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
 {
   struct StatMaster *sm = cls;
 
-  fprintf (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
+  FPRINTF (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
            name, (unsigned long long) value);
   return GNUNET_OK;
 }
@@ -199,7 +199,7 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     fancy =
         GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) *
                                         1000LL / del.rel_value);
-    fprintf (stdout, "Download speed was %s/s\n", fancy);
+    FPRINTF (stdout, "Download speed was %s/s\n", fancy);
     GNUNET_free (fancy);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n",
                 (unsigned long long) FILESIZE);
diff --git a/src/fs/perf_gnunet_service_fs_p2p_trust.c b/src/fs/perf_gnunet_service_fs_p2p_trust.c
index 9f5a36b..94b7648 100644
--- a/src/fs/perf_gnunet_service_fs_p2p_trust.c
+++ b/src/fs/perf_gnunet_service_fs_p2p_trust.c
@@ -153,7 +153,7 @@ print_stat (void *cls, const char *subsystem, const char *name, uint64_t value,
 {
   struct StatMaster *sm = cls;
 
-  fprintf (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
+  FPRINTF (stderr, "Peer %2u: %12s/%50s = %12llu\n", sm->daemon, subsystem,
            name, (unsigned long long) value);
   return GNUNET_OK;
 }
@@ -234,7 +234,7 @@ do_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     fancy =
         GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) *
                                         1000LL / del.rel_value);
-    fprintf (stderr, "Download speed of type `%s' was %s/s\n", type, fancy);
+    FPRINTF (stderr, "Download speed of type `%s' was %s/s\n", type, fancy);
     GNUNET_free (fancy);
     if (NUM_DAEMONS != ++download_counter)
       return;                   /* more downloads to come */
diff --git a/src/fs/test_fs_directory.c b/src/fs/test_fs_directory.c
index 81012e7..96ad29c 100644
--- a/src/fs/test_fs_directory.c
+++ b/src/fs/test_fs_directory.c
@@ -59,7 +59,7 @@ processor (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
       return;
     }
   }
-  fprintf (stderr, "Error at %s:%d\n", __FILE__, __LINE__);
+  FPRINTF (stderr, "Error at %s:%d\n", __FILE__, __LINE__);
 }
 
 static int
@@ -131,7 +131,7 @@ testDirectory (unsigned int i)
   GNUNET_FS_directory_builder_finish (db, &dlen, (void **) &data);
   s = GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration
                                               (start));
-  fprintf (stdout,
+  FPRINTF (stdout,
            "Creating directory with %u entires and total size %llu took %s\n",
            i, (unsigned long long) dlen, s);
   GNUNET_free (s);
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c
index 19ef6e7..93ad0cb 100644
--- a/src/fs/test_fs_download.c
+++ b/src/fs/test_fs_download.c
@@ -190,14 +190,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
 #endif
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
-    fprintf (stderr, "Error downloading file: %s\n",
+    FPRINTF (stderr, "Error downloading file: %s\n",
              event->value.download.specifics.error.message);
     GNUNET_SCHEDULER_add_now (&abort_download_task, NULL);
     break;
diff --git a/src/fs/test_fs_download_indexed.c b/src/fs/test_fs_download_indexed.c
index 3f932f7..6592f6e 100644
--- a/src/fs/test_fs_download_indexed.c
+++ b/src/fs/test_fs_download_indexed.c
@@ -191,14 +191,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
 #endif
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
-    fprintf (stderr, "Error downloading file: %s\n",
+    FPRINTF (stderr, "Error downloading file: %s\n",
              event->value.download.specifics.error.message);
     GNUNET_SCHEDULER_add_now (&abort_download_task, NULL);
     break;
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c
index 9bc3723..1e1ed22 100644
--- a/src/fs/test_fs_download_persistence.c
+++ b/src/fs/test_fs_download_persistence.c
@@ -211,14 +211,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
 #endif
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
-    fprintf (stderr, "Error downloading file: %s\n",
+    FPRINTF (stderr, "Error downloading file: %s\n",
              event->value.download.specifics.error.message);
     GNUNET_SCHEDULER_add_now (&abort_download_task, NULL);
     break;
diff --git a/src/fs/test_fs_download_recursive.c b/src/fs/test_fs_download_recursive.c
index cede523..29d15c4 100644
--- a/src/fs/test_fs_download_recursive.c
+++ b/src/fs/test_fs_download_recursive.c
@@ -213,14 +213,14 @@ eventCallback (void *cls, const GNUNET_FSUI_Event * event)
 #endif
     break;
   case GNUNET_FSUI_unindex_error:
-    fprintf (stderr, "Error unindexing: %s\n",
+    FPRINTF (stderr, "Error unindexing: %s\n",
              event->data.UnindexError.message);
     break;
   case GNUNET_FSUI_upload_error:
-    fprintf (stderr, "Error uploading: %s\n", event->data.UploadError.message);
+    FPRINTF (stderr, "Error uploading: %s\n", event->data.UploadError.message);
     break;
   case GNUNET_FSUI_download_error:
-    fprintf (stderr, "Error downloading: %s\n",
+    FPRINTF (stderr, "Error downloading: %s\n",
              event->data.DownloadError.message);
     break;
   case GNUNET_FSUI_download_aborted:
@@ -277,7 +277,7 @@ main (int argc, char *argv[])
     GNUNET_GC_free (cfg);
     return -1;
   }
-  fprintf (stderr, "Setup...\n");
+  FPRINTF (stderr, "%s",  "Setup...\n");
 #if START_DAEMON
   GNUNET_disk_directory_remove (NULL,
                                 "/tmp/gnunet-fsui-recursive_download_test/");
@@ -297,7 +297,7 @@ main (int argc, char *argv[])
   kuri =
       GNUNET_ECRS_keyword_command_line_to_uri (ectx, 2,
                                                (const char **) keywords);
-  fprintf (stderr, "Uploading...\n");
+  FPRINTF (stderr, "%s",  "Uploading...\n");
   waitForEvent = GNUNET_FSUI_upload_completed;
   upload =
       GNUNET_FSUI_upload_start (ctx, fn,
@@ -322,7 +322,7 @@ main (int argc, char *argv[])
   upload = NULL;
   CHECK (upURI != NULL);
 
-  fprintf (stderr, "Downloading...\n");
+  FPRINTF (stderr, "%s",  "Downloading...\n");
   waitForEvent = GNUNET_FSUI_download_completed;
   fn43 = makeName (43);
   download =
@@ -341,7 +341,7 @@ main (int argc, char *argv[])
       break;
   }
 FAILURE:
-  fprintf (stderr, "Cleanup...\n");
+  FPRINTF (stderr, "%s",  "Cleanup...\n");
   if (meta != NULL)
     GNUNET_meta_data_destroy (meta);
   if (ctx != NULL)
diff --git a/src/fs/test_fs_file_information.c b/src/fs/test_fs_file_information.c
index a459c56..34ac328 100644
--- a/src/fs/test_fs_file_information.c
+++ b/src/fs/test_fs_file_information.c
@@ -151,8 +151,8 @@ testThumbnail ()
                                     EXTRACTOR_OPTION_DEFAULT_POLICY);
   if (ex == NULL)
   {
-    fprintf (stderr,
-             "Test incomplete, have no GTK thumbnail extractor available.\n");
+    FPRINTF (stderr,
+             "Test incomplete, have no GTK thumbnail extractor available.\n", NULL);
     return 0;                   /* can not test, no thumbnailer */
   }
   ex = EXTRACTOR_plugin_add_config (ex, "mime",
diff --git a/src/fs/test_fs_getopt.c b/src/fs/test_fs_getopt.c
index 2b0a9fc..571346f 100644
--- a/src/fs/test_fs_getopt.c
+++ b/src/fs/test_fs_getopt.c
@@ -35,6 +35,6 @@ main (int argc, char *argv[])
                     "WARNING",
 #endif
                     NULL);
-  fprintf (stderr, "WARNING: testcase not yet written.\n");
+  FPRINTF (stderr, "%s",  "WARNING: testcase not yet written.\n");
   return 0;                     /* testcase passed */
 }
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c
index 870f51a..8a847ba 100644
--- a/src/fs/test_fs_list_indexed.c
+++ b/src/fs/test_fs_list_indexed.c
@@ -131,7 +131,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     ret = event->value.publish.cctx;
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     err = 1;
     if (0 == strcmp ("list_indexed-context-dir", event->value.publish.cctx))
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c
index b1221eb..df9a310 100644
--- a/src/fs/test_fs_namespace.c
+++ b/src/fs/test_fs_namespace.c
@@ -139,7 +139,7 @@ abort_sks_search_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 static void
 do_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  fprintf (stderr, "Operation timed out\n");
+  FPRINTF (stderr, "%s",  "Operation timed out\n");
   kill_task = GNUNET_SCHEDULER_NO_TASK;
   abort_sks_search_task (NULL, tc);
   abort_ksk_search_task (NULL, tc);
@@ -158,7 +158,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
       if (!GNUNET_FS_uri_test_equal
           (sks_expect_uri, event->value.search.specifics.result.uri))
       {
-        fprintf (stderr, "Wrong result for sks search!\n");
+        FPRINTF (stderr, "%s",  "Wrong result for sks search!\n");
         err = 1;
       }
       /* give system 1ms to initiate update search! */
@@ -170,7 +170,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
       if (!GNUNET_FS_uri_test_equal
           (ksk_expect_uri, event->value.search.specifics.result.uri))
       {
-        fprintf (stderr, "Wrong result for ksk search!\n");
+        FPRINTF (stderr, "%s",  "Wrong result for ksk search!\n");
         err = 1;
       }
       GNUNET_SCHEDULER_add_continuation (&abort_ksk_search_task, NULL,
@@ -178,12 +178,12 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     }
     else
     {
-      fprintf (stderr, "Unexpected search result received!\n");
+      FPRINTF (stderr, "%s",  "Unexpected search result received!\n");
       GNUNET_break (0);
     }
     break;
   case GNUNET_FS_STATUS_SEARCH_ERROR:
-    fprintf (stderr, "Error searching file: %s\n",
+    FPRINTF (stderr, "Error searching file: %s\n",
              event->value.search.specifics.error.message);
     if (sks_search == event->value.search.sc)
       GNUNET_SCHEDULER_add_continuation (&abort_sks_search_task, NULL,
@@ -210,7 +210,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
   case GNUNET_FS_STATUS_SEARCH_STOPPED:
     return NULL;
   default:
-    fprintf (stderr, "Unexpected event: %d\n", event->status);
+    FPRINTF (stderr, "Unexpected event: %d\n", event->status);
     break;
   }
   return event->value.search.cctx;
@@ -227,7 +227,7 @@ publish_cont (void *cls, const struct GNUNET_FS_Uri *ksk_uri, const char *emsg)
 
   if (NULL != emsg)
   {
-    fprintf (stderr, "Error publishing: %s\n", emsg);
+    FPRINTF (stderr, "Error publishing: %s\n", emsg);
     err = 1;
     GNUNET_FS_stop (fs);
     return;
@@ -237,7 +237,7 @@ publish_cont (void *cls, const struct GNUNET_FS_Uri *ksk_uri, const char *emsg)
   sks_uri = GNUNET_FS_uri_parse (sbuf, &msg);
   if (msg != NULL)
   {
-    fprintf (stderr, "failed to parse URI `%s': %s\n", sbuf, msg);
+    FPRINTF (stderr, "failed to parse URI `%s': %s\n", sbuf, msg);
     err = 1;
     GNUNET_FS_stop (fs);
     GNUNET_free (msg);
@@ -287,7 +287,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg)
 
   if (NULL != emsg)
   {
-    fprintf (stderr, "Error publishing: %s\n", emsg);
+    FPRINTF (stderr, "Error publishing: %s\n", emsg);
     err = 1;
     GNUNET_FS_stop (fs);
     return;
@@ -336,7 +336,7 @@ testNamespace ()
   GNUNET_FS_namespace_list (fs, &ns_iterator, &ok);
   if (GNUNET_NO == ok)
   {
-    fprintf (stderr, "namespace_list failed to find namespace!\n");
+    FPRINTF (stderr, "%s",  "namespace_list failed to find namespace!\n");
     GNUNET_FS_namespace_delete (ns, GNUNET_YES);
     GNUNET_FS_stop (fs);
     err = 1;
@@ -399,7 +399,7 @@ main (int argc, char *argv[])
   stop_arm (&p1);
   if (GNUNET_YES != update_started)
   {
-    fprintf (stderr, "Update search never started!\n");
+    FPRINTF (stderr, "%s",  "Update search never started!\n");
     err = 1;
   }
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-namespace/");
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c
index 81ec3dd..051b84f 100644
--- a/src/fs/test_fs_publish.c
+++ b/src/fs/test_fs_publish.c
@@ -118,12 +118,12 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     ret = event->value.publish.cctx;
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     err = 1;
     if (0 == strcmp ("publish-context-dir", event->value.publish.cctx))
     {
-      fprintf (stderr, "Scheduling abort task for error on `%s'\n",
+      FPRINTF (stderr, "Scheduling abort task for error on `%s'\n",
                (const char *) event->value.publish.cctx);
       GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                          GNUNET_SCHEDULER_REASON_PREREQ_DONE);
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c
index 145ef0c..4d56984 100644
--- a/src/fs/test_fs_publish_persistence.c
+++ b/src/fs/test_fs_publish_persistence.c
@@ -184,7 +184,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
     ret = event->value.publish.cctx;
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     err = 1;
     GNUNET_SCHEDULER_add_now (&abort_publish_task, NULL);
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c
index 9d9825e..ffbcd19 100644
--- a/src/fs/test_fs_search.c
+++ b/src/fs/test_fs_search.c
@@ -122,14 +122,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_SEARCH_ERROR:
-    fprintf (stderr, "Error searching file: %s\n",
+    FPRINTF (stderr, "Error searching file: %s\n",
              event->value.search.specifics.error.message);
     GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -161,7 +161,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   default:
-    fprintf (stderr, "Unexpected event: %d\n", event->status);
+    FPRINTF (stderr, "Unexpected event: %d\n", event->status);
     break;
   }
   return NULL;
diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c
index 74ba965..e511b69 100644
--- a/src/fs/test_fs_search_persistence.c
+++ b/src/fs/test_fs_search_persistence.c
@@ -170,14 +170,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_SEARCH_ERROR:
-    fprintf (stderr, "Error searching file: %s\n",
+    FPRINTF (stderr, "Error searching file: %s\n",
              event->value.search.specifics.error.message);
     GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
@@ -223,7 +223,7 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     search = NULL;
     break;
   default:
-    fprintf (stderr, "Unexpected event: %d\n", event->status);
+    FPRINTF (stderr, "Unexpected event: %d\n", event->status);
     break;
   }
   return NULL;
diff --git a/src/fs/test_fs_search_ranking.c b/src/fs/test_fs_search_ranking.c
index 6da9363..3834474 100644
--- a/src/fs/test_fs_search_ranking.c
+++ b/src/fs/test_fs_search_ranking.c
@@ -189,7 +189,7 @@ main (int argc, char *argv[])
     prog++;
     if (prog == 10000)
     {
-      fprintf (stderr, "Upload failed to complete -- last event: %u\n",
+      FPRINTF (stderr, "Upload failed to complete -- last event: %u\n",
                lastEvent);
     }
     CHECK (prog < 10000);
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c
index 9b21cd6..14d93fb 100644
--- a/src/fs/test_fs_unindex.c
+++ b/src/fs/test_fs_unindex.c
@@ -135,14 +135,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
 #endif
     break;
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_UNINDEX_ERROR:
-    fprintf (stderr, "Error unindexing file: %s\n",
+    FPRINTF (stderr, "Error unindexing file: %s\n",
              event->value.unindex.specifics.error.message);
     GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c
index 0529aac..e5ad9b2 100644
--- a/src/fs/test_fs_unindex_persistence.c
+++ b/src/fs/test_fs_unindex_persistence.c
@@ -196,14 +196,14 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
     unindex = event->value.unindex.uc;
     return "unindex";
   case GNUNET_FS_STATUS_PUBLISH_ERROR:
-    fprintf (stderr, "Error publishing file: %s\n",
+    FPRINTF (stderr, "Error publishing file: %s\n",
              event->value.publish.specifics.error.message);
     GNUNET_break (0);
     GNUNET_SCHEDULER_add_continuation (&abort_publish_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
     break;
   case GNUNET_FS_STATUS_UNINDEX_ERROR:
-    fprintf (stderr, "Error unindexing file: %s\n",
+    FPRINTF (stderr, "Error unindexing file: %s\n",
              event->value.unindex.specifics.error.message);
     GNUNET_SCHEDULER_add_continuation (&abort_unindex_task, NULL,
                                        GNUNET_SCHEDULER_REASON_PREREQ_DONE);
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c
index 7274435..b7a58ec 100644
--- a/src/fs/test_fs_uri.c
+++ b/src/fs/test_fs_uri.c
@@ -94,7 +94,7 @@ testLocation ()
   cfg = GNUNET_CONFIGURATION_create ();
   if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, "test_fs_uri_data.conf"))
   {
-    fprintf (stderr, "Failed to parse configuration file\n");
+    FPRINTF (stderr, "%s",  "Failed to parse configuration file\n");
     GNUNET_FS_uri_destroy (baseURI);
     GNUNET_CONFIGURATION_destroy (cfg);
     return 1;
@@ -316,11 +316,11 @@ main (int argc, char *argv[])
   failureCount += testLocation ();
   for (i = 0; i < 255; i++)
   {
-    /* fprintf (stderr, "."); */
+    /* FPRINTF (stderr, "%s",  "."); */
     failureCount += testNamespace (i);
     failureCount += testFile (i);
   }
-  /* fprintf (stderr, "\n"); */
+  /* FPRINTF (stderr, "%s",  "\n"); */
   GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-uri");
   if (failureCount != 0)
     return 1;
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c
index 91caf10..70fadd8 100644
--- a/src/fs/test_gnunet_service_fs_migration.c
+++ b/src/fs/test_gnunet_service_fs_migration.c
@@ -74,7 +74,7 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     fancy =
         GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) *
                                         1000LL / del.rel_value);
-    fprintf (stdout, "Download speed was %s/s\n", fancy);
+    FPRINTF (stdout, "Download speed was %s/s\n", fancy);
     GNUNET_free (fancy);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n",
                 (unsigned long long) FILESIZE);
@@ -166,7 +166,7 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE))
   {
-    fprintf (stderr, "Daemons failed to start!\n");
+    FPRINTF (stderr, "%s",  "Daemons failed to start!\n");
     GNUNET_break (0);
     ok = 1;
     return;
diff --git a/src/fs/test_gnunet_service_fs_p2p.c b/src/fs/test_gnunet_service_fs_p2p.c
index 434dd3c..fb07d34 100644
--- a/src/fs/test_gnunet_service_fs_p2p.c
+++ b/src/fs/test_gnunet_service_fs_p2p.c
@@ -70,7 +70,7 @@ do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     fancy =
         GNUNET_STRINGS_byte_size_fancy (((unsigned long long) FILESIZE) *
                                         1000LL / del.rel_value);
-    fprintf (stdout, "Download speed was %s/s\n", fancy);
+    FPRINTF (stdout, "Download speed was %s/s\n", fancy);
     GNUNET_free (fancy);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished download, shutting down\n",
                 (unsigned long long) FILESIZE);
diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c
index eb15668..c645252 100644
--- a/src/hello/test_hello.c
+++ b/src/hello/test_hello.c
@@ -38,7 +38,7 @@ my_addr_gen (void *cls, size_t max, void *buf)
   struct GNUNET_HELLO_Address address;
 
 #if DEBUG
-  fprintf (stderr, "DEBUG: my_addr_gen called with i = %d\n", *i);
+  FPRINTF (stderr, "DEBUG: my_addr_gen called with i = %d\n", *i);
 #endif
   if (0 == *i)
     return 0;
@@ -61,7 +61,7 @@ check_addr (void *cls, const struct GNUNET_HELLO_Address *address,
   unsigned int *i = cls;
 
 #if DEBUG
-  fprintf (stderr, "DEBUG: check_addr called with i = %d and addrlen = %u\n",
+  FPRINTF (stderr, "DEBUG: check_addr called with i = %d and addrlen = %u\n",
            *i, address->address_length);
 #endif
   GNUNET_assert (address->address_length > 0);
@@ -82,7 +82,7 @@ remove_some (void *cls, const struct GNUNET_HELLO_Address *address,
   unsigned int *i = cls;
 
 #if DEBUG
-  fprintf (stderr, "DEBUG: remove_some called with i = %d and addrlen = %u\n",
+  FPRINTF (stderr, "DEBUG: remove_some called with i = %d and addrlen = %u\n",
            *i, address->address_length);
 #endif
   GNUNET_assert (address->address_length > 0);
@@ -110,7 +110,7 @@ main (int argc, char *argv[])
   startup_time = GNUNET_TIME_absolute_get ();
   memset (&publicKey, 42, sizeof (publicKey));
 #if VERBOSE
-  fprintf (stderr, "Testing HELLO creation (without addresses)...\n");
+  FPRINTF (stderr, "%s",  "Testing HELLO creation (without addresses)...\n");
 #endif
   i = 0;
   msg1 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
@@ -118,14 +118,14 @@ main (int argc, char *argv[])
   GNUNET_assert (0 < GNUNET_HELLO_size (msg1));
 
 #if VERBOSE
-  fprintf (stderr, "Testing address iteration (empty set)...\n");
+  FPRINTF (stderr, "%s",  "Testing address iteration (empty set)...\n");
 #endif
   GNUNET_assert (NULL ==
                  GNUNET_HELLO_iterate_addresses (msg1, GNUNET_NO, &check_addr,
                                                  &i));
 
 #if VERBOSE
-  fprintf (stderr, "Testing HELLO creation (with one address)...\n");
+  FPRINTF (stderr, "%s",  "Testing HELLO creation (with one address)...\n");
 #endif
   i = 1;
   msg2 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
@@ -133,7 +133,7 @@ main (int argc, char *argv[])
   GNUNET_assert (GNUNET_HELLO_size (msg1) < GNUNET_HELLO_size (msg2));
 
 #if VERBOSE
-  fprintf (stderr, "Testing address iteration (one address)...\n");
+  FPRINTF (stderr, "%s",  "Testing address iteration (one address)...\n");
 #endif
   i = 1;
   GNUNET_assert (NULL ==
@@ -142,14 +142,14 @@ main (int argc, char *argv[])
   GNUNET_assert (i == 0);
 
 #if VERBOSE
-  fprintf (stderr, "Testing get_key from HELLO...\n");
+  FPRINTF (stderr, "%s",  "Testing get_key from HELLO...\n");
 #endif
   GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_key (msg2, &pk));
   GNUNET_assert (0 == memcmp (&publicKey, &pk, sizeof (pk)));
   GNUNET_free (msg1);
 
 #if VERBOSE
-  fprintf (stderr, "Testing HELLO creation (with two addresses)...\n");
+  FPRINTF (stderr, "%s",  "Testing HELLO creation (with two addresses)...\n");
 #endif
   i = 2;
   msg3 = GNUNET_HELLO_create (&publicKey, &my_addr_gen, &i);
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
   GNUNET_assert (GNUNET_HELLO_size (msg2) < GNUNET_HELLO_size (msg3));
 
 #if VERBOSE
-  fprintf (stderr, "Testing address iteration (two addresses)...\n");
+  FPRINTF (stderr, "%s",  "Testing address iteration (two addresses)...\n");
 #endif
   i = 3;
   GNUNET_assert (NULL ==
@@ -166,7 +166,7 @@ main (int argc, char *argv[])
   GNUNET_assert (i == 0);
 
 #if VERBOSE
-  fprintf (stderr, "Testing HELLO merge...\n");
+  FPRINTF (stderr, "%s",  "Testing HELLO merge...\n");
 #endif
   msg1 = GNUNET_HELLO_merge (msg2, msg3);
   GNUNET_assert (GNUNET_HELLO_size (msg1) == GNUNET_HELLO_size (msg3));
@@ -179,7 +179,7 @@ main (int argc, char *argv[])
   GNUNET_free (msg1);
 
 #if VERBOSE
-  fprintf (stderr, "Testing address iteration to copy HELLO...\n");
+  FPRINTF (stderr, "%s",  "Testing address iteration to copy HELLO...\n");
 #endif
   i = 2;
   msg1 = GNUNET_HELLO_iterate_addresses (msg3, GNUNET_YES, &remove_some, &i);
@@ -193,7 +193,7 @@ main (int argc, char *argv[])
   GNUNET_free (msg1);
 
 #if VERBOSE
-  fprintf (stderr, "Testing delta address iteration...\n");
+  FPRINTF (stderr, "%s",  "Testing delta address iteration...\n");
 #endif
   i = 2;
   GNUNET_HELLO_iterate_new_addresses (msg3, msg2, startup_time, &check_addr,
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index 5dce8df..92cd7fc 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -113,7 +113,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (peer == NULL)
     return;
 #if VERBOSE
-  fprintf (stderr, "Peer %s connected\n", GNUNET_i2s (peer));
+  FPRINTF (stderr, "Peer %s connected\n", GNUNET_i2s (peer));
 #endif
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n");
   ok = 0;
@@ -252,10 +252,10 @@ main (int argc, char *argv[])
   ret = check ();
   if (ret == 0)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     /* now do it again */
     ret = check ();
-    fprintf (stderr, ".\n");
+    FPRINTF (stderr, "%s",  ".\n");
   }
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-1");
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
diff --git a/src/mesh/mesh_tunnel_tree.c b/src/mesh/mesh_tunnel_tree.c
index a7577e3..445b710 100644
--- a/src/mesh/mesh_tunnel_tree.c
+++ b/src/mesh/mesh_tunnel_tree.c
@@ -344,25 +344,25 @@ tree_node_debug (struct MeshTunnelTreeNode *n, uint16_t level)
   uint16_t i;
 
   for (i = 0; i < level; i++)
-    fprintf (stderr, "  ");
+    FPRINTF (stderr, "%s",  "  ");
   if (n->status == MESH_PEER_READY)
-    fprintf (stderr, "#");
+    FPRINTF (stderr, "%s",  "#");
   if (n->status == MESH_PEER_SEARCHING)
-    fprintf (stderr, "+");
+    FPRINTF (stderr, "%s",  "+");
   if (n->status == MESH_PEER_RELAY)
-    fprintf (stderr, "-");
+    FPRINTF (stderr, "%s",  "-");
   if (n->status == MESH_PEER_RECONNECTING)
-    fprintf (stderr, "*");
+    FPRINTF (stderr, "%s",  "*");
 
   GNUNET_PEER_resolve (n->peer, &id);
-  fprintf (stderr, "%s, [%u, %p] ", GNUNET_i2s (&id), n->peer, n);
+  FPRINTF (stderr, "%s, [%u, %p] ", GNUNET_i2s (&id), n->peer, n);
   if (NULL != n->parent)
   {
     GNUNET_PEER_resolve (n->parent->peer, &id);
-    fprintf (stderr, "(-> %s [%u])\n", GNUNET_i2s (&id), n->parent->peer);
+    FPRINTF (stderr, "(-> %s [%u])\n", GNUNET_i2s (&id), n->parent->peer);
   }
   else
-    fprintf (stderr, "(root)\n");
+    FPRINTF (stderr, "%s",  "(root)\n");
   for (c = n->children_head; NULL != c; c = c->next)
     tree_node_debug (c, level + 1);
 }
diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c
index 4b7e31e..0336ecc 100644
--- a/src/nat/gnunet-nat-server.c
+++ b/src/nat/gnunet-nat-server.c
@@ -284,7 +284,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   if ((args[0] == NULL) || (1 != SSCANF (args[0], "%u", &port)) || (0 == port)
       || (65536 <= port))
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              _
              ("Please pass valid port number as the first argument! (got `%s')\n"),
              args[0]);
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 801063b..43743c4 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -199,7 +199,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct NSEPeer *pos;
 
 #if VERBOSE
-  fprintf (stderr, "Ending test.\n");
+  FPRINTF (stderr, "%s",  "Ending test.\n");
 #endif
 
   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
@@ -252,7 +252,7 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
     GNUNET_free (output_buffer);
   }
   else
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Received network size estimate from peer %s. Size: %f std.dev. %f\n",
              GNUNET_i2s (&peer->daemon->id), estimate, std_dev);
 
diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c
index a2f73aa..7e0ab0b 100644
--- a/src/nse/test_nse_api.c
+++ b/src/nse/test_nse_api.c
@@ -93,7 +93,7 @@ check_nse_message (void *cls, struct GNUNET_TIME_Absolute timestamp,
 {
   int *ok = cls;
 
-  fprintf (stderr,
+  FPRINTF (stderr,
            "Received NSE message, estimate %f, standard deviation %f.\n",
            estimate, std_dev);
   /* Fantastic check below. Expect NaN, the only thing not equal to itself. */
@@ -162,7 +162,7 @@ check ()
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping arm.\n");
   stop_arm (&p1);
   if (0 != ok)
-    fprintf (stderr, "No information received from NSE service!\n");
+    FPRINTF (stderr, "%s",  "No information received from NSE service!\n");
   return ok;
 }
 
diff --git a/src/nse/test_nse_multipeer.c b/src/nse/test_nse_multipeer.c
index 435cdab..4cd5e43 100644
--- a/src/nse/test_nse_multipeer.c
+++ b/src/nse/test_nse_multipeer.c
@@ -93,7 +93,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   struct NSEPeer *pos;
 
 #if VERBOSE
-  fprintf (stderr, "Ending test.\n");
+  FPRINTF (stderr, "%s",  "Ending test.\n");
 #endif
 
   while (NULL != (pos = peer_head))
@@ -122,7 +122,7 @@ handle_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
 {
   struct NSEPeer *peer = cls;
 
-  fprintf (stderr,
+  FPRINTF (stderr,
            "Received network size estimate from peer %s. logSize: %f std.dev. %f (%f/%u)\n",
            GNUNET_i2s (&peer->daemon->id), estimate, std_dev,
            GNUNET_NSE_log_estimate_to_n (estimate), num_peers);
@@ -136,7 +136,7 @@ connect_nse_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   unsigned int i;
 
 #if VERBOSE
-  fprintf (stderr, "TEST_NSE_MULTIPEER: connecting to nse service of peers\n");
+  FPRINTF (stderr, "%s",  "TEST_NSE_MULTIPEER: connecting to nse service of peers\n");
 #endif
   for (i = 0; i < num_peers; i++)
   {
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index 337a9b2..21c9966 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -148,7 +148,7 @@ print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (peer == NULL)
   {
     if (err_msg != NULL)
-      fprintf (stderr, _("Error in communication with PEERINFO service\n"));
+      FPRINTF (stderr, "%s",  _("Error in communication with PEERINFO service\n"));
     GNUNET_PEERINFO_disconnect (peerinfo);
     return;
   }
@@ -191,7 +191,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   cfg = c;
   if (args[0] != NULL)
   {
-    fprintf (stderr, _("Invalid command line argument `%s'\n"), args[0]);
+    FPRINTF (stderr, _("Invalid command line argument `%s'\n"), args[0]);
     return;
   }
   if (get_self != GNUNET_YES)
@@ -199,7 +199,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     peerinfo = GNUNET_PEERINFO_connect (cfg);
     if (peerinfo == NULL)
     {
-      fprintf (stderr, _("Could not access PEERINFO service.  Exiting.\n"));
+      FPRINTF (stderr, "%s",  _("Could not access PEERINFO service.  Exiting.\n"));
       return;
     }
     GNUNET_PEERINFO_iterate (peerinfo, NULL,
@@ -213,14 +213,14 @@ run (void *cls, char *const *args, const char *cfgfile,
         GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY",
                                                  &fn))
     {
-      fprintf (stderr, _("Could not find option `%s:%s' in configuration.\n"),
+      FPRINTF (stderr, _("Could not find option `%s:%s' in configuration.\n"),
                "GNUNETD", "HOSTKEYFILE");
       return;
     }
     priv = GNUNET_CRYPTO_rsa_key_create_from_file (fn);
     if (priv == NULL)
     {
-      fprintf (stderr, _("Loading hostkey from `%s' failed.\n"), fn);
+      FPRINTF (stderr, _("Loading hostkey from `%s' failed.\n"), fn);
       GNUNET_free (fn);
       return;
     }
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
index 38bbb82..e69b487 100755
--- a/src/peerinfo/perf_peerinfo_api.c
+++ b/src/peerinfo/perf_peerinfo_api.c
@@ -56,7 +56,7 @@ check_it (void *cls, const struct GNUNET_HELLO_Address *address,
 #if DEBUG
   if (addrlen > 0)
   {
-    fprintf (stderr, "name: %s, addr: %s\n", tname, (const char *) addr);
+    FPRINTF (stderr, "name: %s, addr: %s\n", tname, (const char *) addr);
   }
 #endif
   return GNUNET_OK;
@@ -110,13 +110,13 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (peer == NULL)
   {
 #if DEBUG
-    fprintf (stderr, "Process received NULL response\n");
+    FPRINTF (stderr, "Process received NULL response\n");
 #endif
   }
   else
   {
 #if DEBUG
-    fprintf (stderr, "Processed a peer\n");
+    FPRINTF (stderr, "Processed a peer\n");
 #endif
     numpeers++;
     if (0 && (hello != NULL))
@@ -179,7 +179,7 @@ check ()
   GNUNET_assert (NULL != proc);
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
                       "perf-peerinfo-api", "nohelp", options, &run, &ok);
-  fprintf (stderr, "Received %u/%u calls before timeout\n", numpeers,
+  FPRINTF (stderr, "Received %u/%u calls before timeout\n", numpeers,
            NUM_REQUESTS * NUM_REQUESTS / 2);
   GAUGER ("PEERINFO", "Peerinfo lookups", numpeers / 30, "peers/s");
 #if START_SERVICE
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index 0f2c925..7fe7816 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -95,7 +95,7 @@ cleanup (void *cls, int success)
 
   if (success != GNUNET_OK)
   {
-    fprintf (stderr, _("Failed to obtain statistics.\n"));
+    FPRINTF (stderr, _("Failed to obtain statistics.\n"),NULL);
     ret = 1;
   }
   if (h != NULL)
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c
index e966ca1..2bca7b3 100644
--- a/src/testing/test_testing_large_topology.c
+++ b/src/testing/test_testing_large_topology.c
@@ -245,7 +245,7 @@ finish_testing ()
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 
@@ -290,19 +290,19 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
   {
     if (outfile != NULL)
     {
-      fprintf (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
-      fprintf (outfile, "\"%s\";\n", GNUNET_i2s (second));
+      FPRINTF (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
+      FPRINTF (outfile, "\"%s\";\n", GNUNET_i2s (second));
     }
     topology_connections++;
   }
   else
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Finished iterating over topology, %d total connections!\n",
              topology_connections);
     if (outfile != NULL)
     {
-      fprintf (outfile, "}\n");
+      FPRINTF (outfile, "%s",  "}\n");
       fclose (outfile);
       GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
     }
@@ -326,16 +326,16 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
   if ((total_messages_received) % modnum == 0)
   {
     if (total_messages_received == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) total_messages_received / expected_messages) *
                       100));
 
   }
   else if (total_messages_received % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -354,7 +354,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (total_messages_received == expected_messages)
   {
 #if VERBOSE
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
     GNUNET_SCHEDULER_cancel (die_task);
     GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
@@ -362,7 +362,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
     GNUNET_free (dotOutFileNameFinished);
     if (dotOutFileFinished != NULL)
     {
-      fprintf (dotOutFileFinished, "strict graph G {\n");
+      FPRINTF (dotOutFileFinished, "%s",  "strict graph G {\n");
     }
     topology_connections = 0;
     GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished);
@@ -424,7 +424,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 }
@@ -639,16 +639,16 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
     if ((total_connections) % modnum == 0)
     {
       if (total_connections == 0)
-        fprintf (stdout, "0%%");
+        FPRINTF (stdout, "%s",  "0%%");
       else
-        fprintf (stdout, "%d%%",
+        FPRINTF (stdout, "%d%%",
                  (int) (((float) total_connections / expected_connections) *
                         100));
 
     }
     else if (total_connections % dotnum == 0)
     {
-      fprintf (stdout, ".");
+      FPRINTF (stdout, "%s",  ".");
     }
     fflush (stdout);
 #endif
@@ -667,7 +667,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
 
     expected_messages++;
     if (dotOutFile != NULL)
-      fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
                second_daemon->shortname);
   }
 #if VERBOSE
@@ -683,7 +683,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
   if (total_connections == expected_connections)
   {
 #if VERBOSE
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -695,7 +695,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
     GNUNET_SCHEDULER_cancel (die_task);
     die_task = GNUNET_SCHEDULER_NO_TASK;
 #if DELAY_FOR_LOGGING
-    fprintf (stdout, "Sending test messages in 10 seconds.\n");
+    FPRINTF (stdout, "%s",  "Sending test messages in 10 seconds.\n");
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_SECONDS, 10),
                                   &send_test_messages, test_messages);
@@ -709,7 +709,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
                                   test_messages);
 #endif
 #if VERBOSE
-    fprintf (stdout, "Test message progress: [");
+    FPRINTF (stdout, "%s",  "Test message progress: [");
 #endif
 
   }
@@ -784,7 +784,7 @@ connect_topology ()
   modnum = expected_connections / 4;
   dotnum = (expected_connections / 50) + 1;
 #if VERBOSE
-  fprintf (stdout, "Peer connection progress: [");
+  FPRINTF (stdout, "%s",  "Peer connection progress: [");
 #endif
 }
 
@@ -798,7 +798,7 @@ create_topology ()
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Topology set up, now starting peers!\n");
-    fprintf (stdout, "Daemon start progress [");
+    FPRINTF (stdout, "%s",  "Daemon start progress [");
 #endif
     GNUNET_TESTING_daemons_continue_startup (pg);
   }
@@ -836,15 +836,15 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if ((num_peers - peers_left) % modnum == 0)
   {
     if (num_peers - peers_left == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) (num_peers - peers_left) / num_peers) * 100));
 
   }
   else if ((num_peers - peers_left) % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -852,7 +852,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if (peers_left == 0)
   {
 #if VERBOSE
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -865,7 +865,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
         GNUNET_SCHEDULER_add_delayed (timeout, &end_badly,
                                       "from peers_started_callback");
 #if DELAY_FOR_LOGGING
-    fprintf (stdout, "Connecting topology in 10 seconds\n");
+    FPRINTF (stdout, "%s",  "Connecting topology in 10 seconds\n");
     gather_log_data ();
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_SECONDS, 10),
@@ -905,15 +905,15 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if ((num_peers - peers_left) % modnum == 0)
   {
     if (num_peers - peers_left == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) (num_peers - peers_left) / num_peers) * 100));
 
   }
   else if ((num_peers - peers_left) % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -921,7 +921,7 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if (peers_left == 0)
   {
 #if VERBOSE
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All %d hostkeys created, now creating topology!\n", num_peers);
 #endif
@@ -952,7 +952,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dotOutFile = fopen (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "strict graph G {\n");
+    FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
   }
 
 #if VERBOSE
@@ -1101,7 +1101,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   modnum = num_peers / 4;
   dotnum = (num_peers / 50) + 1;
 #if VERBOSE
-  fprintf (stdout, "Hostkey generation progress: [");
+  FPRINTF (stdout, "%s",  "Hostkey generation progress: [");
 #endif
   /* Set up a task to end testing if peer start fails */
   die_task =
diff --git a/src/testing/test_testing_reconnect.c b/src/testing/test_testing_reconnect.c
index 20c628c..bcee386 100644
--- a/src/testing/test_testing_reconnect.c
+++ b/src/testing/test_testing_reconnect.c
@@ -72,11 +72,11 @@ end2_cb (void *cls, const char *emsg)
   {
     if (phase < NUM_PHASES)
     {
-      fprintf (stderr, ".");
+      FPRINTF (stderr, "%s",  ".");
       run_phase ();
       return;
     }
-    fprintf (stderr, ".\n");
+    FPRINTF (stderr, "%s",  ".\n");
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Both daemons terminated, will now exit.\n");
@@ -129,8 +129,8 @@ my_connect_complete (void *cls, const struct GNUNET_PeerIdentity *first,
 {
   cc = NULL;
 #if VERBOSE
-  fprintf (stderr, "Peer %s ", GNUNET_i2s (first));
-  fprintf (stderr, "connected to %s\n", GNUNET_i2s (second));
+  FPRINTF (stderr, "Peer %s ", GNUNET_i2s (first));
+  FPRINTF (stderr, "connected to %s\n", GNUNET_i2s (second));
 #endif
   GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
 }
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index 7d0c0da..17f3be8 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -253,8 +253,8 @@ finish_testing ()
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
-    fclose (dotOutFile);
+    FPRINTF (dotOutFile, "%s",  "}");
+    FCLOSE (dotOutFile);
   }
 
   ok = 0;
@@ -326,19 +326,19 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
   {
     if (outfile != NULL)
     {
-      fprintf (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
-      fprintf (outfile, "\"%s\";\n", GNUNET_i2s (second));
+      FPRINTF (outfile, "\t\"%s\" -- ", GNUNET_i2s (first));
+      FPRINTF (outfile, "\"%s\";\n", GNUNET_i2s (second));
     }
     topology_connections++;
   }
   else
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "Finished iterating over topology, %d total connections!\n",
              topology_connections);
     if (outfile != NULL)
     {
-      fprintf (outfile, "}\n");
+      FPRINTF (outfile, "%s",  "}\n");
       fclose (outfile);
 #if DO_STATS
       GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL);
@@ -366,16 +366,16 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
   if ((total_messages_received) % modnum == 0)
   {
     if (total_messages_received == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) total_messages_received / expected_messages) *
                       100));
 
   }
   else if (total_messages_received % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -394,7 +394,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (total_messages_received == expected_messages)
   {
 #if PROGRESS_BARS
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
     GNUNET_SCHEDULER_cancel (die_task);
     GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
@@ -402,7 +402,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
     GNUNET_free (dotOutFileNameFinished);
     if (dotOutFileFinished != NULL)
     {
-      fprintf (dotOutFileFinished, "strict graph G {\n");
+      FPRINTF (dotOutFileFinished, "%s",  "strict graph G {\n");
     }
     topology_connections = 0;
     GNUNET_TESTING_get_topology (pg, &topology_cb, dotOutFileFinished);
@@ -464,7 +464,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 }
@@ -680,16 +680,16 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
     if ((total_connections) % modnum == 0)
     {
       if (total_connections == 0)
-        fprintf (stdout, "0%%");
+        FPRINTF (stdout, "%s",  "0%%");
       else
-        fprintf (stdout, "%d%%",
+        FPRINTF (stdout, "%d%%",
                  (int) (((float) total_connections / expected_connections) *
                         100));
 
     }
     else if (total_connections % dotnum == 0)
     {
-      fprintf (stdout, ".");
+      FPRINTF (stdout, "%s",  ".");
     }
     fflush (stdout);
 #endif
@@ -708,7 +708,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
 
     expected_messages++;
     if (dotOutFile != NULL)
-      fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
                second_daemon->shortname);
   }
 #if VERBOSE
@@ -724,7 +724,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
   if (total_connections == expected_connections)
   {
 #if PROGRESS_BARS
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -740,7 +740,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
     GNUNET_SCHEDULER_cancel (die_task);
     die_task = GNUNET_SCHEDULER_NO_TASK;
 #if DELAY_FOR_LOGGING
-    fprintf (stdout, "Sending test messages in 10 seconds.\n");
+    FPRINTF (stdout, "%s",  "Sending test messages in 10 seconds.\n");
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_SECONDS, 10),
                                   &send_test_messages, test_messages);
@@ -754,7 +754,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
                                   test_messages);
 #endif
 #if PROGRESS_BARS
-    fprintf (stdout, "Test message progress: [");
+    FPRINTF (stdout, "%s",  "Test message progress: [");
 #endif
 
   }
@@ -837,7 +837,7 @@ connect_topology ()
   if (dotnum == 0)
     dotnum = 1;
 #if PROGRESS_BARS
-  fprintf (stdout, "Peer connection progress: [");
+  FPRINTF (stdout, "%s",  "Peer connection progress: [");
 #endif
 }
 
@@ -851,7 +851,7 @@ create_topology ()
 #if PROGRESS_BARS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Topology set up, now starting peers!\n");
-    fprintf (stdout, "Daemon start progress [");
+    FPRINTF (stdout, "%s",  "Daemon start progress [");
 #endif
     GNUNET_TESTING_daemons_continue_startup (pg);
   }
@@ -892,15 +892,15 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if ((num_peers - peers_left) % modnum == 0)
   {
     if (num_peers - peers_left == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) (num_peers - peers_left) / num_peers) * 100));
 
   }
   else if ((num_peers - peers_left) % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -908,7 +908,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if (peers_left == 0)
   {
 #if PROGRESS_BARS
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
 #endif
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -922,7 +922,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
                                       (GNUNET_TIME_UNIT_MINUTES, 8), &end_badly,
                                       "from peers_started_callback");
 #if DELAY_FOR_LOGGING
-    fprintf (stdout, "Connecting topology in 10 seconds\n");
+    FPRINTF (stdout, "%s",  "Connecting topology in 10 seconds\n");
     gather_log_data ();
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_SECONDS, 10),
@@ -962,15 +962,15 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if ((num_peers - peers_left) % modnum == 0)
   {
     if (num_peers - peers_left == 0)
-      fprintf (stdout, "0%%");
+      FPRINTF (stdout, "%s",  "0%%");
     else
-      fprintf (stdout, "%d%%",
+      FPRINTF (stdout, "%d%%",
                (int) (((float) (num_peers - peers_left) / num_peers) * 100));
 
   }
   else if ((num_peers - peers_left) % dotnum == 0)
   {
-    fprintf (stdout, ".");
+    FPRINTF (stdout, "%s",  ".");
   }
   fflush (stdout);
 #endif
@@ -978,7 +978,7 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
   if (peers_left == 0)
   {
 #if PROGRESS_BARS
-    fprintf (stdout, "100%%]\n");
+    FPRINTF (stdout, "%s",  "100%%]\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All %d hostkeys created, now creating topology!\n", num_peers);
 #endif
@@ -1009,7 +1009,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dotOutFile = fopen (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "strict graph G {\n");
+    FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
   }
 
 #if VERBOSE
@@ -1156,7 +1156,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (dotnum == 0)
     dotnum = 1;
 #if PROGRESS_BARS
-  fprintf (stdout, "Hostkey generation progress: [");
+  FPRINTF (stdout, "%s",  "Hostkey generation progress: [");
 #endif
   /* Set up a task to end testing if peer start fails */
   die_task =
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c
index 095c5b2..9ff1fcb 100644
--- a/src/testing/test_testing_topology_blacklist.c
+++ b/src/testing/test_testing_topology_blacklist.c
@@ -142,7 +142,7 @@ finish_testing ()
 #endif
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 
@@ -167,7 +167,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "}");
+    FPRINTF (dotOutFile, "%s",  "}");
     fclose (dotOutFile);
   }
 }
@@ -191,7 +191,7 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
                 first_daemon->shortname, second_daemon->shortname);
 #endif
     if (dotOutFile != NULL)
-      fprintf (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
+      FPRINTF (dotOutFile, "\tn%s -- n%s;\n", first_daemon->shortname,
                second_daemon->shortname);
   }
 
@@ -399,7 +399,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   dotOutFile = fopen (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
-    fprintf (dotOutFile, "strict graph G {\n");
+    FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
   }
 
 #if VERBOSE
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index f56c513..4f67179 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -1115,17 +1115,17 @@ update_meter (struct ProgressMeter *meter)
     {
       if (meter->completed == 0)
       {
-        fprintf (stdout, "%sProgress: [0%%", meter->startup_string);
+        FPRINTF (stdout, "%sProgress: [0%%", meter->startup_string);
       }
       else
-        fprintf (stdout, "%d%%",
+        FPRINTF (stdout, "%d%%",
                  (int) (((float) meter->completed / meter->total) * 100));
     }
     else if (meter->completed % meter->dotnum == 0)
-      fprintf (stdout, ".");
+      FPRINTF (stdout, "%s",  ".");
 
     if (meter->completed + 1 == meter->total)
-      fprintf (stdout, "%d%%]\n", 100);
+      FPRINTF (stdout, "%d%%]\n", 100);
     fflush (stdout);
   }
   meter->completed++;
@@ -2810,7 +2810,7 @@ friend_file_iterator (void *cls, const GNUNET_HashCode * key, void *value)
 
   temppeer = &peer->id;
   GNUNET_CRYPTO_hash_to_enc (&temppeer->hashPubKey, &peer_enc);
-  fprintf (temp_friend_handle, "%s\n", (char *) &peer_enc);
+  FPRINTF (temp_friend_handle, "%s\n", (char *) &peer_enc);
 
   return GNUNET_YES;
 }
@@ -2849,7 +2849,7 @@ blacklist_file_iterator (void *cls, const GNUNET_HashCode * key, void *value)
   GNUNET_CRYPTO_hash_to_enc (&temppeer->hashPubKey, &peer_enc);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Writing entry %s:%s to file\n",
               blacklist_ctx->transport, (char *) &peer_enc);
-  fprintf (blacklist_ctx->temp_file_handle, "%s:%s\n", blacklist_ctx->transport,
+  FPRINTF (blacklist_ctx->temp_file_handle, "%s:%s\n", blacklist_ctx->transport,
            (char *) &peer_enc);
 
   return GNUNET_YES;
@@ -2899,7 +2899,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
     {
       GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon->
                                  id.hashPubKey, &peer_enc);
-      fprintf (temp_friend_handle, "%s\n", (char *) &peer_enc);
+      FPRINTF (temp_friend_handle, "%s\n", (char *) &peer_enc);
       conn_iter = conn_iter->next;
     }
 #else
@@ -3086,7 +3086,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
         {
           GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon->
                                      id.hashPubKey, &peer_enc);
-          fprintf (temp_file_handle, "%s:%s\n", pos, (char *) &peer_enc);
+          FPRINTF (temp_file_handle, "%s:%s\n", pos, (char *) &peer_enc);
           conn_iter = conn_iter->next;
         }
 #else
diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c
index bf69a7f..a34cb5a 100644
--- a/src/testing/testing_peergroup.c
+++ b/src/testing/testing_peergroup.c
@@ -210,17 +210,17 @@ update_meter (struct ProgressMeter *meter)
     {
       if (meter->completed == 0)
       {
-        fprintf (stdout, "%sProgress: [0%%", meter->startup_string);
+        FPRINTF (stdout, "%sProgress: [0%%", meter->startup_string);
       }
       else
-        fprintf (stdout, "%d%%",
+        FPRINTF (stdout, "%d%%",
                  (int) (((float) meter->completed / meter->total) * 100));
     }
     else if (meter->completed % meter->dotnum == 0)
-      fprintf (stdout, ".");
+      FPRINTF (stdout, "%s",  ".");
 
     if (meter->completed + 1 == meter->total)
-      fprintf (stdout, "%d%%]\n", 100);
+      FPRINTF (stdout, "%d%%]\n", 100);
     fflush (stdout);
   }
   meter->completed++;
diff --git a/src/topology/test_gnunet_daemon_topology.c b/src/topology/test_gnunet_daemon_topology.c
index 9d8f163..65a313d 100644
--- a/src/topology/test_gnunet_daemon_topology.c
+++ b/src/topology/test_gnunet_daemon_topology.c
@@ -110,7 +110,7 @@ notify_connect_complete (void *cls, const struct GNUNET_PeerIdentity *first,
   *cc = NULL;
   if (NULL != emsg)
   {
-    fprintf (stderr, "Failed to connect two peers: %s\n", emsg);
+    FPRINTF (stderr, "Failed to connect two peers: %s\n", emsg);
     for (i = 0; i < NUM_PEERS; i++)
       if (NULL != cc[i])
       {
diff --git a/src/transport/gnunet-transport-connect-running-peers.c b/src/transport/gnunet-transport-connect-running-peers.c
index 172f34b..8ba8189 100644
--- a/src/transport/gnunet-transport-connect-running-peers.c
+++ b/src/transport/gnunet-transport-connect-running-peers.c
@@ -73,7 +73,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -368,7 +368,7 @@ main (int argc, char *argv[])
 
   if (argc < 3)
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              "usage gnunet-transport-connect-running-peers <cfg_peer1> <cfg_peer2>\n");
     return -1;
   }
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 02a5ee4..17a21dd 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -167,11 +167,11 @@ display_test_result (struct TestContext *tc, int result)
 {
   if (GNUNET_YES != result)
   {
-    fprintf (stderr, "Configuration for plugin `%s' did not work!\n", tc->name);
+    FPRINTF (stderr, "Configuration for plugin `%s' did not work!\n", tc->name);
   }
   else
   {
-    fprintf (stderr, "Configuration for plugin `%s' is working!\n", tc->name);
+    FPRINTF (stderr, "Configuration for plugin `%s' is working!\n", tc->name);
   }
   if (GNUNET_SCHEDULER_NO_TASK != tc->tsk)
   {
@@ -245,9 +245,9 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
       GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins",
                                              &plugins))
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              _
-             ("No transport plugins configured, peer will never communicate\n"));
+             ("No transport plugins configured, peer will never communicate\n"), NULL);
     ret = 4;
     return;
   }
@@ -259,7 +259,7 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
     if (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT", &bnd_port))
     {
-      fprintf (stderr,
+      FPRINTF (stderr,
                _("No port configured for plugin `%s', cannot test it\n"), tok);
       continue;
     }
@@ -310,14 +310,14 @@ do_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (benchmark_receive)
   {
     duration = GNUNET_TIME_absolute_get_duration (start_time);
-    fprintf (stdout, _("Received %llu bytes/s (%llu bytes in %llu ms)\n"),
+    FPRINTF (stdout, _("Received %llu bytes/s (%llu bytes in %llu ms)\n"),
              1000 * traffic_received / (1 + duration.rel_value),
              traffic_received, (unsigned long long) duration.rel_value);
   }
   if (benchmark_send)
   {
     duration = GNUNET_TIME_absolute_get_duration (start_time);
-    fprintf (stdout, _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"),
+    FPRINTF (stdout, _("Transmitted %llu bytes/s (%llu bytes in %llu ms)\n"),
              1000 * traffic_sent / (1 + duration.rel_value), traffic_sent,
              (unsigned long long) duration.rel_value);
   }
@@ -350,7 +350,7 @@ transmit_data (void *cls, size_t size, void *buf)
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                &transmit_data, NULL);
   if (verbosity > 0)
-    fprintf (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
+    FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size,
              GNUNET_i2s (&pid));
   return size;
 }
@@ -370,7 +370,7 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
                 const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
 {
   if (verbosity > 0)
-    fprintf (stdout, _("Connected to %s\n"), GNUNET_i2s (peer));
+    FPRINTF (stdout, _("Connected to %s\n"), GNUNET_i2s (peer));
   if (0 != memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity)))
     return;
   ret = 0;
@@ -401,7 +401,7 @@ static void
 notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
   if (verbosity > 0)
-    fprintf (stdout, _("Disconnected from %s\n"), GNUNET_i2s (peer));
+    FPRINTF (stdout, _("Disconnected from %s\n"), GNUNET_i2s (peer));
   if ((0 == memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity))) &&
       (NULL != th))
   {
@@ -430,7 +430,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   if (!benchmark_receive)
     return;
   if (verbosity > 0)
-    fprintf (stdout, _("Received %u bytes from %s\n"),
+    FPRINTF (stdout, _("Received %u bytes from %s\n"),
              (unsigned int) ntohs (message->size), GNUNET_i2s (peer));
   if (traffic_received == 0)
     start_time = GNUNET_TIME_absolute_get ();
@@ -444,7 +444,7 @@ process_string (void *cls, const char *address)
 
   if ((address != NULL))
   {
-    fprintf (stdout, _("Peer `%s': %s %s\n"), GNUNET_i2s (&addrcp->peer), addrcp->transport_name, address);
+    FPRINTF (stdout, _("Peer `%s': %s %s\n"), GNUNET_i2s (&addrcp->peer), addrcp->transport_name, address);
   }
   else
   {
@@ -499,7 +499,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   }
   if (benchmark_send && (NULL == cpid))
   {
-    fprintf (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+    FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
              "-s", "-C");
     return;
   }
@@ -508,7 +508,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     ret = 1;
     if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (cpid, &pid.hashPubKey))
     {
-      fprintf (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
+      FPRINTF (stderr, _("Failed to parse peer identity `%s'\n"), cpid);
       return;
     }
     handle =
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 5d9cfff..0ef708b 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -130,7 +130,7 @@ static struct GNUNET_TIME_Absolute start_time;
  */
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -147,7 +147,7 @@ end ()
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
   datarate = (total_bytes_sent * 1000) / delta;
 
-  fprintf (stderr, "Throughput was %llu b/s\n", datarate);
+  FPRINTF (stderr, "Throughput was %llu b/s\n", datarate);
 
   test_failed = GNUNET_NO;
   if (datarate > quota_in_p2)
@@ -365,7 +365,7 @@ notify_ready (void *cls, size_t size, void *buf)
   total_bytes_sent += ret;
   if (n == TOTAL_MSGS)
   {
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages sent\n");
   }
   return ret;
@@ -417,12 +417,12 @@ measure (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   counter++;
   if ((DURATION.rel_value / 1000) < counter)
   {
-    fprintf (stderr, ".\n");
+    FPRINTF (stderr, "%s",  ".\n");
     GNUNET_SCHEDULER_add_now (&end, NULL);
   }
   else
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     measure_task =
         GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &measure, NULL);
   }
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c
index dd07042..1058f2b 100644
--- a/src/transport/test_transport_api.c
+++ b/src/transport/test_transport_api.c
@@ -81,7 +81,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c
index 20005de..b4a3ca4 100644
--- a/src/transport/test_transport_api_bidirectional_connect.c
+++ b/src/transport/test_transport_api_bidirectional_connect.c
@@ -80,7 +80,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c
index 026ed08..1a73bcb 100644
--- a/src/transport/test_transport_api_disconnect.c
+++ b/src/transport/test_transport_api_disconnect.c
@@ -80,7 +80,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 7fb13e2..d1aa6e4 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -84,7 +84,7 @@ char *cfg_file_p1;
 char *cfg_file_p2;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index ac360a3..eb03564 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -123,7 +123,7 @@ static struct GNUNET_TIME_Absolute start_time;
  */
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -139,7 +139,7 @@ end ()
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
 
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
-  fprintf (stderr, "\nThroughput was %llu kb/s\n",
+  FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
   GNUNET_asprintf (&value_name, "reliable_%s", test_plugin);
   GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -267,7 +267,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   n++;
   if (0 == (n % (TOTAL_MSGS / 100)))
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (die_task != GNUNET_SCHEDULER_NO_TASK)
       GNUNET_SCHEDULER_cancel (die_task);
     die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
@@ -353,7 +353,7 @@ notify_ready (void *cls, size_t size, void *buf)
   total_bytes += ret;
   if (n == TOTAL_MSGS)
   {
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages sent\n");
   }
   return ret;
diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c
index 61423a7..22c6035 100644
--- a/src/transport/test_transport_api_restart_1peer.c
+++ b/src/transport/test_transport_api_restart_1peer.c
@@ -80,7 +80,7 @@ char *cfg_file_p2;
 static int restarted;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c
index 67cc90f..3de91d6 100644
--- a/src/transport/test_transport_api_restart_2peers.c
+++ b/src/transport/test_transport_api_restart_2peers.c
@@ -80,7 +80,7 @@ char *cfg_file_p2;
 static int restarted;
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c
index 29f7dd4..35279ff 100644
--- a/src/transport/test_transport_api_timeout.c
+++ b/src/transport/test_transport_api_timeout.c
@@ -87,7 +87,7 @@ static int disconnects;
 
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -210,13 +210,13 @@ timer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (time_running.rel_value ==
       GNUNET_TIME_relative_max (time_running, WAIT).rel_value)
   {
-    fprintf (stderr, "100%%\n");
+    FPRINTF (stderr, "%s",  "100%%\n");
     shutdown_flag = GNUNET_YES;
     GNUNET_SCHEDULER_add_now (&end, NULL);
   }
   else
   {
-    fprintf (stderr, "%u%%..", percentage);
+    FPRINTF (stderr, "%u%%..", percentage);
     timer_task =
         GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
                                       &timer, NULL);
diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c
index 2120f70..413daab 100644
--- a/src/transport/test_transport_api_unreliability.c
+++ b/src/transport/test_transport_api_unreliability.c
@@ -126,7 +126,7 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
  */
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -144,7 +144,7 @@ end ()
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
 
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
-  fprintf (stderr, "\nThroughput was %llu kb/s\n",
+  FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
   GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
   GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -337,7 +337,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   test_sending = GNUNET_YES;
   if (0 == (n % (TOTAL_MSGS / 100)))
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SCHEDULER_NO_TASK != die_task)
       GNUNET_SCHEDULER_cancel (die_task);
     die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
@@ -410,7 +410,7 @@ notify_ready (void *cls, size_t size, void *buf)
   }
   else
   {
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All messages scheduled to be sent\n");
     if (GNUNET_SCHEDULER_NO_TASK != die_task)
       GNUNET_SCHEDULER_cancel (die_task);
diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c
index 3770ebf..52bf638 100644
--- a/src/transport/test_transport_api_unreliability_constant.c
+++ b/src/transport/test_transport_api_unreliability_constant.c
@@ -124,7 +124,7 @@ static struct GNUNET_TIME_Absolute start_time;
  */
 
 #if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
+#define OKPP do { ok++; FPRINTF (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
 #else
 #define OKPP do { ok++; } while (0)
 #endif
@@ -142,7 +142,7 @@ end ()
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping peers\n");
 
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
-  fprintf (stderr, "\nThroughput was %llu kb/s\n",
+  FPRINTF (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
   GNUNET_asprintf (&value_name, "unreliable_%s", test_plugin);
   GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
@@ -281,7 +281,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   n++;
   if (0 == (n % (TOTAL_MSGS / 100)))
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SCHEDULER_NO_TASK != die_task)
       GNUNET_SCHEDULER_cancel (die_task);
     test_failed = GNUNET_YES;
@@ -291,7 +291,7 @@ notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer,
   {
     /* because of starting with 0 */
     msg_recv++;
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     end ();
   }
 }
@@ -356,7 +356,7 @@ notify_ready (void *cls, size_t size, void *buf)
   }
   else
   {
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "All messages scheduled to be sent!!\n");
     if (GNUNET_SCHEDULER_NO_TASK != die_task)
diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c
index c6215c9..36d9b18 100644
--- a/src/transport/test_transport_startonly.c
+++ b/src/transport/test_transport_startonly.c
@@ -124,7 +124,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
 
   i = 1;
-  fprintf (stderr, "%i", i);
+  FPRINTF (stderr, "%i", i);
   while (i <= ITERATIONS)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting peer\n");
@@ -147,12 +147,12 @@ run (void *cls, char *const *args, const char *cfgfile,
 
     i++;
     if (i <= ITERATIONS)
-      fprintf (stderr, "..%i", i);
+      FPRINTF (stderr, "..%i", i);
   }
 
   tth = GNUNET_TRANSPORT_TESTING_init ();
 
-  fprintf (stderr, "\n");
+  FPRINTF (stderr, "%s",  "\n");
   end ();
 }
 
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index c358e6f..72a2c67 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -680,7 +680,7 @@ output_message (enum GNUNET_ErrorType kind, const char *comp,
 
   if (GNUNET_stderr != NULL)
   {
-    fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp,
+    FPRINTF (GNUNET_stderr, "%s %s %s %s", datestr, comp,
              GNUNET_error_type_to_string (kind), msg);
     fflush (GNUNET_stderr);
   }
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 41a4e19..eb86d04 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -309,7 +309,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
   sec = cfg->sections;
   while (sec != NULL)
   {
-    if (0 > fprintf (fp, "[%s]\n", sec->name))
+    if (0 > FPRINTF (fp, "[%s]\n", sec->name))
     {
       error = 1;
       break;
@@ -327,7 +327,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
           pos[0] = '\\';
           pos[1] = 'n';
         }
-        if (0 > fprintf (fp, "%s = %s\n", ent->key, val))
+        if (0 > FPRINTF (fp, "%s = %s\n", ent->key, val))
         {
           error = 1;
           GNUNET_free (val);
@@ -339,7 +339,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
     }
     if (error != 0)
       break;
-    if (0 > fprintf (fp, "\n"))
+    if (0 > FPRINTF (fp, "%s\n", ""))
     {
       error = 1;
       break;
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index ff20646..121dbef 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -303,7 +303,7 @@ void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init ()
   gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
   if (!gcry_check_version (GCRYPT_VERSION))
   {
-    fprintf (stderr,
+    FPRINTF (stderr,
              _
              ("libgcrypt has not the expected version (version %s is required).\n"),
              GCRYPT_VERSION);
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 08c1334..1699498 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -669,7 +669,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
     if (ambig && !exact)
     {
       if (GNopterr)
-        fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0],
+        FPRINTF (stderr, _("%s: option `%s' is ambiguous\n"), argv[0],
                  argv[GNoptind]);
       nextchar += strlen (nextchar);
       GNoptind++;
@@ -692,12 +692,12 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
           {
             if (argv[GNoptind - 1][1] == '-')
               /* --option */
-              fprintf (stderr,
+              FPRINTF (stderr,
                        _("%s: option `--%s' does not allow an argument\n"),
                        argv[0], pfound->name);
             else
               /* +option or -option */
-              fprintf (stderr,
+              FPRINTF (stderr,
                        _("%s: option `%c%s' does not allow an argument\n"),
                        argv[0], argv[GNoptind - 1][0], pfound->name);
           }
@@ -715,7 +715,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
         {
           if (GNopterr)
           {
-            fprintf (stderr, _("%s: option `%s' requires an argument\n"),
+            FPRINTF (stderr, _("%s: option `%s' requires an argument\n"),
                      argv[0], argv[GNoptind - 1]);
           }
           nextchar += strlen (nextchar);
@@ -744,11 +744,11 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
       {
         if (argv[GNoptind][1] == '-')
           /* --option */
-          fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0],
+          FPRINTF (stderr, _("%s: unrecognized option `--%s'\n"), argv[0],
                    nextchar);
         else
           /* +option or -option */
-          fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0],
+          FPRINTF (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0],
                    argv[GNoptind][0], nextchar);
       }
       nextchar = (char *) "";
@@ -773,9 +773,9 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
       {
         if (posixly_correct)
           /* 1003.2 specifies the format of this message.  */
-          fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+          FPRINTF (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
         else
-          fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+          FPRINTF (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
       }
       return '?';
     }
@@ -803,7 +803,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
         if (GNopterr)
         {
           /* 1003.2 specifies the format of this message.  */
-          fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+          FPRINTF (stderr, _("%s: option requires an argument -- %c\n"),
                    argv[0], c);
         }
         if (optstring[0] == ':')
@@ -851,7 +851,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
       if (ambig && !exact)
       {
         if (GNopterr)
-          fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0],
+          FPRINTF (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0],
                    argv[GNoptind]);
         nextchar += strlen (nextchar);
         GNoptind++;
@@ -869,7 +869,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
           else
           {
             if (GNopterr)
-              fprintf (stderr, _("\
+              FPRINTF (stderr, _("\
 %s: option `-W %s' does not allow an argument\n"), argv[0], pfound->name);
 
             nextchar += strlen (nextchar);
@@ -883,7 +883,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
           else
           {
             if (GNopterr)
-              fprintf (stderr, _("%s: option `%s' requires an argument\n"),
+              FPRINTF (stderr, _("%s: option `%s' requires an argument\n"),
                        argv[0], argv[GNoptind - 1]);
             nextchar += strlen (nextchar);
             return optstring[0] == ':' ? ':' : '?';
@@ -931,7 +931,7 @@ GN_getopt_internal (int argc, char *const *argv, const char *optstring,
           if (GNopterr)
           {
             /* 1003.2 specifies the format of this message.  */
-            fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+            FPRINTF (stderr, _("%s: option requires an argument -- %c\n"),
                      argv[0], c);
           }
           if (optstring[0] == ':')
@@ -1035,7 +1035,7 @@ GNUNET_GETOPT_run (const char *binaryOptions,
     }
     if (i == count)
     {
-      fprintf (stderr, _("Use --help to get a list of options.\n"));
+      FPRINTF (stderr, _("Use %s to get a list of options.\n"), "--help");
       cont = GNUNET_SYSERR;
     }
   }
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c
index c74b908..8fb3673 100644
--- a/src/util/getopt_helpers.c
+++ b/src/util/getopt_helpers.c
@@ -252,7 +252,7 @@ GNUNET_GETOPT_set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
 
   if (1 != SSCANF (value, "%llu", val))
   {
-    fprintf (stderr, _("You must pass a number to the `%s' option.\n"), option);
+    FPRINTF (stderr, _("You must pass a number to the `%s' option.\n"), option);
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;
@@ -280,7 +280,7 @@ GNUNET_GETOPT_set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
 
   if (1 != SSCANF (value, "%u", val))
   {
-    fprintf (stderr, _("You must pass a number to the `%s' option.\n"), option);
+    FPRINTF (stderr, _("You must pass a number to the `%s' option.\n"), option);
     return GNUNET_SYSERR;
   }
   return GNUNET_OK;
diff --git a/src/util/plugin.c b/src/util/plugin.c
index fe5fb87..4e0385a 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -86,7 +86,7 @@ plugin_init ()
   err = lt_dlinit ();
   if (err > 0)
   {
-    fprintf (stderr, _("Initialization of plugin mechanism failed: %s!\n"),
+    FPRINTF (stderr, _("Initialization of plugin mechanism failed: %s!\n"),
              lt_dlerror ());
     return;
   }
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c
index 950f0ce..438d397 100644
--- a/src/util/test_common_allocation.c
+++ b/src/util/test_common_allocation.c
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("test-common-allocation", "WARNING", NULL);
   ret = check ();
   if (ret != 0)
-    fprintf (stderr, "ERROR %d.\n", ret);
+    FPRINTF (stderr, "ERROR %d.\n", ret);
   return ret;
 }
 
diff --git a/src/util/test_common_logging.c b/src/util/test_common_logging.c
index d057db0..9345869 100644
--- a/src/util/test_common_logging.c
+++ b/src/util/test_common_logging.c
@@ -44,7 +44,7 @@ main (int argc, char *argv[])
   unsigned int logs = 0;
 
   if (0 != putenv ("GNUNET_FORCE_LOG="))
-    fprintf (stderr, "Failed to putenv: %s\n", strerror (errno));
+    FPRINTF (stderr, "Failed to putenv: %s\n", strerror (errno));
   GNUNET_log_setup ("test-common-logging", "DEBUG", "/dev/null");
   GNUNET_logger_add (&my_log, &logs);
   GNUNET_logger_add (&my_log, &logs);
@@ -60,7 +60,7 @@ main (int argc, char *argv[])
   GNUNET_logger_remove (&my_log, &logs);
   if (logs != 4)
   {
-    fprintf (stdout, "Expected 4 log calls, got %u\n", logs);
+    FPRINTF (stdout, "Expected 4 log calls, got %u\n", logs);
     failureCount++;
   }
   GNUNET_break (0 ==
@@ -84,13 +84,13 @@ main (int argc, char *argv[])
   GNUNET_logger_remove (&my_log, &logs);
   if (logs != 1)
   {
-    fprintf (stdout, "Expected 1 log call, got %u\n", logs);
+    FPRINTF (stdout, "Expected 1 log call, got %u\n", logs);
     failureCount++;
   }
 
   if (failureCount != 0)
   {
-    fprintf (stdout, "%u TESTS FAILED!\n", failureCount);
+    FPRINTF (stdout, "%u TESTS FAILED!\n", failureCount);
     return -1;
   }
   return 0;
diff --git a/src/util/test_common_logging_dummy.c b/src/util/test_common_logging_dummy.c
index 005b5ca..9f6756f 100644
--- a/src/util/test_common_logging_dummy.c
+++ b/src/util/test_common_logging_dummy.c
@@ -37,7 +37,7 @@ my_log (void *ctx, enum GNUNET_ErrorType kind, const char *component,
 {
   if (strncmp ("test-common-logging-dummy", component, 25) != 0)
     return;
-  fprintf (stdout, "%s", msg);
+  FPRINTF (stdout, "%s", msg);
   fflush (stdout);
 }
 
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index 9b5b122..51123d9 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -171,7 +171,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     buf_ptr += rd;
     bytes += rd;
 #if VERBOSE
-    fprintf (stderr, "got %d bytes, reading more\n", rd);
+    FPRINTF (stderr, "got %d bytes, reading more\n", rd);
 #endif
     GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
                                     stdout_read_handle, &read_call,
@@ -180,7 +180,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   }
 
 #if VERBOSE
-  fprintf (stderr, "bytes is %d:%s\n", bytes, buf);
+  FPRINTF (stderr, "bytes is %d:%s\n", bytes, buf);
 #endif
 
   /* +------CHILD OUTPUT--
@@ -251,7 +251,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                           &delays[7], level)))
   {
     if (bytes == 20 * 16)
-      fprintf (stderr, "Ran out of buffer space!\n");
+      FPRINTF (stderr, "%s",  "Ran out of buffer space!\n");
     GNUNET_break (0);
     ok = 2;
     GNUNET_SCHEDULER_cancel (die_task);
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 3780b36..b1a446f 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -240,14 +240,14 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
   GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData);
   if (1 == (ret = cbData.status))
   {
-    fprintf (stderr,
+    FPRINTF (stderr, "%s", 
              "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n");
     goto housekeeping;
   }
   cbData.cfgDiffs = cfg;
   GNUNET_CONFIGURATION_iterate (cfgDiffs, diffsCallBack, &cbData);
   if ((ret = cbData.status) == 1)
-    fprintf (stderr,
+    FPRINTF (stderr, "%s", 
              "Incorrect Configuration Diffs: Data may be missing in diffs\n");
 
 housekeeping:
@@ -277,7 +277,7 @@ testConfig ()
     return 1;
   if (0 != strcmp ("b", c))
   {
-    fprintf (stderr, "Got `%s'\n", c);
+    FPRINTF (stderr, "Got `%s'\n", c);
     GNUNET_free (c);
     return 2;
   }
@@ -470,7 +470,7 @@ main (int argc, char *argv[])
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_parse (cfg, "test_configuration_data.conf"))
   {
-    fprintf (stderr, "Failed to parse configuration file\n");
+    FPRINTF (stderr, "%s",  "Failed to parse configuration file\n");
     GNUNET_CONFIGURATION_destroy (cfg);
     return 1;
   }
@@ -484,7 +484,7 @@ main (int argc, char *argv[])
 
   if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, "/tmp/gnunet-test.conf"))
   {
-    fprintf (stderr, "Failed to write configuration file\n");
+    FPRINTF (stderr, "%s",  "Failed to write configuration file\n");
     GNUNET_CONFIGURATION_destroy (cfg);
     return 1;
   }
@@ -546,7 +546,7 @@ main (int argc, char *argv[])
 error:
   if (failureCount != 0)
   {
-    fprintf (stderr, "Test failed: %u\n", failureCount);
+    FPRINTF (stderr, "Test failed: %u\n", failureCount);
     return 1;
   }
   return 0;
diff --git a/src/util/test_crypto_aes_weak.c b/src/util/test_crypto_aes_weak.c
index a0161b5..0b7ba5c 100644
--- a/src/util/test_crypto_aes_weak.c
+++ b/src/util/test_crypto_aes_weak.c
@@ -136,7 +136,7 @@ getWeakKeys ()
   {
 
     if (number_of_runs % 1000 == 0)
-      fprintf (stderr, ".");
+      FPRINTF (stderr, "%s",  ".");
     /*printf("Got to run number %d.\n", number_of_runs); */
     GNUNET_CRYPTO_aes_create_session_key (&sessionkey);
 
diff --git a/src/util/test_crypto_ksk.c b/src/util/test_crypto_ksk.c
index 2789f5e..58c4595 100644
--- a/src/util/test_crypto_ksk.c
+++ b/src/util/test_crypto_ksk.c
@@ -46,7 +46,7 @@ testCorrectKey ()
   int i;
   char out[3];
 
-  fprintf (stderr, "Testing KBlock key correctness");
+  FPRINTF (stderr, "%s",  "Testing KBlock key correctness");
   GNUNET_CRYPTO_hash ("X", strlen ("X"), &in);
   hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in);
   if (hostkey == NULL)
@@ -66,12 +66,12 @@ testCorrectKey ()
     snprintf (out, sizeof (out), "%02x", ((unsigned char *) &pkey)[i]);
     if (0 != strncmp (out, &want[i * 2], 2))
     {
-      fprintf (stderr, " Failed! Wanted %.2s but got %2s at %d\n", &want[i * 2],
+      FPRINTF (stderr, " Failed! Wanted %.2s but got %2s at %d\n", &want[i * 2],
                out, i);
       return GNUNET_SYSERR;
     }
   }
-  fprintf (stderr, " OK\n");
+  FPRINTF (stderr, "%s",  " OK\n");
   return GNUNET_OK;
 }
 
@@ -85,7 +85,7 @@ testMultiKey (const char *word)
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1;
   int i;
 
-  fprintf (stderr, "Testing KBlock key uniqueness (%s) ", word);
+  FPRINTF (stderr, "Testing KBlock key uniqueness (%s) ", word);
   GNUNET_CRYPTO_hash (word, strlen (word), &in);
   hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in);
   if (hostkey == NULL)
@@ -101,12 +101,12 @@ testMultiKey (const char *word)
   GNUNET_CRYPTO_rsa_key_free (hostkey);
   for (i = 0; i < UNIQUE_ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in);
     if (hostkey == NULL)
     {
       GNUNET_break (0);
-      fprintf (stderr, " ERROR\n");
+      FPRINTF (stderr, "%s",  " ERROR\n");
       return GNUNET_SYSERR;
     }
     GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey1);
@@ -116,11 +116,11 @@ testMultiKey (const char *word)
                 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)))
     {
       GNUNET_break (0);
-      fprintf (stderr, " ERROR\n");
+      FPRINTF (stderr, "%s",  " ERROR\n");
       return GNUNET_SYSERR;
     }
   }
-  fprintf (stderr, " OK\n");
+  FPRINTF (stderr, "%s",  " OK\n");
   return GNUNET_OK;
 }
 
@@ -135,19 +135,19 @@ testEncryptDecrypt (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
   struct GNUNET_TIME_Absolute start;
   int ok;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
 
   ok = 0;
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR ==
         GNUNET_CRYPTO_rsa_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &pkey,
                                    &target))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -155,7 +155,7 @@ testEncryptDecrypt (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
         GNUNET_CRYPTO_rsa_decrypt (hostkey, &target, result,
                                    strlen (TESTSTRING) + 1))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -186,17 +186,17 @@ testSignVerify (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
   struct GNUNET_TIME_Absolute start;
   int ok = GNUNET_OK;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
   start = GNUNET_TIME_absolute_get ();
   purp.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose));
   purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR == GNUNET_CRYPTO_rsa_sign (hostkey, &purp, &sig))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
       ok = GNUNET_SYSERR;
       continue;
     }
diff --git a/src/util/test_crypto_random.c b/src/util/test_crypto_random.c
index 46d3ed0..681947a 100644
--- a/src/util/test_crypto_random.c
+++ b/src/util/test_crypto_random.c
@@ -43,7 +43,7 @@ test (enum GNUNET_CRYPTO_Quality mode)
     b2 = GNUNET_CRYPTO_random_permute (mode, 1024);
     if (0 == memcmp (b2, buf, sizeof (buf)))
     {
-      fprintf (stderr, "!");
+      FPRINTF (stderr, "%s",  "!");
       GNUNET_free (b2);
       continue;
     }
diff --git a/src/util/test_crypto_rsa.c b/src/util/test_crypto_rsa.c
index f26a76a..f6800af 100644
--- a/src/util/test_crypto_rsa.c
+++ b/src/util/test_crypto_rsa.c
@@ -47,7 +47,7 @@ testEncryptDecrypt ()
   struct GNUNET_TIME_Absolute start;
   int ok;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   hostkey = GNUNET_CRYPTO_rsa_key_create ();
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
 
@@ -55,12 +55,12 @@ testEncryptDecrypt ()
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR ==
         GNUNET_CRYPTO_rsa_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &pkey,
                                    &target))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -68,7 +68,7 @@ testEncryptDecrypt ()
         GNUNET_CRYPTO_rsa_decrypt (hostkey, &target, result,
                                    strlen (TESTSTRING) + 1))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
       ok++;
       continue;
 
@@ -102,7 +102,7 @@ testEncryptPerformance ()
   struct GNUNET_TIME_Absolute start;
   int ok;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   hostkey = GNUNET_CRYPTO_rsa_key_create ();
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
 
@@ -110,12 +110,12 @@ testEncryptPerformance ()
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR ==
         GNUNET_CRYPTO_rsa_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &pkey,
                                    &target))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -142,7 +142,7 @@ testEncryptDecryptSK ()
   struct GNUNET_TIME_Absolute start;
   int ok;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   hostkey = GNUNET_CRYPTO_rsa_key_create ();
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
 
@@ -150,14 +150,14 @@ testEncryptDecryptSK ()
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     GNUNET_CRYPTO_aes_create_session_key (&insk);
     if (GNUNET_SYSERR ==
         GNUNET_CRYPTO_rsa_encrypt (&insk,
                                    sizeof (struct GNUNET_CRYPTO_AesSessionKey),
                                    &pkey, &target))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -165,7 +165,7 @@ testEncryptDecryptSK ()
         GNUNET_CRYPTO_rsa_decrypt (hostkey, &target, &outsk,
                                    sizeof (struct GNUNET_CRYPTO_AesSessionKey)))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n");
       ok++;
       continue;
     }
@@ -198,7 +198,7 @@ testSignVerify ()
   struct GNUNET_TIME_Absolute start;
   int ok = GNUNET_OK;
 
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   hostkey = GNUNET_CRYPTO_rsa_key_create ();
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
   start = GNUNET_TIME_absolute_get ();
@@ -207,10 +207,10 @@ testSignVerify ()
 
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR == GNUNET_CRYPTO_rsa_sign (hostkey, &purp, &sig))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
       ok = GNUNET_SYSERR;
       continue;
     }
@@ -253,16 +253,16 @@ testSignPerformance ()
 
   purp.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose));
   purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
-  fprintf (stderr, "W");
+  FPRINTF (stderr, "%s",  "W");
   hostkey = GNUNET_CRYPTO_rsa_key_create ();
   GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey);
   start = GNUNET_TIME_absolute_get ();
   for (i = 0; i < ITER; i++)
   {
-    fprintf (stderr, ".");
+    FPRINTF (stderr, "%s",  ".");
     if (GNUNET_SYSERR == GNUNET_CRYPTO_rsa_sign (hostkey, &purp, &sig))
     {
-      fprintf (stderr, "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
+      FPRINTF (stderr, "%s",  "GNUNET_CRYPTO_rsa_sign returned SYSERR\n");
       ok = GNUNET_SYSERR;
       continue;
     }
diff --git a/src/util/test_disk.c b/src/util/test_disk.c
index 91154a6..5462772 100644
--- a/src/util/test_disk.c
+++ b/src/util/test_disk.c
@@ -46,13 +46,13 @@ testReadWrite ()
   ret = GNUNET_DISK_fn_read (".testfile", tmp, sizeof (tmp) - 1);
   if (ret < 0)
   {
-    fprintf (stderr, "Error reading file `%s' in testReadWrite\n", ".testfile");
+    FPRINTF (stderr, "Error reading file `%s' in testReadWrite\n", ".testfile");
     return 1;
   }
   tmp[ret] = '\0';
   if (0 != memcmp (tmp, TESTSTRING, strlen (TESTSTRING) + 1))
   {
-    fprintf (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
+    FPRINTF (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
              TESTSTRING, ".testfile");
     return 1;
   }
@@ -61,14 +61,14 @@ testReadWrite ()
   ret = GNUNET_DISK_fn_read (".testfile2", tmp, sizeof (tmp) - 1);
   if (ret < 0)
   {
-    fprintf (stderr, "Error reading file `%s' in testReadWrite\n",
+    FPRINTF (stderr, "Error reading file `%s' in testReadWrite\n",
              ".testfile2");
     return 1;
   }
   tmp[ret] = '\0';
   if (0 != memcmp (tmp, TESTSTRING, strlen (TESTSTRING) + 1))
   {
-    fprintf (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
+    FPRINTF (stderr, "Error in testReadWrite: *%s* != *%s* for file %s\n", tmp,
              TESTSTRING, ".testfile2");
     return 1;
   }
@@ -276,7 +276,7 @@ main (int argc, char *argv[])
   failureCount += testDirMani ();
   if (failureCount != 0)
   {
-    fprintf (stderr, "\n%u TESTS FAILED!\n", failureCount);
+    FPRINTF (stderr, "\n%u TESTS FAILED!\n", failureCount);
     return -1;
   }
   return 0;
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index df85205..7853840 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -75,7 +75,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   bytes = GNUNET_DISK_file_read (stdout_read_handle, &buf, sizeof (buf));
 
 #if VERBOSE
-  fprintf (stderr, "bytes is %d\n", bytes);
+  FPRINTF (stderr, "bytes is %d\n", bytes);
 #endif
 
   if (bytes < 1)
@@ -89,7 +89,7 @@ read_call (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   ok = strncmp (&buf[0], test_phrase, strlen (test_phrase));
 #if VERBOSE
-  fprintf (stderr, "read %s\n", &buf[0]);
+  FPRINTF (stderr, "read %s\n", &buf[0]);
 #endif
   if (ok == 0)
   {
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index 3817d82..9bf4436 100644
--- a/src/util/test_peer.c
+++ b/src/util/test_peer.c
@@ -69,7 +69,7 @@ check ()
     pid = GNUNET_PEER_intern (&pidArr[i]);
     if (pid != (i + 1))
     {
-      fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
+      FPRINTF (stderr, "%s",  "Unexpected Peer ID returned by intern function\n");
       return 1;
     }
   }
@@ -80,7 +80,7 @@ check ()
     pid = GNUNET_PEER_intern (&pidArr[i]);
     if (pid != (i + 1))
     {
-      fprintf (stderr, "Unexpected Peer ID returned by intern function\n");
+      FPRINTF (stderr, "%s",  "Unexpected Peer ID returned by intern function\n");
       return 1;
     }
   }
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index 4e248aa..75140f8 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -264,8 +264,8 @@ run (void *cls, char *const *args, const char *cfgfile,
                 _("gethostbyname() could not lookup IP address: %s\n"),
                 hstrerror (h_errno));
 #endif
-    fprintf (stderr,
-             "System seems to be off-line, will not run all DNS tests\n");
+    FPRINTF (stderr,
+             "System seems to be off-line, will not run all DNS tests\n", NULL);
     *ok = 0;                    /* mark test as passing anyway */
     return;
   }
@@ -422,7 +422,7 @@ check ()
   GNUNET_OS_process_close (proc);
   proc = NULL;
   if (ok != 0)
-    fprintf (stderr, "Missed some resolutions: %u\n", ok);
+    FPRINTF (stderr, "Missed some resolutions: %u\n", ok);
   return ok;
 }
 
diff --git a/src/util/test_scheduler_delay.c b/src/util/test_scheduler_delay.c
index ff6966a..9cbf7d9 100644
--- a/src/util/test_scheduler_delay.c
+++ b/src/util/test_scheduler_delay.c
@@ -59,10 +59,10 @@ test_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   target =
       GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
                                         (GNUNET_TIME_UNIT_MILLISECONDS, i));
-  fprintf (stderr, ".");
+  FPRINTF (stderr, "%s",  ".");
   if (i > MAXV)
   {
-    fprintf (stderr, "\n");
+    FPRINTF (stderr, "%s",  "\n");
     return;
   }
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -79,13 +79,13 @@ check ()
   FPRINTF (stdout, "Sleep precision: %llu ms. ",
            cumDelta / 1000 / (MAXV / INCR));
   if (cumDelta <= 10 * MAXV / INCR)
-    fprintf (stdout, "Timer precision is excellent.\n");
+    FPRINTF (stdout, "%s",  "Timer precision is excellent.\n");
   else if (cumDelta <= 50 * MAXV / INCR)        /* 50 ms average deviation */
-    fprintf (stdout, "Timer precision is good.\n");
+    FPRINTF (stdout, "%s",  "Timer precision is good.\n");
   else if (cumDelta > 250 * MAXV / INCR)
-    fprintf (stdout, "Timer precision is awful.\n");
+    FPRINTF (stdout, "%s",  "Timer precision is awful.\n");
   else
-    fprintf (stdout, "Timer precision is acceptable.\n");
+    FPRINTF (stdout, "%s",  "Timer precision is acceptable.\n");
   return 0;
 }
 
diff --git a/src/util/test_service.c b/src/util/test_service.c
index 1b78932..eff8c75 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -270,7 +270,7 @@ main (int argc, char *argv[])
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
       return 1;
     }
-    fprintf (stderr,
+    FPRINTF (stderr,
              "IPv6 support seems to not be available (%s), not testing it!\n",
              strerror (errno));
   }
diff --git a/src/util/test_strings.c b/src/util/test_strings.c
index c6d6041..7e68153 100644
--- a/src/util/test_strings.c
+++ b/src/util/test_strings.c
@@ -89,7 +89,7 @@ check ()
    * however, the "0:05 19" should always be there; hence: */
   if (NULL == strstr (r, "0:05 19"))
   {
-    fprintf (stderr, "Got %s\n", r);
+    FPRINTF (stderr, "Got %s\n", r);
     GNUNET_break (0);
     GNUNET_free (r);
     return 1;
-- 
1.7.4

0006-FPRINTFification.patch (188,551 bytes)   
0007-FOPENCLOSEification.patch (10,481 bytes)   
From 10458bfdd1ea3754b440bfa13676107eb2e17e82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 30 Dec 2011 23:03:09 +0400
Subject: [PATCH 07/10] FOPENCLOSEification

---
 src/dv/test_transport_api_dv.c                |    4 ++--
 src/testing/test_testing_large_topology.c     |   10 +++++-----
 src/testing/test_testing_topology.c           |    8 ++++----
 src/testing/test_testing_topology_blacklist.c |   12 ++++++------
 src/testing/testing_group.c                   |    8 ++++----
 src/util/configuration.c                      |    4 ++--
 src/util/os_installation.c                    |    6 +++---
 src/util/service.c                            |    2 +-
 src/util/test_crypto_hash.c                   |    4 ++--
 9 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c
index 435bb2a..386ea5f 100644
--- a/src/dv/test_transport_api_dv.c
+++ b/src/dv/test_transport_api_dv.c
@@ -274,8 +274,8 @@ finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #endif
   if (dotOutFile != NULL)
   {
-    fclose (dotOutFile);
     FPRINTF (dotOutFile, "%s",  "}");
+    FCLOSE (dotOutFile);
   }
 
   ok = 0;
@@ -383,7 +383,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 }
 
diff --git a/src/testing/test_testing_large_topology.c b/src/testing/test_testing_large_topology.c
index 2bca7b3..6057611 100644
--- a/src/testing/test_testing_large_topology.c
+++ b/src/testing/test_testing_large_topology.c
@@ -246,7 +246,7 @@ finish_testing ()
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 
   ok = 0;
@@ -303,7 +303,7 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
     if (outfile != NULL)
     {
       FPRINTF (outfile, "%s",  "}\n");
-      fclose (outfile);
+      FCLOSE (outfile);
       GNUNET_SCHEDULER_add_now (&finish_testing, NULL);
     }
   }
@@ -358,7 +358,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
 #endif
     GNUNET_SCHEDULER_cancel (die_task);
     GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
-    dotOutFileFinished = fopen (dotOutFileNameFinished, "w");
+    dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w");
     GNUNET_free (dotOutFileNameFinished);
     if (dotOutFileFinished != NULL)
     {
@@ -425,7 +425,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 }
 
@@ -949,7 +949,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   ok = 1;
 
-  dotOutFile = fopen (dotOutFileName, "w");
+  dotOutFile = FOPEN (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c
index 17f3be8..7404aa7 100644
--- a/src/testing/test_testing_topology.c
+++ b/src/testing/test_testing_topology.c
@@ -339,7 +339,7 @@ topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
     if (outfile != NULL)
     {
       FPRINTF (outfile, "%s",  "}\n");
-      fclose (outfile);
+      FCLOSE (outfile);
 #if DO_STATS
       GNUNET_TESTING_get_statistics (pg, &stats_finished, &stats_print, NULL);
 #endif
@@ -398,7 +398,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer,
 #endif
     GNUNET_SCHEDULER_cancel (die_task);
     GNUNET_asprintf (&dotOutFileNameFinished, "%s.dot", "final_topology");
-    dotOutFileFinished = fopen (dotOutFileNameFinished, "w");
+    dotOutFileFinished = FOPEN (dotOutFileNameFinished, "w");
     GNUNET_free (dotOutFileNameFinished);
     if (dotOutFileFinished != NULL)
     {
@@ -465,7 +465,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 }
 
@@ -1006,7 +1006,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   ok = 1;
 
-  dotOutFile = fopen (dotOutFileName, "w");
+  dotOutFile = FOPEN (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
diff --git a/src/testing/test_testing_topology_blacklist.c b/src/testing/test_testing_topology_blacklist.c
index 9ff1fcb..d207ac2 100644
--- a/src/testing/test_testing_topology_blacklist.c
+++ b/src/testing/test_testing_topology_blacklist.c
@@ -143,7 +143,7 @@ finish_testing ()
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 
   ok = 0;
@@ -168,7 +168,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "}");
-    fclose (dotOutFile);
+    FCLOSE (dotOutFile);
   }
 }
 
@@ -396,7 +396,7 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   ok = 1;
 
-  dotOutFile = fopen (dotOutFileName, "w");
+  dotOutFile = FOPEN (dotOutFileName, "w");
   if (dotOutFile != NULL)
   {
     FPRINTF (dotOutFile, "%s",  "strict graph G {\n");
@@ -414,7 +414,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     ok = 404;
     if (dotOutFile != NULL)
     {
-      fclose (dotOutFile);
+      FCLOSE (dotOutFile);
     }
     return;
   }
@@ -453,7 +453,7 @@ run (void *cls, char *const *args, const char *cfgfile,
       ok = 707;
       if (dotOutFile != NULL)
       {
-        fclose (dotOutFile);
+        FCLOSE (dotOutFile);
       }
       return;
     }
@@ -470,7 +470,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     ok = 808;
     if (dotOutFile != NULL)
     {
-      fclose (dotOutFile);
+      FCLOSE (dotOutFile);
     }
     return;
   }
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c
index 4f67179..32adf46 100644
--- a/src/testing/testing_group.c
+++ b/src/testing/testing_group.c
@@ -2891,7 +2891,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
   {
     mytemp = GNUNET_DISK_mktemp ("friends");
     GNUNET_assert (mytemp != NULL);
-    temp_friend_handle = fopen (mytemp, "wt");
+    temp_friend_handle = FOPEN (mytemp, "wt");
     GNUNET_assert (temp_friend_handle != NULL);
 #if OLD
     conn_iter = pg->peers[pg_iter].allowed_peers_head;
@@ -2907,7 +2907,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
                                            &friend_file_iterator,
                                            temp_friend_handle);
 #endif
-    fclose (temp_friend_handle);
+    FCLOSE (temp_friend_handle);
 
     if (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg,
@@ -3064,7 +3064,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
   {
     mytemp = GNUNET_DISK_mktemp ("blacklist");
     GNUNET_assert (mytemp != NULL);
-    temp_file_handle = fopen (mytemp, "wt");
+    temp_file_handle = FOPEN (mytemp, "wt");
     GNUNET_assert (temp_file_handle != NULL);
     temp_transports = GNUNET_strdup (transports);
 #if !OLD
@@ -3106,7 +3106,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
     }
 
     GNUNET_free (temp_transports);
-    fclose (temp_file_handle);
+    FCLOSE (temp_file_handle);
 
     if (GNUNET_OK !=
         GNUNET_CONFIGURATION_get_value_string (pg->peers[pg_iter].daemon->cfg,
diff --git a/src/util/configuration.c b/src/util/configuration.c
index eb86d04..50f32e2 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -248,7 +248,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
       break;
     }
   }
-  GNUNET_assert (0 == fclose (fp));
+  GNUNET_assert (0 == FCLOSE (fp));
   /* restore dirty flag - anything we set in the meantime
    * came from disk */
   cfg->dirty = dirty;
@@ -348,7 +348,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
   }
   if (error != 0)
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", filename);
-  GNUNET_assert (0 == fclose (fp));
+  GNUNET_assert (0 == FCLOSE (fp));
   if (error != 0)
   {
     cfg->dirty = GNUNET_SYSERR; /* last write failed */
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index c5cf1cc..6d25c57 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -56,7 +56,7 @@ get_path_from_proc_maps ()
   char *lgu;
 
   GNUNET_snprintf (fn, sizeof (fn), "/proc/%u/maps", getpid ());
-  f = fopen (fn, "r");
+  f = FOPEN (fn, "r");
   if (f == NULL)
     return NULL;
   while (NULL != fgets (line, sizeof (line), f))
@@ -66,11 +66,11 @@ get_path_from_proc_maps ()
         (NULL != (lgu = strstr (dir, "libgnunetutil"))))
     {
       lgu[0] = '\0';
-      fclose (f);
+      FCLOSE (f);
       return GNUNET_strdup (dir);
     }
   }
-  fclose (f);
+  FCLOSE (f);
   return NULL;
 }
 
diff --git a/src/util/service.c b/src/util/service.c
index ebdf2c6..8235830 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1351,7 +1351,7 @@ write_pid_file (struct GNUNET_SERVICE_Context *sctx, pid_t pid)
   }
   if (0 > FPRINTF (pidfd, "%u", pid))
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif);
-  GNUNET_break (0 == fclose (pidfd));
+  GNUNET_break (0 == FCLOSE (pidfd));
   if ((user != NULL) && (0 < strlen (user)))
     GNUNET_DISK_file_change_owner (pif, user);
   GNUNET_free_non_null (user);
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c
index b0fa4f3..bc04114 100644
--- a/src/util/test_crypto_hash.c
+++ b/src/util/test_crypto_hash.c
@@ -137,9 +137,9 @@ testFileHash ()
 
   memset (block, 42, sizeof (block) / 2);
   memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2);
-  GNUNET_assert (NULL != (f = fopen (FILENAME, "w+")));
+  GNUNET_assert (NULL != (f = FOPEN (FILENAME, "w+")));
   GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f));
-  GNUNET_break (0 == fclose (f));
+  GNUNET_break (0 == FCLOSE (f));
   ret = 1;
   GNUNET_SCHEDULER_run (&file_hasher, &ret);
   GNUNET_break (0 == UNLINK (FILENAME));
-- 
1.7.4

0007-FOPENCLOSEification.patch (10,481 bytes)   
0008-UTF8ization.patch (12,241 bytes)   
From c290d6c2e15e4b9a54d5a740c62edbbd7dacd968 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 30 Dec 2011 23:05:01 +0400
Subject: [PATCH 08/10] UTF8ization

Requires plibc UTF8ization
* Use plibc's new OPENDIR(), READDIR(), CLOSEDIR()
* Assume that plibc returns strings in UTF-8, and convert them to
  UTF-16 on W32 when they have to be passed to W32API, use wide functions
* Add some more comments in places where UTF8ization might or might not be
  needed.
---
 src/fs/fs_file_information.c          |   14 +++++++++
 src/util/disk.c                       |   52 +++++++++++++++++++++++---------
 src/util/os_installation.c            |   18 +++++++----
 src/util/os_priority.c                |   19 ++++++++----
 src/util/test_container_bloomfilter.c |    2 +-
 5 files changed, 76 insertions(+), 29 deletions(-)

diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index 4ea2648..c2ab84e 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -173,10 +173,17 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h,
 #endif
   while (NULL != (ss = strstr (fn, DIR_SEPARATOR_STR)))
     fn = ss + 1;
+#if !WINDOWS
   GNUNET_CONTAINER_meta_data_insert (ret->meta, "<gnunet>",
                                      EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
                                      EXTRACTOR_METAFORMAT_C_STRING,
                                      "text/plain", fn, strlen (fn) + 1);
+#else
+  GNUNET_CONTAINER_meta_data_insert (ret->meta, "<gnunet>",
+                                     EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+                                     EXTRACTOR_METAFORMAT_UTF8,
+                                     "text/plain", fn, strlen (fn) + 1);
+#endif
   return ret;
 }
 
@@ -770,10 +777,17 @@ GNUNET_FS_file_information_create_from_directory (struct GNUNET_FS_Handle *h,
   while ((NULL != (ss = strstr (fn, DIR_SEPARATOR_STR))) && (strlen (ss) > 1))
     fn = ss + 1;
   GNUNET_asprintf (&dn, "%s/", fn);
+#if !WINDOWS
   GNUNET_CONTAINER_meta_data_insert (ret->meta, "<gnunet>",
                                      EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
                                      EXTRACTOR_METAFORMAT_C_STRING,
                                      "text/plain", dn, strlen (dn) + 1);
+#else
+  GNUNET_CONTAINER_meta_data_insert (ret->meta, "<gnunet>",
+                                     EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+                                     EXTRACTOR_METAFORMAT_UTF8,
+                                     "text/plain", dn, strlen (dn) + 1);
+#endif
   GNUNET_free (dn);
   ret->filename = GNUNET_strdup (filename);
   return ret;
diff --git a/src/util/disk.c b/src/util/disk.c
index 9302092..141376b 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -398,6 +398,7 @@ GNUNET_DISK_mktemp (const char *t)
 #endif
       )
   {
+    /* FIXME: This uses system codepage on W32, not UTF-8 */
     tmpdir = getenv ("TMPDIR");
     tmpdir = tmpdir ? tmpdir : "/tmp";
     GNUNET_asprintf (&tmpl, "%s/%s%s", tmpdir, t, "XXXXXX");
@@ -418,6 +419,9 @@ GNUNET_DISK_mktemp (const char *t)
 #else
   fn = tmpl;
 #endif
+  /* FIXME: why is this not MKSTEMP()? This function is implemented in plibc.
+   * It will assume that fn is UTF-8-encoded, if compiled with UTF-8 support.
+   */
   fd = mkstemp (fn);
   if (fd == -1)
   {
@@ -453,18 +457,26 @@ GNUNET_DISK_get_blocks_available (const char *part)
 #elif MINGW
   DWORD dwDummy;
   DWORD dwBlocks;
-  char szDrive[4];
+  wchar_t szDrive[4];
+  wchar_t wpath[MAX_PATH + 1];
   char *path;
 
   path = GNUNET_STRINGS_filename_expand (part);
   if (path == NULL)
     return -1;
-  memcpy (szDrive, path, 3);
+  /* "part" was in UTF-8, and so is "path" */
+  if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath))
+  {
+    GNUNET_free (path);
+    return -1;
+  }
   GNUNET_free (path);
+  wcsncpy (szDrive, wpath, 3);
+  GNUNET_free (wpath);
   szDrive[3] = 0;
-  if (!GetDiskFreeSpace (szDrive, &dwDummy, &dwDummy, &dwBlocks, &dwDummy))
+  if (!GetDiskFreeSpaceW (szDrive, &dwDummy, &dwDummy, &dwBlocks, &dwDummy))
   {
-    LOG (GNUNET_ERROR_TYPE_WARNING, _("`%s' failed for drive `%s': %u\n"),
+    LOG (GNUNET_ERROR_TYPE_WARNING, _("`%s' failed for drive `%S': %u\n"),
          "GetDiskFreeSpace", szDrive, GetLastError ());
 
     return -1;
@@ -622,7 +634,11 @@ GNUNET_DISK_directory_create (const char *dir)
 #ifndef MINGW
         ret = mkdir (rdir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);        /* 755 */
 #else
-        ret = mkdir (rdir);
+        wchar_t wrdir[MAX_PATH + 1];
+        if (ERROR_SUCCESS == plibc_conv_to_win_pathwconv(rdir, wrdir))
+          ret = !CreateDirectoryW (wrdir, NULL);
+        else
+          ret = 1;
 #endif
         if ((ret != 0) && (errno != EEXIST))
         {
@@ -875,14 +891,14 @@ GNUNET_DISK_directory_scan (const char *dirName,
   {
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "opendir", dname);
     if (dinfo != NULL)
-      closedir (dinfo);
+      CLOSEDIR (dinfo);
     GNUNET_free (dname);
     return GNUNET_SYSERR;
   }
   name_len = 256;
   n_size = strlen (dname) + name_len + 2;
   name = GNUNET_malloc (n_size);
-  while ((finfo = readdir (dinfo)) != NULL)
+  while ((finfo = READDIR (dinfo)) != NULL)
   {
     if ((0 == strcmp (finfo->d_name, ".")) ||
         (0 == strcmp (finfo->d_name, "..")))
@@ -904,7 +920,7 @@ GNUNET_DISK_directory_scan (const char *dirName,
                         0) ? "" : DIR_SEPARATOR_STR, finfo->d_name);
       if (GNUNET_OK != callback (callback_cls, name))
       {
-        closedir (dinfo);
+        CLOSEDIR (dinfo);
         GNUNET_free (name);
         GNUNET_free (dname);
         return GNUNET_SYSERR;
@@ -912,7 +928,7 @@ GNUNET_DISK_directory_scan (const char *dirName,
     }
     count++;
   }
-  closedir (dinfo);
+  CLOSEDIR (dinfo);
   GNUNET_free (name);
   GNUNET_free (dname);
   return count;
@@ -996,12 +1012,12 @@ GNUNET_DISK_directory_iterator_next (struct GNUNET_DISK_DirectoryIterator *iter,
   GNUNET_assert (iter->next_name == NULL);
   if (can == GNUNET_YES)
   {
-    closedir (iter->directory);
+    CLOSEDIR (iter->directory);
     GNUNET_free (iter->dirname);
     GNUNET_free (iter);
     return GNUNET_SYSERR;
   }
-  while (NULL != (finfo = readdir (iter->directory)))
+  while (NULL != (finfo = READDIR (iter->directory)))
   {
     if ((0 == strcmp (finfo->d_name, ".")) ||
         (0 == strcmp (finfo->d_name, "..")))
@@ -1341,6 +1357,7 @@ GNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags,
   DWORD access;
   DWORD disp;
   HANDLE h;
+  wchar_t wexpfn[MAX_PATH + 1];
 #else
   int oflags;
   int mode;
@@ -1419,10 +1436,12 @@ GNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags,
     disp = OPEN_EXISTING;
   }
 
-  /* TODO: access priviledges? */
-  h = CreateFile (expfn, access,
-                  FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                  disp, FILE_ATTRIBUTE_NORMAL, NULL);
+  if (ERROR_SUCCESS == plibc_conv_to_win_pathwconv(expfn, wexpfn))
+    h = CreateFileW (wexpfn, access,
+                    FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+                    disp, FILE_ATTRIBUTE_NORMAL, NULL);
+  else
+    h = INVALID_HANDLE_VALUE;
   if (h == INVALID_HANDLE_VALUE)
   {
     SetErrnoFromWinError (GetLastError ());
@@ -2156,6 +2175,9 @@ GNUNET_DISK_npipe_create (char **fn, enum GNUNET_DISK_OpenFlags flags,
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "Trying to create an instance of named pipe `%s'\n", name);
 #endif
+      /* 1) This might work just fine with UTF-8 strings as it is.
+       * 2) This is only used by GNUnet itself, and only with latin names.
+       */
       h = CreateNamedPipe (name, openMode | FILE_FLAG_OVERLAPPED,
                            PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 2, 1, 1, 0,
                            NULL);
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 6d25c57..c0b7c85 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -112,15 +112,19 @@ get_path_from_proc_exe ()
 static char *
 get_path_from_module_filename ()
 {
-  char path[4097];
-  char *idx;
+  wchar_t path[4097];
+  char upath[4097];
+  wchar_t *idx;
 
-  GetModuleFileName (NULL, path, sizeof (path) - 1);
-  idx = path + strlen (path);
-  while ((idx > path) && (*idx != '\\') && (*idx != '/'))
+  GetModuleFileNameW (NULL, path, sizeof (path) - 1);
+  idx = path + wcslen (path);
+  while ((idx > path) && (*idx != L'\\') && (*idx != L'/'))
     idx--;
-  *idx = '\0';
-  return GNUNET_strdup (path);
+  *idx = L'\0';
+  upath[0] = '\0';
+  WideCharToMultiByte (CP_UTF8, 0, path, -1, upath, 4097, NULL, NULL);
+
+  return GNUNET_strdup (upath);
 }
 #endif
 
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 2cd43b0..6bf5f55 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -28,6 +28,7 @@
 #include "gnunet_common.h"
 #include "gnunet_os_lib.h"
 #include "gnunet_scheduler_lib.h"
+#include "gnunet_strings_lib.h"
 #include "disk.h"
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
@@ -654,7 +655,7 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin,
   char *arg;
   unsigned int cmdlen;
   char *cmd, *idx;
-  STARTUPINFO start;
+  STARTUPINFOW start;
   PROCESS_INFORMATION proc;
 
   HANDLE stdin_handle;
@@ -671,6 +672,7 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin,
   char *libdir;
   char *ptr;
   char *non_const_filename;
+  wchar_t wpath[MAX_PATH + 1], wcmd[32768];
 
   /* Search in prefix dir (hopefully - the directory from which
    * the current module was loaded), bindir and libdir, then in PATH
@@ -787,8 +789,10 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin,
   GNUNET_free (our_env[0]);
   GNUNET_free (our_env[1]);
 
-  if (!CreateProcessA
-      (path, cmd, NULL, NULL, TRUE, DETACHED_PROCESS | CREATE_SUSPENDED,
+  if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath)
+      || ERROR_SUCCESS != plibc_conv_to_win_pathwconv(cmd, wcmd)
+      || !CreateProcessW
+      (wpath, wcmd, NULL, NULL, TRUE, DETACHED_PROCESS | CREATE_SUSPENDED,
        env_block, NULL, &start, &proc))
   {
     SetErrnoFromWinError (GetLastError ());
@@ -974,7 +978,7 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks,
   char **arg, **non_const_argv;
   unsigned int cmdlen;
   char *cmd, *idx;
-  STARTUPINFO start;
+  STARTUPINFOW start;
   PROCESS_INFORMATION proc;
   int argcount = 0;
   struct GNUNET_OS_Process *gnunet_proc = NULL;
@@ -994,6 +998,7 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks,
   const struct GNUNET_DISK_FileHandle *lsocks_write_fd;
   HANDLE lsocks_read;
   HANDLE lsocks_write;
+  wchar_t wpath[MAX_PATH + 1], wcmd[32768];
 
   int fail;
 
@@ -1152,8 +1157,10 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks,
   GNUNET_free_non_null (our_env[2]);
   GNUNET_free_non_null (our_env[3]);
 
-  if (!CreateProcessA
-      (path, cmd, NULL, NULL, TRUE, DETACHED_PROCESS | CREATE_SUSPENDED,
+  if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath)
+      || ERROR_SUCCESS != plibc_conv_to_win_pathwconv(cmd, wcmd)
+      || !CreateProcessW
+      (wpath, wcmd, NULL, NULL, TRUE, DETACHED_PROCESS | CREATE_SUSPENDED,
        env_block, NULL, &start, &proc))
   {
     SetErrnoFromWinError (GetLastError ());
diff --git a/src/util/test_container_bloomfilter.c b/src/util/test_container_bloomfilter.c
index aad6e99..f881bb3 100644
--- a/src/util/test_container_bloomfilter.c
+++ b/src/util/test_container_bloomfilter.c
@@ -69,7 +69,7 @@ main (int argc, char *argv[])
 
   GNUNET_log_setup ("test-container-bloomfilter", "WARNING", NULL);
   GNUNET_CRYPTO_seed_weak_random (1);
-  if (0 == stat (TESTFILE, &sbuf))
+  if (0 == STAT (TESTFILE, &sbuf))
     if (0 != UNLINK (TESTFILE))
       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "unlink", TESTFILE);
   bf = GNUNET_CONTAINER_bloomfilter_load (TESTFILE, SIZE, K);
-- 
1.7.4

0008-UTF8ization.patch (12,241 bytes)   
0009-Temporary-update-plibc-header.patch (53,873 bytes)   
From 9fcf692c89f3d7ccbfd599e01d6a3c07bab444ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Fri, 30 Dec 2011 23:08:31 +0400
Subject: [PATCH 09/10] Temporary: update plibc header

---
 src/include/plibc.h | 1086 +++++++++++++++++++++++++++------------------------
 1 files changed, 570 insertions(+), 516 deletions(-)

diff --git a/src/include/plibc.h b/src/include/plibc.h
index 8314f21..70cbd9e 100644
--- a/src/include/plibc.h
+++ b/src/include/plibc.h
@@ -22,25 +22,24 @@
  * @brief PlibC header
  * @attention This file is usually not installed under Unix,
  *            so ship it with your application
- * @version $Revision: 69 $
+ * @version $Revision$
  */
 
 #ifndef _PLIBC_H_
 #define _PLIBC_H_
 
 #ifndef SIGALRM
-#define SIGALRM 14
+ #define SIGALRM 14
 #endif
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 #include <stddef.h>
 
 #ifdef Q_OS_WIN32
-#define WINDOWS 1
+ #define WINDOWS 1
 #endif
 
 #define HAVE_PLIBC_FD 0
@@ -48,10 +47,9 @@ extern "C"
 #ifdef WINDOWS
 
 #if ENABLE_NLS
-#include "langinfo.h"
+  #include "langinfo.h"
 #endif
 
-#include <winsock2.h>
 #include <ws2tcpip.h>
 #include <windows.h>
 #include <sys/types.h>
@@ -72,9 +70,9 @@ extern "C"
 /* Convert LARGE_INTEGER to double */
 #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
   (double)((x).LowPart))
-
-  struct stat64
-  {
+#ifndef __MINGW64__
+struct stat64
+{
     _dev_t st_dev;
     _ino_t st_ino;
     _mode_t st_mode;
@@ -86,134 +84,133 @@ extern "C"
     __time64_t st_atime;
     __time64_t st_mtime;
     __time64_t st_ctime;
-  };
+};
+#endif
+typedef unsigned int sa_family_t;
 
-  typedef unsigned int sa_family_t;
-
-  struct sockaddr_un
-  {
-    short sun_family;           /*AF_UNIX */
-    char sun_path[108];         /*path name */
-  };
+struct sockaddr_un {
+  short sun_family; /*AF_UNIX*/
+  char sun_path[108]; /*path name */
+};
 
 #ifndef pid_t
-#define pid_t DWORD
+  #define pid_t DWORD
 #endif
 
 #ifndef error_t
-#define error_t int
+  #define error_t int
 #endif
 
 #ifndef WEXITSTATUS
-#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
+	#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
 #endif
 
 #ifndef MSG_DONTWAIT
-#define MSG_DONTWAIT 0
+  #define MSG_DONTWAIT 0
 #endif
 
-  enum
-  {
-    _SC_PAGESIZE = 30,
-    _SC_PAGE_SIZE = 30
-  };
+enum
+{
+  _SC_PAGESIZE = 30,
+  _SC_PAGE_SIZE = 30
+};
 
 /* Thanks to the Cygwin project */
-#define ENOCSI 43               /* No CSI structure available */
-#define EL2HLT 44               /* Level 2 halted */
+#define ENOCSI 43	/* No CSI structure available */
+#define EL2HLT 44	/* Level 2 halted */
 #ifndef  EDEADLK
-#define EDEADLK 45              /* Deadlock condition */
+	#define EDEADLK 45	/* Deadlock condition */
 #endif
 #ifndef  ENOLCK
-#define ENOLCK 46               /* No record locks available */
+	#define ENOLCK 46	/* No record locks available */
 #endif
-#define EBADE 50                /* Invalid exchange */
-#define EBADR 51                /* Invalid request descriptor */
-#define EXFULL 52               /* Exchange full */
-#define ENOANO 53               /* No anode */
-#define EBADRQC 54              /* Invalid request code */
-#define EBADSLT 55              /* Invalid slot */
+#define EBADE 50	/* Invalid exchange */
+#define EBADR 51	/* Invalid request descriptor */
+#define EXFULL 52	/* Exchange full */
+#define ENOANO 53	/* No anode */
+#define EBADRQC 54	/* Invalid request code */
+#define EBADSLT 55	/* Invalid slot */
 #ifndef  EDEADLOCK
-#define EDEADLOCK EDEADLK       /* File locking deadlock error */
+	#define EDEADLOCK EDEADLK	/* File locking deadlock error */
 #endif
-#define EBFONT 57               /* Bad font file fmt */
-#define ENOSTR 60               /* Device not a stream */
-#define ENODATA 61              /* No data (for no delay io) */
-#define ETIME 62                /* Timer expired */
-#define ENOSR 63                /* Out of streams resources */
-#define ENONET 64               /* Machine is not on the network */
-#define ENOPKG 65               /* Package not installed */
-#define EREMOTE 66              /* The object is remote */
-#define ENOLINK 67              /* The link has been severed */
-#define EADV 68                 /* Advertise error */
-#define ESRMNT 69               /* Srmount error */
-#define ECOMM 70                /* Communication error on send */
-#define EPROTO 71               /* Protocol error */
-#define EMULTIHOP 74            /* Multihop attempted */
-#define ELBIN 75                /* Inode is remote (not really error) */
-#define EDOTDOT 76              /* Cross mount point (not really error) */
-#define EBADMSG 77              /* Trying to read unreadable message */
-#define ENOTUNIQ 80             /* Given log. name not unique */
-#define EBADFD 81               /* f.d. invalid for this operation */
-#define EREMCHG 82              /* Remote address changed */
-#define ELIBACC 83              /* Can't access a needed shared lib */
-#define ELIBBAD 84              /* Accessing a corrupted shared lib */
-#define ELIBSCN 85              /* .lib section in a.out corrupted */
-#define ELIBMAX 86              /* Attempting to link in too many libs */
-#define ELIBEXEC 87             /* Attempting to exec a shared library */
+#define EBFONT 57	/* Bad font file fmt */
+#define ENOSTR 60	/* Device not a stream */
+#define ENODATA 61	/* No data (for no delay io) */
+#define ETIME 62	/* Timer expired */
+#define ENOSR 63	/* Out of streams resources */
+#define ENONET 64	/* Machine is not on the network */
+#define ENOPKG 65	/* Package not installed */
+#define EREMOTE 66	/* The object is remote */
+#define ENOLINK 67	/* The link has been severed */
+#define EADV 68		/* Advertise error */
+#define ESRMNT 69	/* Srmount error */
+#define ECOMM 70	/* Communication error on send */
+#define EPROTO 71	/* Protocol error */
+#define EMULTIHOP 74	/* Multihop attempted */
+#define ELBIN 75	/* Inode is remote (not really error) */
+#define EDOTDOT 76	/* Cross mount point (not really error) */
+#define EBADMSG 77	/* Trying to read unreadable message */
+#define ENOTUNIQ 80	/* Given log. name not unique */
+#define EBADFD 81	/* f.d. invalid for this operation */
+#define EREMCHG 82	/* Remote address changed */
+#define ELIBACC 83	/* Can't access a needed shared lib */
+#define ELIBBAD 84	/* Accessing a corrupted shared lib */
+#define ELIBSCN 85	/* .lib section in a.out corrupted */
+#define ELIBMAX 86	/* Attempting to link in too many libs */
+#define ELIBEXEC 87	/* Attempting to exec a shared library */
 #ifndef  ENOSYS
-#define ENOSYS 88               /* Function not implemented */
+	#define ENOSYS 88	/* Function not implemented */
 #endif
-#define ENMFILE 89              /* No more files */
+#define ENMFILE 89      /* No more files */
 #ifndef  ENOTEMPTY
-#define ENOTEMPTY 90            /* Directory not empty */
+	#define ENOTEMPTY 90	/* Directory not empty */
 #endif
 #ifndef  ENAMETOOLONG
-#define ENAMETOOLONG 91         /* File or path name too long */
+	#define ENAMETOOLONG 91	/* File or path name too long */
 #endif
-#define ELOOP 92                /* Too many symbolic links */
-#define EOPNOTSUPP 95           /* Operation not supported on transport endpoint */
-#define EPFNOSUPPORT 96         /* Protocol family not supported */
-#define ECONNRESET 104          /* Connection reset by peer */
-#define ENOBUFS 105             /* No buffer space available */
-#define EAFNOSUPPORT 106        /* Address family not supported by protocol family */
-#define EPROTOTYPE 107          /* Protocol wrong type for socket */
-#define ENOTSOCK 108            /* Socket operation on non-socket */
-#define ENOPROTOOPT 109         /* Protocol not available */
-#define ESHUTDOWN 110           /* Can't send after socket shutdown */
-#define ECONNREFUSED 111        /* Connection refused */
-#define EADDRINUSE 112          /* Address already in use */
-#define ECONNABORTED 113        /* Connection aborted */
-#define ENETUNREACH 114         /* Network is unreachable */
-#define ENETDOWN 115            /* Network interface is not configured */
+#define ELOOP 92	/* Too many symbolic links */
+#define EOPNOTSUPP 95	/* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define ECONNRESET 104  /* Connection reset by peer */
+#define ENOBUFS 105	/* No buffer space available */
+#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
+#define EPROTOTYPE 107	/* Protocol wrong type for socket */
+#define ENOTSOCK 108	/* Socket operation on non-socket */
+#define ENOPROTOOPT 109	/* Protocol not available */
+#define ESHUTDOWN 110	/* Can't send after socket shutdown */
+#define ECONNREFUSED 111	/* Connection refused */
+#define EADDRINUSE 112		/* Address already in use */
+#define ECONNABORTED 113	/* Connection aborted */
+#define ENETUNREACH 114		/* Network is unreachable */
+#define ENETDOWN 115		/* Network interface is not configured */
 #ifndef  ETIMEDOUT
-#define ETIMEDOUT 116           /* Connection timed out */
+	#define ETIMEDOUT 116		/* Connection timed out */
 #endif
-#define EHOSTDOWN 117           /* Host is down */
-#define EHOSTUNREACH 118        /* Host is unreachable */
-#define EINPROGRESS 119         /* Connection already in progress */
-#define EALREADY 120            /* Socket already connected */
-#define EDESTADDRREQ 121        /* Destination address required */
-#define EMSGSIZE 122            /* Message too long */
-#define EPROTONOSUPPORT 123     /* Unknown protocol */
-#define ESOCKTNOSUPPORT 124     /* Socket type not supported */
-#define EADDRNOTAVAIL 125       /* Address not available */
-#define ENETRESET 126           /* Connection aborted by network */
-#define EISCONN 127             /* Socket is already connected */
-#define ENOTCONN 128            /* Socket is not connected */
-#define ETOOMANYREFS 129        /* Too many references: cannot splice */
-#define EPROCLIM 130            /* Too many processes */
-#define EUSERS 131              /* Too many users */
-#define EDQUOT 132              /* Disk quota exceeded */
-#define ESTALE 133              /* Unknown error */
+#define EHOSTDOWN 117		/* Host is down */
+#define EHOSTUNREACH 118	/* Host is unreachable */
+#define EINPROGRESS 119		/* Connection already in progress */
+#define EALREADY 120		/* Socket already connected */
+#define EDESTADDRREQ 121	/* Destination address required */
+#define EMSGSIZE 122		/* Message too long */
+#define EPROTONOSUPPORT 123	/* Unknown protocol */
+#define ESOCKTNOSUPPORT 124	/* Socket type not supported */
+#define EADDRNOTAVAIL 125	/* Address not available */
+#define ENETRESET 126		/* Connection aborted by network */
+#define EISCONN 127		    /* Socket is already connected */
+#define ENOTCONN 128		/* Socket is not connected */
+#define ETOOMANYREFS 129	/* Too many references: cannot splice */
+#define EPROCLIM 130		/* Too many processes */
+#define EUSERS 131			/* Too many users */
+#define EDQUOT 132			/* Disk quota exceeded */
+#define ESTALE 133          /* Unknown error */
 #ifndef  ENOTSUP
-#define ENOTSUP 134             /* Not supported */
+	#define ENOTSUP 134		    /* Not supported */
 #endif
-#define ENOMEDIUM 135           /* No medium (in tape drive) */
-#define ENOSHARE 136            /* No such host or network path */
-#define ECASECLASH 137          /* Filename exists with different case */
-#define EWOULDBLOCK EAGAIN      /* Operation would block */
-#define EOVERFLOW 139           /* Value too large for defined data type */
+#define ENOMEDIUM 135       /* No medium (in tape drive) */
+#define ENOSHARE 136        /* No such host or network path */
+#define ECASECLASH 137      /* Filename exists with different case */
+#define EWOULDBLOCK EAGAIN	/* Operation would block */
+#define EOVERFLOW 139 /* Value too large for defined data type */
 
 #undef HOST_NOT_FOUND
 #define HOST_NOT_FOUND 1
@@ -227,68 +224,73 @@ extern "C"
 #define PROT_READ   0x1
 #define PROT_WRITE  0x2
 #define MAP_SHARED  0x1
-#define MAP_PRIVATE 0x2         /* unsupported */
+#define MAP_PRIVATE 0x2 /* unsupported */
 #define MAP_FIXED   0x10
+#define MAP_ANONYMOUS 0x20 /* unsupported */
 #define MAP_FAILED  ((void *)-1)
 
-  struct statfs
-  {
-    long f_type;                /* type of filesystem (see below) */
-    long f_bsize;               /* optimal transfer block size */
-    long f_blocks;              /* total data blocks in file system */
-    long f_bfree;               /* free blocks in fs */
-    long f_bavail;              /* free blocks avail to non-superuser */
-    long f_files;               /* total file nodes in file system */
-    long f_ffree;               /* free file nodes in fs */
-    long f_fsid;                /* file system id */
-    long f_namelen;             /* maximum length of filenames */
-    long f_spare[6];            /* spare for later */
-  };
+#define MS_ASYNC        1       /* sync memory asynchronously */
+#define MS_INVALIDATE   2       /* invalidate the caches */
+#define MS_SYNC         4       /* synchronous memory sync */
 
-  extern const struct in6_addr in6addr_any;     /* :: */
-  extern const struct in6_addr in6addr_loopback;        /* ::1 */
+struct statfs
+{
+  long f_type;                  /* type of filesystem (see below) */
+  long f_bsize;                 /* optimal transfer block size */
+  long f_blocks;                /* total data blocks in file system */
+  long f_bfree;                 /* free blocks in fs */
+  long f_bavail;                /* free blocks avail to non-superuser */
+  long f_files;                 /* total file nodes in file system */
+  long f_ffree;                 /* free file nodes in fs */
+  long f_fsid;                  /* file system id */
+  long f_namelen;               /* maximum length of filenames */
+  long f_spare[6];              /* spare for later */
+};
+
+extern const struct in6_addr in6addr_any;        /* :: */
+extern const struct in6_addr in6addr_loopback;   /* ::1 */
 
 /* Taken from the Wine project <http://www.winehq.org>
     /wine/include/winternl.h */
-  enum SYSTEM_INFORMATION_CLASS
-  {
-    SystemBasicInformation = 0,
-    Unknown1,
-    SystemPerformanceInformation = 2,
-    SystemTimeOfDayInformation = 3,     /* was SystemTimeInformation */
-    Unknown4,
-    SystemProcessInformation = 5,
-    Unknown6,
-    Unknown7,
-    SystemProcessorPerformanceInformation = 8,
-    Unknown9,
-    Unknown10,
-    SystemDriverInformation,
-    Unknown12,
-    Unknown13,
-    Unknown14,
-    Unknown15,
-    SystemHandleList,
-    Unknown17,
-    Unknown18,
-    Unknown19,
-    Unknown20,
-    SystemCacheInformation,
-    Unknown22,
-    SystemInterruptInformation = 23,
-    SystemExceptionInformation = 33,
-    SystemRegistryQuotaInformation = 37,
-    SystemLookasideInformation = 45
-  };
-
-  typedef struct
-  {
+enum SYSTEM_INFORMATION_CLASS
+{
+  SystemBasicInformation = 0,
+  Unknown1,
+  SystemPerformanceInformation = 2,
+  SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
+  Unknown4,
+  SystemProcessInformation = 5,
+  Unknown6,
+  Unknown7,
+  SystemProcessorPerformanceInformation = 8,
+  Unknown9,
+  Unknown10,
+  SystemDriverInformation,
+  Unknown12,
+  Unknown13,
+  Unknown14,
+  Unknown15,
+  SystemHandleList,
+  Unknown17,
+  Unknown18,
+  Unknown19,
+  Unknown20,
+  SystemCacheInformation,
+  Unknown22,
+  SystemInterruptInformation = 23,
+  SystemExceptionInformation = 33,
+  SystemRegistryQuotaInformation = 37,
+  SystemLookasideInformation = 45
+};
+
+typedef struct
+{
     LARGE_INTEGER IdleTime;
     LARGE_INTEGER KernelTime;
     LARGE_INTEGER UserTime;
     LARGE_INTEGER Reserved1[2];
     ULONG Reserved2;
-  } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
+} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
 
 #define sleep(secs) (Sleep(secs * 1000))
 
@@ -305,11 +307,11 @@ extern "C"
 #define SHUT_RDWR SD_BOTH
 
 /* Operations for flock() */
-#define LOCK_SH  1              /* shared lock */
-#define LOCK_EX  2              /* exclusive lock */
-#define LOCK_NB  4              /* or'd with one of the above to prevent
-                                 * blocking */
-#define LOCK_UN  8              /* remove lock */
+#define LOCK_SH  1       /* shared lock */
+#define LOCK_EX  2       /* exclusive lock */
+#define LOCK_NB  4       /* or'd with one of the above to prevent
+                            blocking */
+#define LOCK_UN  8       /* remove lock */
 
 /* Not supported under MinGW */
 #define S_IRGRP 0
@@ -333,331 +335,385 @@ extern "C"
 
 #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
 
-  BOOL _plibc_CreateShortcut (const char *pszSrc, const char *pszDest);
-  BOOL _plibc_DereferenceShortcut (char *pszShortcut);
-  char *plibc_ChooseDir (char *pszTitle, unsigned long ulFlags);
-  char *plibc_ChooseFile (char *pszTitle, unsigned long ulFlags);
-  long QueryRegistry (HKEY hMainKey, const char *pszKey, const char *pszSubKey,
-                      char *pszBuffer, long *pdLength);
-
-  BOOL __win_IsHandleMarkedAsBlocking (int hHandle);
-  void __win_SetHandleBlockingMode (int s, BOOL bBlocking);
-  void __win_DiscardHandleBlockingMode (int s);
-  int _win_isSocketValid (int s);
-  int plibc_conv_to_win_path (const char *pszUnix, char *pszWindows);
-  unsigned plibc_get_handle_count ();
-
-  typedef void (*TPanicProc) (int, char *);
-  void plibc_set_panic_proc (TPanicProc proc);
-
-  int flock (int fd, int operation);
-  int fsync (int fildes);
-  int inet_pton (int af, const char *src, void *dst);
-  int inet_pton4 (const char *src, u_char * dst, int pton);
+BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
+BOOL _plibc_DereferenceShortcut(char *pszShortcut);
+char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
+char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags);
+
+long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
+              char *pszBuffer, long *pdLength);
+long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *pszSubKey,
+              wchar_t *pszBuffer, long *pdLength);
+
+BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
+void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
+void __win_DiscardHandleBlockingMode(int s);
+int _win_isSocketValid(int s);
+int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
+int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows);
+
+int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows);
+int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows, int derefLinks);
+
+unsigned plibc_get_handle_count();
+
+typedef void (*TPanicProc) (int, char *);
+void plibc_set_panic_proc(TPanicProc proc);
+
+int flock(int fd, int operation);
+int fsync(int fildes);
+int inet_pton(int af, const char *src, void *dst);
+int inet_pton4(const char *src, u_char *dst, int pton);
 #if USE_IPV6
-  int inet_pton6 (const char *src, u_char * dst);
+int inet_pton6(const char *src, u_char *dst);
 #endif
-  int truncate (const char *fname, int distance);
-  int statfs (const char *path, struct statfs *buf);
-  const char *hstrerror (int err);
-  int mkstemp (char *tmplate);
-  char *strptime (const char *buf, const char *format, struct tm *tm);
-  const char *inet_ntop (int af, const void *src, char *dst, size_t size);
-
-  int plibc_init (char *pszOrg, char *pszApp);
-  void plibc_shutdown ();
-  int plibc_initialized ();
-  int plibc_conv_to_win_path_ex (const char *pszUnix, char *pszWindows,
-                                 int derefLinks);
-  void _SetErrnoFromWinError (long lWinError, char *pszCaller, int iLine);
-  void SetErrnoFromWinsockError (long lWinError);
-  void SetHErrnoFromWinError (long lWinError);
-  void SetErrnoFromHRESULT (HRESULT hRes);
-  int GetErrnoFromWinsockError (long lWinError);
-  FILE *_win_fopen (const char *filename, const char *mode);
-  DIR *_win_opendir (const char *dirname);
-  int _win_open (const char *filename, int oflag, ...);
+int truncate(const char *fname, int distance);
+int statfs(const char *path, struct statfs *buf);
+const char *hstrerror(int err);
+int mkstemp(char *tmplate);
+char *strptime (const char *buf, const char *format, struct tm *tm);
+const char *inet_ntop(int af, const void *src, char *dst, size_t size);
+struct tm *gmtime_r(const time_t *clock, struct tm *result);
+
+int plibc_init(char *pszOrg, char *pszApp);
+void plibc_shutdown();
+int plibc_initialized();
+
+void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
+void SetErrnoFromWinsockError(long lWinError);
+void SetHErrnoFromWinError(long lWinError);
+void SetErrnoFromHRESULT(HRESULT hRes);
+int GetErrnoFromWinsockError(long lWinError);
+FILE *_win_fopen(const char *filename, const char *mode);
+int _win_fclose(FILE *);
+DIR *_win_opendir(const char *dirname);
+struct dirent *_win_readdir(DIR *dirp);
+int _win_closedir(DIR *dirp);
+int _win_open(const char *filename, int oflag, ...);
 #ifdef ENABLE_NLS
-  char *_win_bindtextdomain (const char *domainname, const char *dirname);
+char *_win_bindtextdomain(const char *domainname, const char *dirname);
 #endif
-  int _win_chdir (const char *path);
-  int _win_close (int fd);
-  int _win_creat (const char *path, mode_t mode);
-  char *_win_ctime (const time_t * clock);
-  char *_win_ctime_r (const time_t * clock, char *buf);
-  int _win_fstat (int handle, struct stat *buffer);
-  int _win_ftruncate (int fildes, off_t length);
-  void _win_gettimeofday (struct timeval *tp, void *tzp);
-  int _win_kill (pid_t pid, int sig);
-  int _win_pipe (int *phandles);
-  int _win_rmdir (const char *path);
-  int _win_access (const char *path, int mode);
-  int _win_chmod (const char *filename, int pmode);
-  char *realpath (const char *file_name, char *resolved_name);
-  long _win_random (void);
-  void _win_srandom (unsigned int seed);
-  int _win_remove (const char *path);
-  int _win_rename (const char *oldname, const char *newname);
-  int _win_stat (const char *path, struct stat *buffer);
-  int _win_stat64 (const char *path, struct stat64 *buffer);
-  long _win_sysconf (int name);
-  int _win_unlink (const char *filename);
-  int _win_write (int fildes, const void *buf, size_t nbyte);
-  int _win_read (int fildes, void *buf, size_t nbyte);
-  size_t _win_fwrite (const void *buffer, size_t size, size_t count,
-                      FILE * stream);
-  size_t _win_fread (void *buffer, size_t size, size_t count, FILE * stream);
-  int _win_symlink (const char *path1, const char *path2);
-  void *_win_mmap (void *start, size_t len, int access, int flags, int fd,
-                   unsigned long long offset);
-  int _win_munmap (void *start, size_t length);
-  int _win_lstat (const char *path, struct stat *buf);
-  int _win_lstat64 (const char *path, struct stat64 *buf);
-  int _win_readlink (const char *path, char *buf, size_t bufsize);
-  int _win_accept (int s, struct sockaddr *addr, int *addrlen);
-  int _win_printf (const char *format, ...);
-  int _win_fprintf (FILE * f, const char *format, ...);
-  int _win_vprintf (const char *format, va_list ap);
-  int _win_vfprintf (FILE * stream, const char *format, va_list arg_ptr);
-  int _win_vsprintf (char *dest, const char *format, va_list arg_ptr);
-  int _win_vsnprintf (char *str, size_t size, const char *format,
-                      va_list arg_ptr);
-  int _win_snprintf (char *str, size_t size, const char *format, ...);
-  int _win_sprintf (char *dest, const char *format, ...);
-  int _win_vsscanf (const char *str, const char *format, va_list arg_ptr);
-  int _win_sscanf (const char *str, const char *format, ...);
-  int _win_vfscanf (FILE * stream, const char *format, va_list arg_ptr);
-  int _win_vscanf (const char *format, va_list arg_ptr);
-  int _win_scanf (const char *format, ...);
-  int _win_fscanf (FILE * stream, const char *format, ...);
-  pid_t _win_waitpid (pid_t pid, int *stat_loc, int options);
-  int _win_bind (int s, const struct sockaddr *name, int namelen);
-  int _win_connect (int s, const struct sockaddr *name, int namelen);
-  int _win_getpeername (int s, struct sockaddr *name, int *namelen);
-  int _win_getsockname (int s, struct sockaddr *name, int *namelen);
-  int _win_getsockopt (int s, int level, int optname, char *optval,
-                       int *optlen);
-  int _win_listen (int s, int backlog);
-  int _win_recv (int s, char *buf, int len, int flags);
-  int _win_recvfrom (int s, void *buf, int len, int flags,
-                     struct sockaddr *from, int *fromlen);
-  int _win_select (int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
-                   const struct timeval *tv);
-  int _win_send (int s, const char *buf, int len, int flags);
-  int _win_sendto (int s, const char *buf, int len, int flags,
-                   const struct sockaddr *to, int tolen);
-  int _win_setsockopt (int s, int level, int optname, const void *optval,
-                       int optlen);
-  int _win_shutdown (int s, int how);
-  int _win_socket (int af, int type, int protocol);
-  struct hostent *_win_gethostbyaddr (const char *addr, int len, int type);
-  struct hostent *_win_gethostbyname (const char *name);
-  struct hostent *gethostbyname2 (const char *name, int af);
-  char *_win_strerror (int errnum);
-  int IsWinNT ();
-  char *index (const char *s, int c);
+int _win_chdir(const char *path);
+int _win_close(int fd);
+int _win_creat(const char *path, mode_t mode);
+char *_win_ctime(const time_t *clock);
+char *_win_ctime_r(const time_t *clock, char *buf);
+int _win_fstat(int handle, struct stat *buffer);
+int _win_ftruncate(int fildes, off_t length);
+void _win_gettimeofday(struct timeval *tp, void *tzp);
+int _win_kill(pid_t pid, int sig);
+int _win_pipe(int *phandles);
+int _win_rmdir(const char *path);
+int _win_access( const char *path, int mode );
+int _win_chmod(const char *filename, int pmode);
+char *realpath(const char *file_name, char *resolved_name);
+long _win_random(void);
+void _win_srandom(unsigned int seed);
+int _win_remove(const char *path);
+int _win_rename(const char *oldname, const char *newname);
+int _win_stat(const char *path, struct stat *buffer);
+int _win_stat64(const char *path, struct stat64 *buffer);
+long _win_sysconf(int name);
+int _win_unlink(const char *filename);
+int _win_write(int fildes, const void *buf, size_t nbyte);
+int _win_read(int fildes, void *buf, size_t nbyte);
+size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE *stream);
+size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream );
+int _win_symlink(const char *path1, const char *path2);
+void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
+                unsigned long long offset);
+int _win_msync(void *start, size_t length, int flags);
+int _win_munmap(void *start, size_t length);
+int _win_lstat(const char *path, struct stat *buf);
+int _win_lstat64(const char *path, struct stat64 *buf);
+int _win_readlink(const char *path, char *buf, size_t bufsize);
+int _win_accept(int s, struct sockaddr *addr, int *addrlen);
+
+int _win_printf(const char *format,...);
+int _win_wprintf(const wchar_t *format, ...);
+
+int _win_fprintf(FILE *f,const char *format,...);
+int _win_fwprintf(FILE *f,const wchar_t *format, ...);
+
+int _win_vprintf(const char *format, va_list ap);
+int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
+int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vwprintf(const wchar_t *format, va_list ap);
+
+int _win_vsprintf(char *dest,const char *format, va_list arg_ptr);
+int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr);
+
+int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr);
+int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr);
+
+int _win_snprintf(char *str,size_t size,const char *format,...);
+int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...);
+
+int _win_sprintf(char *dest,const char *format,...);
+int _win_swprintf(wchar_t *dest, const wchar_t *format, ...);
+
+int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
+int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr);
+
+int _win_sscanf(const char *str, const char *format, ...);
+int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...);
+
+int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
+int _win_vscanf(const char *format, va_list arg_ptr);
+int _win_vwscanf(const wchar_t *format, va_list arg_ptr);
+
+int _win_scanf(const char *format, ...);
+int _win_wscanf(const wchar_t *format, ...);
+
+int _win_fscanf(FILE *stream, const char *format, ...);
+int _win_fwscanf(FILE *stream, const wchar_t *format, ...);
+
+
+pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
+int _win_bind(int s, const struct sockaddr *name, int namelen);
+int _win_connect(int s,const struct sockaddr *name, int namelen);
+int _win_getpeername(int s, struct sockaddr *name,
+                int *namelen);
+int _win_getsockname(int s, struct sockaddr *name,
+                int *namelen);
+int _win_getsockopt(int s, int level, int optname, char *optval,
+				int *optlen);
+int _win_listen(int s, int backlog);
+int _win_recv(int s, char *buf, int len, int flags);
+int _win_recvfrom(int s, void *buf, int len, int flags,
+             struct sockaddr *from, int *fromlen);
+int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
+                const struct timeval *tv);
+int _win_send(int s, const char *buf, int len, int flags);
+int _win_sendto(int s, const char *buf, int len, int flags,
+                const struct sockaddr *to, int tolen);
+int _win_setsockopt(int s, int level, int optname, const void *optval,
+                    int optlen);
+int _win_shutdown(int s, int how);
+int _win_socket(int af, int type, int protocol);
+struct hostent *_win_gethostbyaddr(const char *addr, int len, int type);
+struct hostent *_win_gethostbyname(const char *name);
+struct hostent *gethostbyname2(const char *name, int af);
+char *_win_strerror(int errnum);
+int IsWinNT();
+char *index(const char *s, int c);
 
 #if !HAVE_STRNDUP
-  char *strndup (const char *s, size_t n);
+char *strndup (const char *s, size_t n);
 #endif
 #if !HAVE_STRNLEN
-  size_t strnlen (const char *str, size_t maxlen);
+size_t strnlen (const char *str, size_t maxlen);
 #endif
-  char *stpcpy (char *dest, const char *src);
-  char *strcasestr (const char *haystack_start, const char *needle_start);
-
+char *stpcpy(char *dest, const char *src);
+char *strcasestr(const char *haystack_start, const char *needle_start);
+#ifndef __MINGW64__
 #define strcasecmp(a, b) stricmp(a, b)
+#define wcscasecmp(a, b) wcsicmp(a, b)
 #define strncasecmp(a, b, c) strnicmp(a, b, c)
-
-#endif                          /* WINDOWS */
+#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
+#endif
+#endif /* WINDOWS */
 
 #ifndef WINDOWS
-#define DIR_SEPARATOR '/'
-#define DIR_SEPARATOR_STR "/"
-#define PATH_SEPARATOR ':'
-#define PATH_SEPARATOR_STR ":"
-#define NEWLINE "\n"
+ #define DIR_SEPARATOR '/'
+ #define DIR_SEPARATOR_STR "/"
+ #define PATH_SEPARATOR ':'
+ #define PATH_SEPARATOR_STR ":"
+ #define NEWLINE "\n"
 
 #ifdef ENABLE_NLS
-#define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
+ #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
 #endif
-#define CREAT(p, m) creat(p, m)
-#define PLIBC_CTIME(c) ctime(c)
-#define CTIME_R(c, b) ctime_r(c, b)
-#undef FOPEN
-#define FOPEN(f, m) fopen(f, m)
-#define FTRUNCATE(f, l) ftruncate(f, l)
-#define OPENDIR(d) opendir(d)
-#define OPEN open
-#define CHDIR(d) chdir(d)
-#define CLOSE(f) close(f)
-#define LSEEK(f, o, w) lseek(f, o, w)
-#define RMDIR(f) rmdir(f)
-#define ACCESS(p, m) access(p, m)
-#define CHMOD(f, p) chmod(f, p)
-#define FSTAT(h, b) fstat(h, b)
-#define PLIBC_KILL(p, s) kill(p, s)
-#define PIPE(h) pipe(h)
-#define REMOVE(p) remove(p)
-#define RENAME(o, n) rename(o, n)
-#define STAT(p, b) stat(p, b)
-#define STAT64(p, b) stat64(p, b)
-#define SYSCONF(n) sysconf(n)
-#define UNLINK(f) unlink(f)
-#define WRITE(f, b, n) write(f, b, n)
-#define READ(f, b, n) read(f, b, n)
-#define GN_FREAD(b, s, c, f) fread(b, s, c, f)
-#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
-#define SYMLINK(a, b) symlink(a, b)
-#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
-#define MUNMAP(s, l) munmap(s, l)
-#define STRERROR(i) strerror(i)
-#define RANDOM() random()
-#define SRANDOM(s) srandom(s)
-#define READLINK(p, b, s) readlink(p, b, s)
-#define LSTAT(p, b) lstat(p, b)
-#define LSTAT64(p, b) lstat64(p, b)
-#define PRINTF printf
-#define FPRINTF fprintf
-#define VPRINTF(f, a) vprintf(f, a)
-#define VFPRINTF(s, f, a) vfprintf(s, f, a)
-#define VSPRINTF(d, f, a) vsprintf(d, f, a)
-#define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
-#define _REAL_SNPRINTF snprintf
-#define SPRINTF sprintf
-#define VSSCANF(s, f, a) vsscanf(s, f, a)
-#define SSCANF sscanf
-#define VFSCANF(s, f, a) vfscanf(s, f, a)
-#define VSCANF(f, a) vscanf(f, a)
-#define SCANF scanf
-#define FSCANF fscanf
-#define WAITPID(p, s, o) waitpid(p, s, o)
-#define ACCEPT(s, a, l) accept(s, a, l)
-#define BIND(s, n, l) bind(s, n, l)
-#define CONNECT(s, n, l) connect(s, n, l)
-#define GETPEERNAME(s, n, l) getpeername(s, n, l)
-#define GETSOCKNAME(s, n, l) getsockname(s, n, l)
-#define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
-#define LISTEN(s, b) listen(s, b)
-#define RECV(s, b, l, f) recv(s, b, l, f)
-#define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
-#define SELECT(n, r, w, e, t) select(n, r, w, e, t)
-#define SEND(s, b, l, f) send(s, b, l, f)
-#define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
-#define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
-#define SHUTDOWN(s, h) shutdown(s, h)
-#define SOCKET(a, t, p) socket(a, t, p)
-#define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t)
-#define GETHOSTBYNAME(n) gethostbyname(n)
-#define GETTIMEOFDAY(t, n) gettimeofday(t, n)
-#define INSQUE(e, p) insque(e, p)
-#define REMQUE(e) remque(e)
-#define HSEARCH(i, a) hsearch(i, a)
-#define HCREATE(n) hcreate(n)
-#define HDESTROY() hdestroy()
-#define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h)
-#define HCREATE_R(n, h) hcreate_r(n, h)
-#define HDESTROY_R(h) hdestroy_r(h)
-#define TSEARCH(k, r, c) tsearch(k, r, c)
-#define TFIND(k, r, c) tfind(k, r, c)
-#define TDELETE(k, r, c) tdelete(k, r, c)
-#define TWALK(r, a) twalk(r, a)
-#define TDESTROY(r, f) tdestroy(r, f)
-#define LFIND(k, b, n, s, c) lfind(k, b, n, s, c)
-#define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c)
+ #define CREAT(p, m) creat(p, m)
+ #define PLIBC_CTIME(c) ctime(c)
+ #define CTIME_R(c, b) ctime_r(c, b)
+ #undef FOPEN
+ #define FOPEN(f, m) fopen(f, m)
+ #define FCLOSE(f) fclose(f)
+ #define FTRUNCATE(f, l) ftruncate(f, l)
+ #define OPENDIR(d) opendir(d)
+ #define CLOSEDIR(d) closedir(d)
+ #define READDIR(d) readdir(d)
+ #define OPEN open
+ #define CHDIR(d) chdir(d)
+ #define CLOSE(f) close(f)
+ #define LSEEK(f, o, w) lseek(f, o, w)
+ #define RMDIR(f) rmdir(f)
+ #define ACCESS(p, m) access(p, m)
+ #define CHMOD(f, p) chmod(f, p)
+ #define FSTAT(h, b) fstat(h, b)
+ #define PLIBC_KILL(p, s) kill(p, s)
+ #define PIPE(h) pipe(h)
+ #define REMOVE(p) remove(p)
+ #define RENAME(o, n) rename(o, n)
+ #define STAT(p, b) stat(p, b)
+ #define STAT64(p, b) stat64(p, b)
+ #define SYSCONF(n) sysconf(n)
+ #define UNLINK(f) unlink(f)
+ #define WRITE(f, b, n) write(f, b, n)
+ #define READ(f, b, n) read(f, b, n)
+ #define GN_FREAD(b, s, c, f) fread(b, s, c, f)
+ #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
+ #define SYMLINK(a, b) symlink(a, b)
+ #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) mkfifo(p, m)
+ #define MSYNC(s, l, f) msync(s, l, f)
+ #define MUNMAP(s, l) munmap(s, l)
+ #define STRERROR(i) strerror(i)
+ #define RANDOM() random()
+ #define SRANDOM(s) srandom(s)
+ #define READLINK(p, b, s) readlink(p, b, s)
+ #define LSTAT(p, b) lstat(p, b)
+ #define LSTAT64(p, b) lstat64(p, b)
+ #define PRINTF printf
+ #define FPRINTF fprintf
+ #define VPRINTF(f, a) vprintf(f, a)
+ #define VFPRINTF(s, f, a) vfprintf(s, f, a)
+ #define VSPRINTF(d, f, a) vsprintf(d, f, a)
+ #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
+ #define _REAL_SNPRINTF snprintf
+ #define SPRINTF sprintf
+ #define VSSCANF(s, f, a) vsscanf(s, f, a)
+ #define SSCANF sscanf
+ #define VFSCANF(s, f, a) vfscanf(s, f, a)
+ #define VSCANF(f, a) vscanf(f, a)
+ #define SCANF scanf
+ #define FSCANF fscanf
+ #define WAITPID(p, s, o) waitpid(p, s, o)
+ #define ACCEPT(s, a, l) accept(s, a, l)
+ #define BIND(s, n, l) bind(s, n, l)
+ #define CONNECT(s, n, l) connect(s, n, l)
+ #define GETPEERNAME(s, n, l) getpeername(s, n, l)
+ #define GETSOCKNAME(s, n, l) getsockname(s, n, l)
+ #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
+ #define LISTEN(s, b) listen(s, b)
+ #define RECV(s, b, l, f) recv(s, b, l, f)
+ #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
+ #define SELECT(n, r, w, e, t) select(n, r, w, e, t)
+ #define SEND(s, b, l, f) send(s, b, l, f)
+ #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
+ #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
+ #define SHUTDOWN(s, h) shutdown(s, h)
+ #define SOCKET(a, t, p) socket(a, t, p)
+ #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t)
+ #define GETHOSTBYNAME(n) gethostbyname(n)
+ #define GETTIMEOFDAY(t, n) gettimeofday(t, n)
+ #define INSQUE(e, p) insque(e, p)
+ #define REMQUE(e) remque(e)
+ #define HSEARCH(i, a) hsearch(i, a)
+ #define HCREATE(n) hcreate(n)
+ #define HDESTROY() hdestroy()
+ #define HSEARCH_R(i, a, r, h) hsearch_r(i, a, r, h)
+ #define HCREATE_R(n, h) hcreate_r(n, h)
+ #define HDESTROY_R(h) hdestroy_r(h)
+ #define TSEARCH(k, r, c) tsearch(k, r, c)
+ #define TFIND(k, r, c) tfind(k, r, c)
+ #define TDELETE(k, r, c) tdelete(k, r, c)
+ #define TWALK(r, a) twalk(r, a)
+ #define TDESTROY(r, f) tdestroy(r, f)
+ #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c)
+ #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c)
 #else
-#define DIR_SEPARATOR '\\'
-#define DIR_SEPARATOR_STR "\\"
-#define PATH_SEPARATOR ';'
-#define PATH_SEPARATOR_STR ";"
-#define NEWLINE "\r\n"
+ #define DIR_SEPARATOR '\\'
+ #define DIR_SEPARATOR_STR "\\"
+ #define PATH_SEPARATOR ';'
+ #define PATH_SEPARATOR_STR ";"
+ #define NEWLINE "\r\n"
 
 #ifdef ENABLE_NLS
-#define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
+ #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
 #endif
-#define CREAT(p, m) _win_creat(p, m)
-#define PLIBC_CTIME(c) _win_ctime(c)
-#define CTIME_R(c, b) _win_ctime_r(c, b)
-#define FOPEN(f, m) _win_fopen(f, m)
-#define FTRUNCATE(f, l) _win_ftruncate(f, l)
-#define OPENDIR(d) _win_opendir(d)
-#define OPEN _win_open
-#define CHDIR(d) _win_chdir(d)
-#define CLOSE(f) _win_close(f)
-#define PLIBC_KILL(p, s) _win_kill(p, s)
-#define LSEEK(f, o, w) _win_lseek(f, o, w)
-#define FSTAT(h, b) _win_fstat(h, b)
-#define RMDIR(f) _win_rmdir(f)
-#define ACCESS(p, m) _win_access(p, m)
-#define CHMOD(f, p) _win_chmod(f, p)
-#define PIPE(h) _win_pipe(h)
-#define RANDOM() _win_random()
-#define SRANDOM(s) _win_srandom(s)
-#define REMOVE(p) _win_remove(p)
-#define RENAME(o, n) _win_rename(o, n)
-#define STAT(p, b) _win_stat(p, b)
-#define STAT64(p, b) _win_stat64(p, b)
-#define SYSCONF(n) _win_sysconf(n)
-#define UNLINK(f) _win_unlink(f)
-#define WRITE(f, b, n) _win_write(f, b, n)
-#define READ(f, b, n) _win_read(f, b, n)
-#define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
-#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
-#define SYMLINK(a, b) _win_symlink(a, b)
-#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
-#define MUNMAP(s, l) _win_munmap(s, l)
-#define STRERROR(i) _win_strerror(i)
-#define READLINK(p, b, s) _win_readlink(p, b, s)
-#define LSTAT(p, b) _win_lstat(p, b)
-#define LSTAT64(p, b) _win_lstat64(p, b)
-#define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
-#define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
-#define VPRINTF(f, a) _win_vprintf(f, a)
-#define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
-#define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
-#define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
-#define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
-#define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
-#define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
-#define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
-#define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
-#define VSCANF(f, a) _win_vscanf(f, a)
-#define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
-#define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
-#define WAITPID(p, s, o) _win_waitpid(p, s, o)
-#define ACCEPT(s, a, l) _win_accept(s, a, l)
-#define BIND(s, n, l) _win_bind(s, n, l)
-#define CONNECT(s, n, l) _win_connect(s, n, l)
-#define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
-#define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
-#define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
-#define LISTEN(s, b) _win_listen(s, b)
-#define RECV(s, b, l, f) _win_recv(s, b, l, f)
-#define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
-#define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
-#define SEND(s, b, l, f) _win_send(s, b, l, f)
-#define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
-#define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
-#define SHUTDOWN(s, h) _win_shutdown(s, h)
-#define SOCKET(a, t, p) _win_socket(a, t, p)
-#define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
-#define GETHOSTBYNAME(n) _win_gethostbyname(n)
-#define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n)
-#define INSQUE(e, p) _win_insque(e, p)
-#define REMQUE(e) _win_remque(e)
-#define HSEARCH(i, a) _win_hsearch(i, a)
-#define HCREATE(n) _win_hcreate(n)
-#define HDESTROY() _win_hdestroy()
-#define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h)
-#define HCREATE_R(n, h) _win_hcreate_r(n, h)
-#define HDESTROY_R(h) _win_hdestroy_r(h)
-#define TSEARCH(k, r, c) _win_tsearch(k, r, c)
-#define TFIND(k, r, c) _win_tfind(k, r, c)
-#define TDELETE(k, r, c) _win_tdelete(k, r, c)
-#define TWALK(r, a) _win_twalk(r, a)
-#define TDESTROY(r, f) _win_tdestroy(r, f)
-#define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c)
-#define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c)
+ #define CREAT(p, m) _win_creat(p, m)
+ #define PLIBC_CTIME(c) _win_ctime(c)
+ #define CTIME_R(c, b) _win_ctime_r(c, b)
+ #define FOPEN(f, m) _win_fopen(f, m)
+ #define FCLOSE(f) _win_fclose(f)
+ #define FTRUNCATE(f, l) _win_ftruncate(f, l)
+ #define OPENDIR(d) _win_opendir(d)
+ #define CLOSEDIR(d) _win_closedir(d)
+ #define READDIR(d) _win_readdir(d)
+ #define OPEN _win_open
+ #define CHDIR(d) _win_chdir(d)
+ #define CLOSE(f) _win_close(f)
+ #define PLIBC_KILL(p, s) _win_kill(p, s)
+ #define LSEEK(f, o, w) _win_lseek(f, o, w)
+ #define FSTAT(h, b) _win_fstat(h, b)
+ #define RMDIR(f) _win_rmdir(f)
+ #define ACCESS(p, m) _win_access(p, m)
+ #define CHMOD(f, p) _win_chmod(f, p)
+ #define PIPE(h) _win_pipe(h)
+ #define RANDOM() _win_random()
+ #define SRANDOM(s) _win_srandom(s)
+ #define REMOVE(p) _win_remove(p)
+ #define RENAME(o, n) _win_rename(o, n)
+ #define STAT(p, b) _win_stat(p, b)
+ #define STAT64(p, b) _win_stat64(p, b)
+ #define SYSCONF(n) _win_sysconf(n)
+ #define UNLINK(f) _win_unlink(f)
+ #define WRITE(f, b, n) _win_write(f, b, n)
+ #define READ(f, b, n) _win_read(f, b, n)
+ #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
+ #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
+ #define SYMLINK(a, b) _win_symlink(a, b)
+ #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) _win_mkfifo(p, m)
+ #define MSYNC(s, l, f) _win_msync(s, l, f)
+ #define MUNMAP(s, l) _win_munmap(s, l)
+ #define STRERROR(i) _win_strerror(i)
+ #define READLINK(p, b, s) _win_readlink(p, b, s)
+ #define LSTAT(p, b) _win_lstat(p, b)
+ #define LSTAT64(p, b) _win_lstat64(p, b)
+ #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
+ #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
+ #define VPRINTF(f, a) _win_vprintf(f, a)
+ #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
+ #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
+ #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
+ #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__)
+ #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
+ #define VSCANF(f, a) _win_vscanf(f, a)
+ #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
+ #define WAITPID(p, s, o) _win_waitpid(p, s, o)
+ #define ACCEPT(s, a, l) _win_accept(s, a, l)
+ #define BIND(s, n, l) _win_bind(s, n, l)
+ #define CONNECT(s, n, l) _win_connect(s, n, l)
+ #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
+ #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
+ #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
+ #define LISTEN(s, b) _win_listen(s, b)
+ #define RECV(s, b, l, f) _win_recv(s, b, l, f)
+ #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
+ #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
+ #define SEND(s, b, l, f) _win_send(s, b, l, f)
+ #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
+ #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
+ #define SHUTDOWN(s, h) _win_shutdown(s, h)
+ #define SOCKET(a, t, p) _win_socket(a, t, p)
+ #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
+ #define GETHOSTBYNAME(n) _win_gethostbyname(n)
+ #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n)
+ #define INSQUE(e, p) _win_insque(e, p)
+ #define REMQUE(e) _win_remque(e)
+ #define HSEARCH(i, a) _win_hsearch(i, a)
+ #define HCREATE(n) _win_hcreate(n)
+ #define HDESTROY() _win_hdestroy()
+ #define HSEARCH_R(i, a, r, h) _win_hsearch_r(i, a, r, h)
+ #define HCREATE_R(n, h) _win_hcreate_r(n, h)
+ #define HDESTROY_R(h) _win_hdestroy_r(h)
+ #define TSEARCH(k, r, c) _win_tsearch(k, r, c)
+ #define TFIND(k, r, c) _win_tfind(k, r, c)
+ #define TDELETE(k, r, c) _win_tdelete(k, r, c)
+ #define TWALK(r, a) _win_twalk(r, a)
+ #define TDESTROY(r, f) _win_tdestroy(r, f)
+ #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c)
+ #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c)
 #endif
 
 /* search.h */
@@ -665,7 +721,7 @@ extern "C"
 /* Prototype structure for a linked-list data structure.
    This is the type used by the `insque' and `remque' functions.  */
 
-  struct PLIBC_SEARCH_QELEM
+struct PLIBC_SEARCH_QELEM
   {
     struct qelem *q_forw;
     struct qelem *q_back;
@@ -674,41 +730,41 @@ extern "C"
 
 
 /* Insert ELEM into a doubly-linked list, after PREV.  */
-  void _win_insque (void *__elem, void *__prev);
+void _win_insque (void *__elem, void *__prev);
 
 /* Unlink ELEM from the doubly-linked list that it is in.  */
-  void _win_remque (void *__elem);
+void _win_remque (void *__elem);
 
 
 /* For use with hsearch(3).  */
-  typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *);
+typedef int (*PLIBC_SEARCH__compar_fn_t) (__const void *, __const void *);
 
-  typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t;
+typedef PLIBC_SEARCH__compar_fn_t _win_comparison_fn_t;
 
 /* Action which shall be performed in the call the hsearch.  */
-  typedef enum
+typedef enum
   {
     PLIBC_SEARCH_FIND,
     PLIBC_SEARCH_ENTER
   }
-  PLIBC_SEARCH_ACTION;
+PLIBC_SEARCH_ACTION;
 
-  typedef struct PLIBC_SEARCH_entry
+typedef struct PLIBC_SEARCH_entry
   {
     char *key;
     void *data;
   }
-  PLIBC_SEARCH_ENTRY;
+PLIBC_SEARCH_ENTRY;
 
 /* The reentrant version has no static variables to maintain the state.
    Instead the interface of all functions is extended to take an argument
    which describes the current status.  */
-  typedef struct _PLIBC_SEARCH_ENTRY
-  {
-    unsigned int used;
-    PLIBC_SEARCH_ENTRY entry;
-  }
-  _PLIBC_SEARCH_ENTRY;
+typedef struct _PLIBC_SEARCH_ENTRY
+{
+  unsigned int used;
+  PLIBC_SEARCH_ENTRY entry;
+}
+_PLIBC_SEARCH_ENTRY;
 
 
 /* Family of hash table handling functions.  The functions also
@@ -719,17 +775,16 @@ extern "C"
    ACTION is `FIND' return found entry or signal error by returning
    NULL.  If ACTION is `ENTER' replace existing data (if any) with
    ITEM.data.  */
-  PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item,
-                                    PLIBC_SEARCH_ACTION __action);
+PLIBC_SEARCH_ENTRY *_win_hsearch (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action);
 
 /* Create a new hashing table which will at most contain NEL elements.  */
-  int _win_hcreate (size_t __nel);
+int _win_hcreate (size_t __nel);
 
 /* Destroy current internal hashing table.  */
-  void _win_hdestroy (void);
+void _win_hdestroy (void);
 
 /* Data type for reentrant functions.  */
-  struct PLIBC_SEARCH_hsearch_data
+struct PLIBC_SEARCH_hsearch_data
   {
     struct _PLIBC_SEARCH_ENTRY *table;
     unsigned int size;
@@ -738,11 +793,10 @@ extern "C"
 
 /* Reentrant versions which can handle multiple hashing tables at the
    same time.  */
-  int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action,
-                      PLIBC_SEARCH_ENTRY ** __retval,
-                      struct PLIBC_SEARCH_hsearch_data *__htab);
-  int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab);
-  void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab);
+int _win_hsearch_r (PLIBC_SEARCH_ENTRY __item, PLIBC_SEARCH_ACTION __action, PLIBC_SEARCH_ENTRY **__retval,
+          struct PLIBC_SEARCH_hsearch_data *__htab);
+int _win_hcreate_r (size_t __nel, struct PLIBC_SEARCH_hsearch_data *__htab);
+void _win_hdestroy_r (struct PLIBC_SEARCH_hsearch_data *__htab);
 
 
 /* The tsearch routines are very interesting. They make many
@@ -750,54 +804,54 @@ extern "C"
    in node must be the "key" field, which points to the datum.
    Everything depends on that.  */
 /* For tsearch */
-  typedef enum
-  {
-    PLIBC_SEARCH_preorder,
-    PLIBC_SEARCH_postorder,
-    PLIBC_SEARCH_endorder,
-    PLIBC_SEARCH_leaf
-  }
-  PLIBC_SEARCH_VISIT;
+typedef enum
+{
+  PLIBC_SEARCH_preorder,
+  PLIBC_SEARCH_postorder,
+  PLIBC_SEARCH_endorder,
+  PLIBC_SEARCH_leaf
+}
+PLIBC_SEARCH_VISIT;
 
 /* Search for an entry matching the given KEY in the tree pointed to
    by *ROOTP and insert a new element if not found.  */
-  void *_win_tsearch (__const void *__key, void **__rootp,
-                      PLIBC_SEARCH__compar_fn_t __compar);
+void *_win_tsearch (__const void *__key, void **__rootp,
+          PLIBC_SEARCH__compar_fn_t __compar);
 
 /* Search for an entry matching the given KEY in the tree pointed to
    by *ROOTP.  If no matching entry is available return NULL.  */
-  void *_win_tfind (__const void *__key, void *__const * __rootp,
-                    PLIBC_SEARCH__compar_fn_t __compar);
+void *_win_tfind (__const void *__key, void *__const *__rootp,
+        PLIBC_SEARCH__compar_fn_t __compar);
 
 /* Remove the element matching KEY from the tree pointed to by *ROOTP.  */
-  void *_win_tdelete (__const void *__restrict __key, void **__restrict __rootp,
-                      PLIBC_SEARCH__compar_fn_t __compar);
+void *_win_tdelete (__const void *__restrict __key,
+          void **__restrict __rootp,
+          PLIBC_SEARCH__compar_fn_t __compar);
 
-  typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep,
-                                             PLIBC_SEARCH_VISIT __value,
-                                             int __level);
+typedef void (*PLIBC_SEARCH__action_fn_t) (__const void *__nodep, PLIBC_SEARCH_VISIT __value,
+             int __level);
 
 /* Walk through the whole tree and call the ACTION callback for every node
    or leaf.  */
-  void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action);
+void _win_twalk (__const void *__root, PLIBC_SEARCH__action_fn_t __action);
 
 /* Callback type for function to free a tree node.  If the keys are atomic
    data this function should do nothing.  */
-  typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep);
+typedef void (*PLIBC_SEARCH__free_fn_t) (void *__nodep);
 
 /* Destroy the whole tree, call FREEFCT for each node or leaf.  */
-  void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct);
+void _win_tdestroy (void *__root, PLIBC_SEARCH__free_fn_t __freefct);
 
 
 /* Perform linear search for KEY by comparing by COMPAR in an array
    [BASE,BASE+NMEMB*SIZE).  */
-  void *_win_lfind (__const void *__key, __const void *__base, size_t * __nmemb,
-                    size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
+void *_win_lfind (__const void *__key, __const void *__base,
+        size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
 
 /* Perform linear search for KEY by comparing by COMPAR function in
    array [BASE,BASE+NMEMB*SIZE) and insert entry if not found.  */
-  void *_win_lsearch (__const void *__key, void *__base, size_t * __nmemb,
-                      size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
+void *_win_lsearch (__const void *__key, void *__base,
+          size_t *__nmemb, size_t __size, PLIBC_SEARCH__compar_fn_t __compar);
 
 
 #ifdef __cplusplus
@@ -805,6 +859,6 @@ extern "C"
 #endif
 
 
-#endif                          //_PLIBC_H_
+#endif //_PLIBC_H_
 
 /* end of plibc.h */
-- 
1.7.4

Activities

LRN

2011-12-30 19:30

developer   ~0005218

0006-FPRINTFification.patch - converts fprintf() to FPRINTF(). For consistency's sake (i don't think it offers much in terms of UTF8ization; in fact, my new printf/scanf code for plibc is of questionable quality).

0007-FOPENCLOSEification.patch - much more useful, sinc new FOPEN implementation know how to handle UTF-8-encoded names. FCLOSE is added for consistency (you can use normal fclose).
0008-UTF8ization.patch - the rest of UTF8ization patch. Does string conversion for W32 (sometimes ugly, i probably should have made the appropriate plibc functions public...) where necessary, relies on plibc to give UTF-8 otherwise. One place where i'm not sure what to do is metadata insertion. I this patch only W32 inserts UTF-8-encoded filenames, other platforms insert C_STRING-formatted filenames. Maybe it should make all platforms insert with UTF8 format, regardless of the encoding, and let gnunet-fs-gtk do utf8 validation (it does anyway).

0009-Temporary-update-plibc-header.patch - temporary patch (i've had it, so why not upload it here?), which updates plibc.h header in gnunet. I'm not sure what is the normal way to update plibc.h, but it probably involves ndurner.

plibc UTF8ization patch is tracked here - http://sourceforge.net/tracker/?func=detail&aid=3465706&group_id=137319&atid=738312

Christian Grothoff

2011-12-30 23:47

manager   ~0005223

Patches applied, remaining minor issues fixed in SVN --18859.

Issue History

Date Modified Username Field Change
2011-12-30 19:21 LRN New Issue
2011-12-30 19:21 LRN Status new => assigned
2011-12-30 19:21 LRN Assigned To => NDurner
2011-12-30 19:22 LRN File Added: 0006-FPRINTFification.patch
2011-12-30 19:22 LRN File Added: 0007-FOPENCLOSEification.patch
2011-12-30 19:22 LRN File Added: 0008-UTF8ization.patch
2011-12-30 19:22 LRN File Added: 0009-Temporary-update-plibc-header.patch
2011-12-30 19:30 LRN Note Added: 0005218
2011-12-30 19:48 LRN Summary UTF8ization for GNUnet core package => [patch] UTF8ization for GNUnet core package
2011-12-30 23:47 Christian Grothoff Note Added: 0005223
2011-12-30 23:47 Christian Grothoff Status assigned => resolved
2011-12-30 23:47 Christian Grothoff Fixed in Version => 0.9.2
2011-12-30 23:47 Christian Grothoff Resolution open => fixed
2011-12-30 23:47 Christian Grothoff Assigned To NDurner => LRN
2011-12-31 00:15 Christian Grothoff Target Version => 0.9.2
2012-02-28 11:05 Christian Grothoff Status resolved => closed
2024-01-12 14:28 schanzen Category Win32 port => Win32 port (deprecated)