summaryrefslogtreecommitdiff
path: root/src/dnscname.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
commit89b7b67a13ebb7965cc7f13ad0595e2194a2d34c (patch)
tree25efd77a90ae87236e6730d8ea3846bbe0fd126f /src/dnscname.c
add sqmail-4.2.29asqmail-4.2
Diffstat (limited to 'src/dnscname.c')
-rw-r--r--src/dnscname.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/dnscname.c b/src/dnscname.c
new file mode 100644
index 0000000..546d273
--- /dev/null
+++ b/src/dnscname.c
@@ -0,0 +1,32 @@
+#include <unistd.h>
+#include "buffer.h"
+#include "stralloc.h"
+#include "dnsresolv.h"
+#include "exit.h"
+#include "dns.h"
+#include "logmsg.h"
+
+#define WHO "dnscname"
+
+stralloc sa = {0};
+stralloc out = {0};
+
+int main(int argc,char **argv)
+{
+ int r;
+
+ if (!argv[1])
+ logmsg(WHO,100,USAGE,"dnscname fqdn");
+
+ if (!stralloc_copys(&sa,argv[1]))
+ logmsg(WHO,111,FATAL,"out of memory");
+
+ DNS_INIT
+ if ((r = dns_cname(&out,&sa)) < 0) _exit(1);
+ if (r > 0) {
+ buffer_putflush(buffer_1,out.s,out.len);
+ buffer_putsflush(buffer_1,"\n");
+ }
+
+ _exit(0);
+}