mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-30 01:02:29 +00:00
Support printf %n directive
This commit is contained in:
parent
c1a0b017e9
commit
01b09bc817
8 changed files with 21 additions and 8 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "libc/log/log.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/mem/gc.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/xasprintf.h"
|
||||
|
@ -431,3 +432,10 @@ TEST(fmt, regress) {
|
|||
"User-Agent: hurl/1.o (https://github.com/jart/cosmopolitan)\r\n",
|
||||
buf);
|
||||
}
|
||||
|
||||
TEST(fmt, n) {
|
||||
int n;
|
||||
char buf[8];
|
||||
snprintf(buf, 8, ".%c%c.%n", 0, 1, &n);
|
||||
ASSERT_EQ(4, n);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue