Cleaned up some of the comments ... removed vestiges of last year's doxygen experiment
[citadel.git] / webcit / snprintf.c
index 7c8f2b92cd4bb008465b20d0f983b1654c36d600..37cc5293bd5412f9d3b301149f58561e2a472e05 100644 (file)
@@ -1,12 +1,9 @@
 /*
- * modified from Sten Gunterberg's BUGTRAQ post of 22 Jul 1997
- * --nathan bryant <bryant@cs.usm.maine.edu>
- *
  * $Id$
  */
 
-/*
- * Replacements for snprintf() and vsnprintf()
+/**
+ *  Replacements for snprintf() and vsnprintf()
  *
  * Use it only if you have the "spare" cycles needed to effectively
  * do every snprintf operation twice! Why is that? Because everything
  * Written July 1997 by Sten Gunterberg (gunterberg@ergon.ch)
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
+#include "webcit.h"
 #include "webserver.h"
 
+/**
+ *  is it needed????
+ *  fmt the formatstring?
+ *  argp how many params?
+ */
 static int needed(const char *fmt, va_list argp)
 {
        static FILE *sink = NULL;
 
-       /* ok, there's a small race here that could result in the sink being
+       /**
+        * ok, there's a small race here that could result in the sink being
         * opened more than once if we're threaded, but I'd rather ignore it than
         * spend cycles synchronizing :-) */
 
@@ -45,6 +45,13 @@ static int needed(const char *fmt, va_list argp)
        return vfprintf(sink, fmt, argp);
 }
 
+/**
+ *  vsnprintf wrapper
+ *  buf the output charbuffer
+ *  max maximal size of the buffer
+ *  fmt the formatstring (see man printf)
+ *  argp the variable argument list 
+ */
 int vsnprintf(char *buf, size_t max, const char *fmt, va_list argp)
 {
        char *p;
@@ -57,12 +64,19 @@ int vsnprintf(char *buf, size_t max, const char *fmt, va_list argp)
        if ((size = vsprintf(p, fmt, argp)) >= max)
                size = -1;
 
-       safestrncpy(buf, p, max);
+       strncpy(buf, p, max);
        buf[max - 1] = 0;
        free(p);
        return size;
 }
 
+/**
+ *  snprintf wrapper
+ *  buf the output charbuffer
+ *  max maximal size of the buffer
+ *  fmt the formatstring (see man printf)
+ *  ... the variable argument list 
+ */
 int snprintf(char *buf, size_t max, const char *fmt,...)
 {
        va_list argp;
@@ -74,3 +88,5 @@ int snprintf(char *buf, size_t max, const char *fmt,...)
 
        return bytes;
 }
+
+