aboutsummaryrefslogtreecommitdiff
path: root/common.c
blob: b17798705c571038557422a0fb6e0bc4b4447705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "config.h"
#include <stdarg.h>
#include <strings.h>
#include <unistd.h>

// wrapper for write
void writef(char *format, ...)
{
    va_list args;
    char buf[BUF_MAX + 1];
    va_start(args, format);

    vsnprintf(buf, sizeof(buf), format, args);
    va_end(args);

    int n = 0;
    while (*(buf + n) != 0)
        n++;
    write(0, buf, n);
}