fix: kvprintf, add return value
This commit is contained in:
parent
a4350fa686
commit
203cca8dff
@ -24,13 +24,14 @@ int kvprintf(int level, const char *restrict format, va_list ap)
|
|||||||
const char *start = format;
|
const char *start = format;
|
||||||
const char *flag;
|
const char *flag;
|
||||||
long padding;
|
long padding;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
while (*start != '\0') {
|
while (*start != '\0') {
|
||||||
flag = strchr(start, '%');
|
flag = strchr(start, '%');
|
||||||
if (flag != NULL) {
|
if (flag != NULL) {
|
||||||
padding = atoll(start + 1);
|
padding = atoll(start + 1);
|
||||||
for (; isdigit(*padding); padding++);
|
for (; isdigit(*padding); padding++);
|
||||||
print_flag(*padding, ap);
|
ret += print_flag(*padding, ap);
|
||||||
start = padding + 1;
|
start = padding + 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -38,4 +39,5 @@ int kvprintf(int level, const char *restrict format, va_list ap)
|
|||||||
start += strlen(start);
|
start += strlen(start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user