summaryrefslogtreecommitdiff
path: root/user/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'user/printf.c')
-rw-r--r--user/printf.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/user/printf.c b/user/printf.c
index f3b3282..5c5c782 100644
--- a/user/printf.c
+++ b/user/printf.c
@@ -49,13 +49,11 @@ printptr(int fd, uint64 x) {
// Print to the given fd. Only understands %d, %x, %p, %s.
void
-printf(int fd, const char *fmt, ...)
+vprintf(int fd, const char *fmt, va_list ap)
{
- va_list ap;
char *s;
int c, i, state;
- va_start(ap, fmt);
state = 0;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
@@ -95,3 +93,21 @@ printf(int fd, const char *fmt, ...)
}
}
}
+
+void
+fprintf(int fd, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fd, fmt, ap);
+}
+
+void
+printf(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(1, fmt, ap);
+}