remove stdout/stderr calls
[compress.git] / code.c
diff --git a/code.c b/code.c
index d8ef5da72d2de038631a0e4c68c035f51511ebe3..67220e05b02dd97a390f25a7d49409da3872d840 100644 (file)
--- a/code.c
+++ b/code.c
@@ -1,10 +1,14 @@
+#include <stddef.h>
+#include <unistd.h>
+
 #include "debug.h"
+#include "fprintf.h"
 
 #include "code.h"
 
 /* concatenate code */
 
-int codcat (char *dst, size_t n, char *src)
+int codcat (char *dst, int n, char *src)
 {
     while ((*dst != 0) && (n > 0)) {
         n--;
@@ -32,9 +36,9 @@ int codcmp (char *cod1, char *cod2)
 
 /* copy code */
 
-int codcpy (char *dst, size_t n, char *src)
+int codcpy (char *dst, int n, char *src)
 {
-    size_t i;
+    int i;
 
     for (i = 0; i < n; i++) {
         dst[i] = src[i];
@@ -42,7 +46,7 @@ int codcpy (char *dst, size_t n, char *src)
             return i;
         }
     }
-    VERBOSE (ERROR, printf ("Buffer too short\n"));
+    VERBOSE (ERROR, fdprintf (STDOUT_FILENO, "Buffer too short\n"));
 
     return -1;
 }
@@ -60,4 +64,4 @@ int codlen (char *code)
     return i;
 }
 
-// vim: ts=4 sw=4 et
+/* vim: set ts=4 sw=4 et */