mirror of https://github.com/tailix/libkernaux.git
Implement %% formatter
This commit is contained in:
parent
0eb355f1fa
commit
771d0336ca
|
@ -192,7 +192,10 @@ void kernaux_printf_va(
|
|||
break;
|
||||
}
|
||||
|
||||
if (formatter.type == TYPE_s) {
|
||||
if (formatter.type == TYPE_PERCENT) {
|
||||
putchar('%');
|
||||
}
|
||||
else if (formatter.type == TYPE_s) {
|
||||
const char *const arg = va_arg(va, char*);
|
||||
|
||||
for (const char *arg_ptr = arg; *arg_ptr; ++arg_ptr) {
|
||||
|
|
|
@ -42,6 +42,7 @@ int main()
|
|||
test("Hello, World!", "Hello, World!");
|
||||
test("Hello, Alex!", "Hello, %s!", "Alex");
|
||||
test("Hello, Alex!", "Hello, %c%c%c%c!", 'A', 'l', 'e', 'x');
|
||||
test("%", "%%");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue