blob: 01727c47e2a06dc4d472352b80c00538a62356e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
size_t min(size_t a, size_t b) {
return (a < b) ? a : b;
}
int vdprintf(int fd, const char *format, va_list ap) {
FILE f = {
.write = write_fd,
.fd = fd,
.fflush = fflush_fd,
.write_buffer = NULL,
.read_buffer = NULL,
};
int rc = vfprintf(&f, format, ap);
free(f.write_buffer);
free(f.read_buffer);
return rc;
}
|