diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 13:58:20 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 13:58:20 +0200 |
commit | 249866e3d1e11dc72eaa1305f4bb479ded92ef38 (patch) | |
tree | 7118c5f58e29fe61c100e4d067bb90ba8d52589e /dnsstub/dns_dtda.c | |
parent | 96cf8dffe4f7b0b910f790066ae622dc429eb522 (diff) |
reorganized file structure
Moved c files into src/.
Corrected VERSION file.
Removed BUILD and FILES.
Diffstat (limited to 'dnsstub/dns_dtda.c')
-rw-r--r-- | dnsstub/dns_dtda.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/dnsstub/dns_dtda.c b/dnsstub/dns_dtda.c deleted file mode 100644 index 38358a2..0000000 --- a/dnsstub/dns_dtda.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "stralloc.h" -#include "dnsresolv.h" - -/** - @file dns_dtda.c - @author djb - @source ucspi-tcp - @brief domain to dot append -*/ - -int dns_domain_todot_cat(stralloc *out,const char *d) -{ - char ch; - char ch2; - unsigned char ch3; - char buf[4]; - - if (!*d) - return stralloc_append(out,"."); - - for (;;) { - ch = *d++; - while (ch--) { - ch2 = *d++; - if ((ch2 >= 'A') && (ch2 <= 'Z')) ch2 += 32; // FQDN -> lowercase - if (((ch2 >= 'a') && (ch2 <= 'z')) || - ((ch2 >= '0') && (ch2 <= '9')) || - (ch2 == '-') || (ch2 == '_')) { - if (!stralloc_append(out,&ch2)) return DNS_MEM; - } - else { // decimal -> octal - ch3 = ch2; - buf[3] = '0' + (ch3 & 7); ch3 >>= 3; - buf[2] = '0' + (ch3 & 7); ch3 >>= 3; - buf[1] = '0' + (ch3 & 7); - buf[0] = '\\'; - if (!stralloc_catb(out,buf,4)) return DNS_MEM; - } - } - if (!*d) return 1; - if (!stralloc_append(out,".")) return DNS_MEM; - } -} |