1) Moved tprintf and related functions to their own file in common/libc/printf/tprintf.c.
This file is included by both libc and hostcompat. 2) Changed printf -> tprintf in all testbin programs
This commit is contained in:
@@ -10,7 +10,8 @@ COMMON=$(TOP)/common/libc
|
||||
# printf
|
||||
SRCS+=\
|
||||
$(COMMON)/printf/__printf.c \
|
||||
$(COMMON)/printf/snprintf.c
|
||||
$(COMMON)/printf/snprintf.c \
|
||||
$(COMMON)/printf/tprintf.c
|
||||
|
||||
# stdio
|
||||
SRCS+=\
|
||||
|
@@ -78,56 +78,3 @@ vprintf(const char *fmt, va_list ap)
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* printf variant that is quiet during automated testing */
|
||||
int
|
||||
tprintf(const char *fmt, ...)
|
||||
{
|
||||
int chars;
|
||||
va_list ap;
|
||||
|
||||
if (strcmp(KERNEL_SECRET, "") != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
chars = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* printf variant that is loud during automated testing */
|
||||
int
|
||||
nprintf(const char *fmt, ...)
|
||||
{
|
||||
int chars;
|
||||
va_list ap;
|
||||
|
||||
if (strcmp(KERNEL_SECRET, "") == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
chars = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* printf variant that prepends the kernel secret */
|
||||
int
|
||||
printsf(const char *fmt, ...)
|
||||
{
|
||||
int chars;
|
||||
va_list ap;
|
||||
|
||||
if (strcmp(KERNEL_SECRET, "") != 0) {
|
||||
printf("%s: ", KERNEL_SECRET);
|
||||
}
|
||||
va_start(ap, fmt);
|
||||
chars = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
Reference in New Issue
Block a user