tld_check_4(3)

πŸ’– tld_check_4 β€” the vibe check for your TLD code points πŸ’–

okay bestie, so this is tld_check_4(3), a lil function from libidn (that's GNU's Internationalized Domain Names library, iykyk). It's an API function. Let's get into it πŸ¦‹


✨ SYNOPSIS ✨

#include <tld.h>

int tld_check_4(const uint32_t * in, size_t inlen, size_t * errpos,
       const Tld_table ** overrides);

that's it. that's the whole signature. slay. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • const uint32_t * in β€” an array of unicode code points that we're gonna process. note that it does not need to be zero terminated, so don't stress about sticking a 0 on the end, she's fine fr fr.
  • size_t inlen β€” how many unicode code points are actually in that array. the count, the receipts, the number. ✨
  • size_t * errpos β€” the position of the offending character gets returned right here. so if something's sus, this is where you find out where. πŸ‘€
  • const Tld_table ** overrides β€” a Tld_table array of additional domain restriction structures that complement and supersede the built-in information. yes, supersede. she's got main character energy and she will override the defaults. πŸ’…

🌸 DESCRIPTION 🌸

so what does she actually do? okay so β€” she tests each of the code points in in, checking whether or not they're allowed by the info in overrides or by the built-in TLD restriction data. vibe check, but for domain names. 🫢

when data for the same TLD is available both internally and in overrides, the information in overrides takes precedence. overrides ate, no cap. and if several entries for a specific TLD are found, the first one is used. first come, first served, periodt. ✨

if overrides is NULL, then only the built-in information is used. no overrides, no problem. 😌

the position of the first offending character is returned in errpos. the first one. she's not gonna list all your crimes, just the first. πŸ’€

Return value: returns the Tld_rc value TLD_SUCCESS if all code points are valid, or when tld is null. returns TLD_INVALID if a character is not allowed. and she'll hand you additional error codes on general failure conditions. so like, check your return value bestie, don't just assume. 😭

😭 REPORTING BUGS 😭

found a bug? not the vibe, but okay, we handle it. report bugs to <help-libidn@gnu.org>.

general guidelines for reporting bugs live at: https://www.gnu.org/gethelp/

GNU Libidn home page, the mothership: https://www.gnu.org/software/libidn/ πŸ‘‘


Copyright Β© 2002-2026 Simon Josefsson.

copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. so like, go off, just keep the receipts. 🧚


🌈 SEE ALSO 🌈

the full documentation for libidn is maintained as a Texinfo manual. if the info and libidn programs are properly installed at your site, the command

info libidn

should give you access to the complete manual. go read it, it's giving educational. πŸ“š

as an alternative you may obtain the manual from:

https://www.gnu.org/software/libidn/manual/

and that's the whole page, bestie!! πŸ’– this was tld_check_4(3) from libidn, version 1.44. go forth and validate those code points, you absolute icon. πŸ‘‘βœ¨

πŸ“¦ where this page comes from