s/qmail 4.2.29a
Next generation secure email transport
Loading...
Searching...
No Matches
dnsptr.c
Go to the documentation of this file.
1#include <unistd.h>
2#include "buffer.h"
3#include "stralloc.h"
4#include "str.h"
5#include "dnsresolv.h"
6#include "dns.h"
7#include "ip.h"
8#include "exit.h"
9#include "logmsg.h"
10
11#define WHO "dnsptr"
12
13stralloc out = {0};
14char ip4[4];
15char ip6[16];
16
17int main(int argc,char **argv)
18{
19 if (!argv[1])
20 logmsg(WHO,100,USAGE,"dnsptr ipv4 || ipv6 (compactified)");
21
23 if (str_chr(argv[1],':') < str_len(argv[1])) {
24 if (!ip6_scan(argv[1],ip6))
25 logmsg(WHO,111,FATAL,"wrong IPv6 format");
26 if (dns_name6(&out,ip6) > 0)
27 buffer_put(buffer_1,out.s,out.len);
28 } else {
29 if (!ip4_scan(argv[1],ip4))
30 logmsg(WHO,111,FATAL,"wrong IPv4 format");
31 if (dns_name4(&out,ip4) > 0)
32 buffer_put(buffer_1,out.s,out.len);
33 }
34 buffer_putsflush(buffer_1,"\n");
35
36 _exit(0);
37}
int main()
Definition: chkshsgr.c:6
#define DNS_INIT
Definition: dns.h:12
char ip6[16]
Definition: dnsptr.c:15
stralloc out
Definition: dnsptr.c:13
char ip4[4]
Definition: dnsptr.c:14
#define WHO
Definition: dnsptr.c:11
void _exit()