summaryrefslogtreecommitdiff
path: root/tests/lib/test_printfrr.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-01-05 16:23:23 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-01-14 11:57:46 +0100
commit2c5b4d80efc507f7244303d959f99af8061dacf3 (patch)
treea0435f4662282c8e0bdd228dc53932db8abc6631 /tests/lib/test_printfrr.c
parent176b254cb97c8d11e68d3ad8cce8f9e25d1d0189 (diff)
lib: add `s` option to `pI4`/`pI6`/`pIA` printfrr
Adding an `s` after these printfrr specifiers replaces 0.0.0.0 / :: in the output with a star (`*`). This is primarily intended for use with multicast, e.g. to print `(*,G)`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests/lib/test_printfrr.c')
-rw-r--r--tests/lib/test_printfrr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c
index 7694077574..55aa9bdefc 100644
--- a/tests/lib/test_printfrr.c
+++ b/tests/lib/test_printfrr.c
@@ -186,6 +186,10 @@ int main(int argc, char **argv)
test_va("VA [192.168.1.2 1234] --", "%pI4 %u", &ip, 1234);
+ inet_aton("0.0.0.0", &ip);
+ printchk("0.0.0.0", "%pI4", &ip);
+ printchk("*", "%pI4s", &ip);
+
snprintfrr(buf, sizeof(buf), "test%s", "#1");
csnprintfrr(buf, sizeof(buf), "test%s", "#2");
assert(strcmp(buf, "test#1test#2") == 0);