From a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:52:39 +0200 Subject: format files --- src/dnsfq.c | 55 +++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'src/dnsfq.c') diff --git a/src/dnsfq.c b/src/dnsfq.c index a174541..65c49fe 100644 --- a/src/dnsfq.c +++ b/src/dnsfq.c @@ -1,61 +1,60 @@ -#include #include +#include #include + #include "buffer.h" -#include "stralloc.h" #include "dnsresolv.h" -#include "dns.h" -#include "ip.h" #include "exit.h" +#include "ip.h" #include "logmsg.h" +#include "stralloc.h" + +#include "dns.h" -#define WHO "dnsfq" +#define WHO "dnsfq" #define MAXCNAME 10 stralloc ca = {0}; stralloc sa = {0}; stralloc ia = {0}; -int main(int argc,char **argv) +int main(int argc, char **argv) { int i, r; char ip4str[IP4_FMT]; char ip6str[IP6_FMT]; - if (!argv[1]) - logmsg(WHO,100,USAGE,"dnsfq fqdn"); + if (!argv[1]) logmsg(WHO, 100, USAGE, "dnsfq fqdn"); - if (!stralloc_copys(&sa,argv[1])) - logmsg(WHO,111,FATAL,"out of memory"); + if (!stralloc_copys(&sa, argv[1])) logmsg(WHO, 111, FATAL, "out of memory"); DNS_INIT - buffer_put(buffer_1,sa.s,sa.len); - buffer_puts(buffer_1," "); + buffer_put(buffer_1, sa.s, sa.len); + buffer_puts(buffer_1, " "); for (i = 0; i <= MAXCNAME; i++) { - if ((r = dns_cname(&ca,&sa)) < 0) _exit(1); + if ((r = dns_cname(&ca, &sa)) < 0) _exit(1); if (r > 0) { - if (!stralloc_copy(&sa,&ca)) - logmsg(WHO,111,FATAL,"out of memory"); - buffer_puts(buffer_1,"-> "); - buffer_put(buffer_1,sa.s,sa.len); - buffer_puts(buffer_1," "); - } - else break; + if (!stralloc_copy(&sa, &ca)) logmsg(WHO, 111, FATAL, "out of memory"); + buffer_puts(buffer_1, "-> "); + buffer_put(buffer_1, sa.s, sa.len); + buffer_puts(buffer_1, " "); + } else + break; } - buffer_putsflush(buffer_1,"\n"); + buffer_putsflush(buffer_1, "\n"); - if ((i = dns_ip6(&ia,&sa)) > 0) { + if ((i = dns_ip6(&ia, &sa)) > 0) { for (i = 0; i + 16 <= ia.len; i += 16) { if (ip6_isv4mapped(ia.s + i)) continue; - buffer_put(buffer_1,ip6str,ip6_fmt(ip6str,ia.s + i)); - buffer_puts(buffer_1,"\n"); + buffer_put(buffer_1, ip6str, ip6_fmt(ip6str, ia.s + i)); + buffer_puts(buffer_1, "\n"); } } - if ((i = dns_ip4(&ia,&sa)) > 0) { - for (i = 0; i + 4 <= ia.len;i += 4) { - buffer_put(buffer_1,ip4str,ip4_fmt(ip4str,ia.s + i)); - buffer_puts(buffer_1,"\n"); + if ((i = dns_ip4(&ia, &sa)) > 0) { + for (i = 0; i + 4 <= ia.len; i += 4) { + buffer_put(buffer_1, ip4str, ip4_fmt(ip4str, ia.s + i)); + buffer_puts(buffer_1, "\n"); } } buffer_flush(buffer_1); -- cgit v1.2.3