projects
/
libc-test
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
use t_setrlim in the run command
[libc-test]
/
src
/
common
/
print.c
1
#include <stdio.h>
2
#include <stdarg.h>
3
#include <unistd.h>
4
5
volatile int t_status = 0;
6
7
int t_printf(const char *s, ...)
8
{
9
va_list ap;
10
char buf[512];
11
int n;
12
13
t_status = 1;
14
va_start(ap, s);
15
n = vsnprintf(buf, sizeof buf, s, ap);
16
va_end(ap);
17
if (n < 0)
18
n = 0;
19
else if (n >= sizeof buf) {
20
n = sizeof buf;
21
buf[n - 1] = '\n';
22
buf[n - 2] = '.';
23
buf[n - 3] = '.';
24
buf[n - 4] = '.';
25
}
26
return write(1, buf, n);
27
}