diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 15:52:39 +0200 |
commit | a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f (patch) | |
tree | b88cc7a8457658d67e0321718556ac807f6bccf3 /src/ipmeprint.c | |
parent | 00be7622c428f279872f84569f098ce16150f8a8 (diff) |
format files
Diffstat (limited to 'src/ipmeprint.c')
-rw-r--r-- | src/ipmeprint.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/src/ipmeprint.c b/src/ipmeprint.c index 6379219..9c92138 100644 --- a/src/ipmeprint.c +++ b/src/ipmeprint.c @@ -1,39 +1,37 @@ -#include <sys/types.h> -#include <sys/socket.h> #include <netinet/in.h> +#include <sys/socket.h> +#include <sys/types.h> #include <unistd.h> + #include "buffer.h" -#include "ip.h" -#include "ipme.h" #include "exit.h" #include "fmt.h" +#include "ip.h" + +#include "ipme.h" char ipaddr[IPFMT]; int main() { - int j; + 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); - } + 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"); - } + 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); + buffer_flush(buffer_1); + _exit(0); } |