]> code.citadel.org Git - citadel.git/blobdiff - citadel/snprintf.c
* Changed the comments at the beginning of each file to a consistent format
[citadel.git] / citadel / snprintf.c
index 693a2592e80fb9c591b8982be6032b60dc5c93a9..dcc9cd81cc8879c94d5d2ca810c993c9c8376cf8 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * modified from Sten Gunterberg's BUGTRAQ post of 22 Jul 1997
- * --nathan bryant <bryant@cs.usm.maine.edu>
- */
-
-/*
+ * $Id$
+ *
  * Replacements for snprintf() and vsnprintf()
  *
+ * modified from Sten Gunterberg's BUGTRAQ post of 22 Jul 1997
+ * --nathan bryant <nathan@designtrust.com>
+ *
  * Use it only if you have the "spare" cycles needed to effectively
  * do every snprintf operation twice! Why is that? Because everything
  * is first vfprintf()'d to /dev/null to determine the number of bytes.
@@ -46,19 +46,6 @@ needed (const char *fmt, va_list argp)
   return vfprintf(sink, fmt, argp);
 }
 
-int
-snprintf (char *buf, size_t max, const char *fmt, ...)
-{
-  va_list argp;
-  int bytes;
-
-  va_start(argp, fmt);
-  bytes = vsnprintf(buf, max, fmt, argp);
-  va_end(argp);
-
-  return bytes;
-}
-
 int
 vsnprintf (char *buf, size_t max, const char *fmt, va_list argp)
 {
@@ -79,3 +66,16 @@ vsnprintf (char *buf, size_t max, const char *fmt, va_list argp)
   free(p);
   return size;
 }
+
+int
+snprintf (char *buf, size_t max, const char *fmt, ...)
+{
+  va_list argp;
+  int bytes;
+
+  va_start(argp, fmt);
+  bytes = vsnprintf(buf, max, fmt, argp);
+  va_end(argp);
+
+  return bytes;
+}