#include <time.h>
#include "../lib/sstring.h"
#include "../lib/stringbuf.h"
+#include "../lib/ccassert.h"
#include "../core/error.h"
+#include "chanserv_messages.h"
#define MAXARGS 10
#define CONVBUF 512
+void q9strftime(char *buf, size_t size, time_t t) {
+ strftime(buf, size, Q9_FORMAT_TIME, gmtime(&t));
+}
+
void q9vsnprintf(char *buf, size_t size, const char *format, const char *args, va_list ap) {
StringBuf b;
const char *p;
char *c;
+
char convbuf[MAXARGS][CONVBUF];
+ CCASSERT(CONVBUF > TIMELEN);
+
if(size == 0)
return;
break;
case 'T':
t = va_arg(ap, time_t);
- strftime(cb, 15, "%d/%m/%y %H:%M", gmtime(&t));
+ q9strftime(cb, CONVBUF, t);
break;
default:
/* calls exit(0) */
}
}
- b.buf = buf;
- b.capacity = size;
- b.len = 0;
+ sbinit(&b, buf, size);
for(p=format;*p;p++) {
if(*p != '$') {