A LOT updates. Cannot separate. :)
[silc.git] / lib / silcutil / silcutil.c
index f413b1c130f6fb384e9489bb57ac9609ee7b05d9..81b5afe2e41fc76345850024037b214f8a7e1a4c 100644 (file)
@@ -528,3 +528,19 @@ void silc_parse_command_line(unsigned char *buffer,
 
   *parsed_num = argc;
 }
+
+/* Formats arguments to a string and returns it after allocating memory
+   for it. It must be remembered to free it later. */
+
+char *silc_format(char *fmt, ...)
+{
+  va_list args;
+  static char buf[8192];
+
+  memset(buf, 0, sizeof(buf));
+  va_start(args, fmt);
+  vsnprintf(buf, sizeof(buf) - 1, fmt, args);
+  va_end(args);
+
+  return strdup(buf);
+}