DragonFly On-Line Manual Pages

Search: Section:  


idn_comparenames(3)   DragonFly Library Functions Manual   idn_comparenames(3)

NAME

idn_comparenames, idn_decodename2 - compare two internationzalized domain names

SYNOPSIS

#include <idn/api.h> idn_result_t idn_comparenames(idn_action_t actions, const char *name1, const char *name2); idn_result_t idn_comparenames2(idn_action_t actions1, const char *name1, idn_action_t actions2, const char *name2);

DESCRIPTION

The function idn_comparenames() encodes domain names name1 and name2 as idn_encodename() does, and then compares them. If they are equivalent, it returns idn_success. Otherwise, it returns idn_neq. When an error occurs in the encoding processes, the function returns the corresponding error code (see idn_result_tostring(3) for details). The function idn_comparenames2() works same as idn_comparenames(), but it performs actions1 when it encodes name1 and it performs actions2 when it encodes name2 respectively. In addition with action macros for idn_encodename() (e.g. IDN_UNICODECONV), the following macros are available for idn_comparenames() and idn_comparenames2(). IDN_COMPARE_REGIST Encode a domain name with IDNA2008 registration protocol, before comparison. Currently, its value is the same as IDN_ENCODE_REGIST. IDN_COMPARE_LOOKUP Encode a domain name with IDNA2008 lookup protocol, before comparison. Currently, its value is the same as IDN_ENCODE_LOOKUP.

EXAMPLES

The program below shows an example of idn_comparenames(). idn_result_t r; ... r = idn_comparenames(IDN_COMPARE_LOOKUP, name1, name2); if (r == idn_success) fprintf(stderr, "'%s' == '%s'\n", name1, name2); else if (r == idn_neq) fprintf(stderr, "'%s' != '%s'\n", name1, name2); else fprintf(stderr, "error: %s\n", idn_result_tostring(r)); ...

SEE ALSO

idncmp(1), libidnkit(3), idn_encodename(3), idn_nameinit(3), idn_result_tostring(3), idn.conf(5) September 21, 2012 idn_comparenames(3)

Search: Section: