blob: 637921947451c36925bfb679d725bce5173e9a1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
}
|