summaryrefslogtreecommitdiff
path: root/sqmail-4.3.07/src/ipmeprint.c
diff options
context:
space:
mode:
authorErwin Hoffmann <feh@fehcom.de>2024-01-14 17:55:54 +0100
committerErwin Hoffmann <feh@fehcom.de>2024-01-14 17:55:54 +0100
commita293489ee83c8b05d845a162dc2a4de026f3775d (patch)
treed50ab15afde698ad2d32bfc251753e5e89204f25 /sqmail-4.3.07/src/ipmeprint.c
s/qmail 4.3.07
Diffstat (limited to 'sqmail-4.3.07/src/ipmeprint.c')
-rw-r--r--sqmail-4.3.07/src/ipmeprint.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/sqmail-4.3.07/src/ipmeprint.c b/sqmail-4.3.07/src/ipmeprint.c
new file mode 100644
index 0000000..6379219
--- /dev/null
+++ b/sqmail-4.3.07/src/ipmeprint.c
@@ -0,0 +1,39 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#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);
+}