From 89b7b67a13ebb7965cc7f13ad0595e2194a2d34c Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:48:04 +0200 Subject: add sqmail-4.2.29a --- src/ipmeprint.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/ipmeprint.c (limited to 'src/ipmeprint.c') diff --git a/src/ipmeprint.c b/src/ipmeprint.c new file mode 100644 index 0000000..6379219 --- /dev/null +++ b/src/ipmeprint.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include "buffer.h" +#include "ip.h" +#include "ipme.h" +#include "exit.h" +#include "fmt.h" + +char ipaddr[IPFMT]; + +int main() +{ + int j; + + switch (ipme_init()) { + case 0: buffer_putsflush(buffer_2,"out of memory\n"); _exit(111); + case -1: buffer_putsflush(buffer_2,"hard error\n"); _exit(100); + } + + for (j = 0;j < ipme.len;++j) { + switch (ipme.ix[j].af) { + case AF_INET: + buffer_put(buffer_1,ipaddr,ip4_fmt(ipaddr,&ipme.ix[j].addr.ip4.d)); + break; + case AF_INET6: + buffer_put(buffer_1,ipaddr,ip6_fmt(ipaddr,&ipme.ix[j].addr.ip6.d)); + break; + default: + buffer_puts(buffer_1,"Unknown address family = "); + buffer_put(buffer_1,ipaddr,fmt_ulong(ipaddr,ipme.ix[j].af)); + } + buffer_puts(buffer_1,"\n"); + } + + buffer_flush(buffer_1); + _exit(0); +} -- cgit v1.2.3