diff --git a/client/client.c b/client/client.c
index 56d79fc..1dee391 100644
--- a/client/client.c
+++ b/client/client.c
@@ -257,24 +257,31 @@ server_connect(void)
 }
 
 
-#define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
+#define PRINTF_FP(LEN, FP, PARGS...) do { if (!skip_input) len = fprintf(FP, PARGS); } while(0)
+#define PRINTF(LEN, PARGS...) PRINTF_FP(LEN, stdout, PARGS)
 
 static void
-server_got_reply(char *x)
+server_got_reply(const char *x)
 {
-  int code;
+  static int code = 0;
   int len = 0;
 
   if (*x == '+')                        /* Async reply */
     PRINTF(len, ">>> %s\n", x+1);
   else if (x[0] == ' ')                 /* Continuation */
-    PRINTF(len, "%s%s\n", verbose ? "     " : "", x+1);
+  {
+    PRINTF_FP(len, ((code >= 8000) ? stderr : stdout),
+              "%s%s\n", verbose ? "     " : "", x+1);
+  }
   else if (strlen(x) > 4 &&
            sscanf(x, "%d", &code) == 1 && code >= 0 && code < 10000 &&
            (x[4] == ' ' || x[4] == '-'))
     {
       if (code)
-        PRINTF(len, "%s\n", verbose ? x : x+5);
+      {
+        PRINTF_FP(len, ((code >= 8000) ? stderr : stdout),
+                  "%s\n", verbose ? x : x+5);
+      }
 
       if (x[4] == ' ')
       {
