Would it be possible to check a domain name its existence by checking the output of "dig"? Inside the bind sources I found these constants:
0 DNS_R_NOEROR
1 DNS_R_FORMERR
2 DNS_R_SERVFAIL
3 DNS_R_NXDOMAIN
4 DNS_R_NOTIMP
5 DNS_R_REFUSED
6 DNS_R_YXDOMAIN
7 DNS_R_YXRRSET
8 DNS_R_NXRRSET
9 DNS_R_NOTAUTH
10 DNS_R_NOTZONE
16 DNS_R_BADVERS
<RCODE 11> # 11 has no macro
<RCODE 12> # 12 has no macro
<RCODE 13> # 13 has no macro
<RCODE 14> # 14 has no macro
<RCODE 15> # 15 has no macro
In my opinion NOERROR & SERVFAIL means the hostname exists (although it doesn't mean an ip is linked to it). NXDOMAIN would mean it absolutely not exists.
I prefer not to use whois because it is quite slow. dig is much faster as I just need to be certain that the hostname doesn't exist yet.
Could someone shine their light on my assumptions and the other macros?
Thanks