oslab/kernel/klib/printf.c
2023-02-11 16:48:16 +08:00

22 lines
369 B
C

#include "klib.h"
#include "serial.h"
void putstrn(const char *str, size_t count) {
for (int i = 0; i < count; ++i) {
putchar(str[i]);
}
}
void putstr(const char *str) {
putstrn(str, strlen(str));
}
int printf(const char *format, ...) {
int r;
va_list args;
va_start(args, format);
r = vcprintf(putstr, format, args);
va_end(args);
return r;
}