repo.or.cz
/
thunix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Implement user space's printf stuff
[thunix.git]
/
user
/
printf.c
blob
244da7af1837fcbb5b9db4cf43015fb550fc9331
1
/**
2
* thunix/lib/printf.c
3
*
4
* the printf function for user space programs
5
*
6
*/
7
#include <stdio.h>
8
#include <stdarg.h>
9
#include <stddef.h>
10
#include <unistd.h>
11
12
int
printf
(
const char
*
fmt
, ...)
13
{
14
char
buf
[
1024
];
15
va_list
args
;
16
int
i
;
17
18
va_start
(
args
,
fmt
);
19
i
=
vsprintf
(
buf
,
fmt
,
args
);
20
va_end
(
args
);
21
22
conwrite
(
buf
);
23
24
return
i
;
25
}
26
27
int
sprintf
(
char
*
buf
,
const char
*
fmt
, ...)
28
{
29
va_list
args
;
30
int
i
;
31
32
va_start
(
args
,
fmt
);
33
i
=
vsprintf
(
buf
,
fmt
,
args
);
34
va_end
(
args
);
35
36
return
i
;
37
}