4 int main(int argc
, char **argv
)
8 "'%%%.*s,%x,%05X,%u,%i,% 4d,%3d,%c,%3d'", \
9 5, "Hello, World!", 27, 27, -1, -1, 1, 5, ':', 1234
11 if (argc
== 5 && !strcmp(argv
[1], "regsub")) {
12 struct strbuf buf
= STRBUF_INIT
;
14 strbuf_addstr(&buf
, argv
[3]);
15 if (strbuf_regsub(&buf
, argv
[2], argv
[4], REG_EXTENDED
))
17 printf("Substituting '%s' in '%s' by '%s': '%s'\n",
18 argv
[2], argv
[3], argv
[4], buf
.buf
);
24 strbuf_initf(&buf
, TEST_FORMAT
);
25 printf("result=%s\n", buf
.buf
);
26 printf("expect=" TEST_FORMAT
);