summaryrefslogtreecommitdiff
path: root/user/printf.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-08-27 13:13:03 -0400
committerRobert Morris <[email protected]>2019-08-27 13:13:03 -0400
commit64b93d175ac6eb739036b394fbb0766fbf06f5b7 (patch)
tree7914971346f770276a307763449700353a5003c1 /user/printf.c
parenta3f6d9fd1e21a7339f2bc26f185f7d561bc370c4 (diff)
downloadxv6-labs-64b93d175ac6eb739036b394fbb0766fbf06f5b7.tar.gz
xv6-labs-64b93d175ac6eb739036b394fbb0766fbf06f5b7.tar.bz2
xv6-labs-64b93d175ac6eb739036b394fbb0766fbf06f5b7.zip
user printf(1 -> printf(
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);
+}