1#include <stdio.h>
2#include <string.h>
3
4static char buf[32768];
5static const char expected[] = "\
6\n\
7a\n\
8abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
9
10static int
11do_test (void)
12{
13 snprintf (s: buf, maxlen: sizeof (buf),
14 format: "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
15 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
16 "a", "b", "c", "d", 5);
17 return strcmp (buf, expected) != 0;
18}
19
20#define TEST_FUNCTION do_test ()
21#include "../test-skeleton.c"
22

source code of glibc/stdio-common/bug23.c