summaryrefslogtreecommitdiffstats
path: root/catsprintf.c
blob: e0914c42c1f7a2c8fe1440385573e63012b140f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "catsprintf.h"

int catsprintf(char *buf, const char *format, ...) {
  static int i = 0;

  va_list arg; /*will point to each unnamed argument in turn*/
  va_start(arg, format); /* point to first element after fmt*/


  char b[8192];
  int c = vsprintf (b, format, arg);
  i += strlen(b);
  //printf("%d %s (%d)\n", i, b, strlen(b));

  strcat(buf, b);

  va_end(arg); /*cleanup*/

  return c;
}