diff options
Diffstat (limited to 'lib/libc/nameser/ns_samedomain.c')
-rw-r--r-- | lib/libc/nameser/ns_samedomain.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/lib/libc/nameser/ns_samedomain.c b/lib/libc/nameser/ns_samedomain.c index a720f6a..f532e8b 100644 --- a/lib/libc/nameser/ns_samedomain.c +++ b/lib/libc/nameser/ns_samedomain.c @@ -16,8 +16,10 @@ */ #ifndef lint -static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 sra Exp $"; +static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.2.4.2 2004/03/16 12:34:17 marka Exp $"; #endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include "port_before.h" @@ -28,22 +30,21 @@ static const char rcsid[] = "$Id: ns_samedomain.c,v 1.5.18.1 2005/04/27 05:01:09 #include "port_after.h" -/*% +/* + * int + * ns_samedomain(a, b) * Check whether a name belongs to a domain. - * * Inputs: - *\li a - the domain whose ancestory is being verified - *\li b - the potential ancestor we're checking against - * + * a - the domain whose ancestory is being verified + * b - the potential ancestor we're checking against * Return: - *\li boolean - is a at or below b? - * + * boolean - is a at or below b? * Notes: - *\li Trailing dots are first removed from name and domain. + * Trailing dots are first removed from name and domain. * Always compare complete subdomains, not only whether the * domain name is the trailing string of the given name. * - *\li "host.foobar.top" lies in "foobar.top" and in "top" and in "" + * "host.foobar.top" lies in "foobar.top" and in "top" and in "" * but NOT in "bar.top" */ @@ -141,39 +142,42 @@ ns_samedomain(const char *a, const char *b) { return (strncasecmp(cp, b, lb) == 0); } -/*% +#ifndef _LIBC +/* + * int + * ns_subdomain(a, b) * is "a" a subdomain of "b"? */ int ns_subdomain(const char *a, const char *b) { return (ns_samename(a, b) != 1 && ns_samedomain(a, b)); } +#endif -/*% +/* + * int + * ns_makecanon(src, dst, dstsize) * make a canonical copy of domain name "src" - * * notes: - * \code * foo -> foo. * foo. -> foo. * foo.. -> foo. * foo\. -> foo\.. * foo\\. -> foo\\. - * \endcode */ int ns_makecanon(const char *src, char *dst, size_t dstsize) { size_t n = strlen(src); - if (n + sizeof "." > dstsize) { /*%< Note: sizeof == 2 */ + if (n + sizeof "." > dstsize) { /* Note: sizeof == 2 */ errno = EMSGSIZE; return (-1); } strcpy(dst, src); - while (n >= 1U && dst[n - 1] == '.') /*%< Ends in "." */ - if (n >= 2U && dst[n - 2] == '\\' && /*%< Ends in "\." */ - (n < 3U || dst[n - 3] != '\\')) /*%< But not "\\." */ + while (n >= 1U && dst[n - 1] == '.') /* Ends in "." */ + if (n >= 2U && dst[n - 2] == '\\' && /* Ends in "\." */ + (n < 3U || dst[n - 3] != '\\')) /* But not "\\." */ break; else dst[--n] = '\0'; @@ -182,13 +186,14 @@ ns_makecanon(const char *src, char *dst, size_t dstsize) { return (0); } -/*% +/* + * int + * ns_samename(a, b) * determine whether domain name "a" is the same as domain name "b" - * * return: - *\li -1 on error - *\li 0 if names differ - *\li 1 if names are the same + * -1 on error + * 0 if names differ + * 1 if names are the same */ int @@ -203,5 +208,3 @@ ns_samename(const char *a, const char *b) { else return (0); } - -/*! \file */ |