After looking at Debian's 'dnsdomainname' tool and reading its man
page, I believe that sharing code with InetUtils hostname.c make no
sense. None of the other parameters applies to that tool, and they
would only be confusing. Thus here is a completely new tool. What
do you think? Please review and we can hopefully work towards
pushing this eventually.
Regarding the option names, is there anything similar on BSD? Are the
option names different there?
One thing that strikes me is that possibly the tool should fail rather
than printing "(none)".
What happens on Debian?
Another idea is that it should use getaddrinfo
instead of gethostbyname. Thoughts?
No strong opinion, Mats has been replacing gethostbyname usage with
getaddrinfo anyway. Using the same type of code all over the place
makes sense.
Maybe a small test case?
--- /dev/null
+++ b/src/dnsdomainname.c
@@ -0,0 +1,75 @@
...
+ ht = gethostbyname (host_name);
+ if (ht == NULL)
+ {
+ puts ("(none)");
+ return EXIT_SUCCESS;
exit (EXIT_SUCCESS); please.