Plan 9 from Bell Labs’s /usr/web/sources/patch/ape-erik/_sock_ipattr.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/* posix */
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

/* bsd extensions */
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>

#include "priv.h"

/*
 *  return ndb attribute type of an ip name
 */
int
_sock_ipattr(char *name)
{
	struct in6_addr ia6;

	if(inet_pton(AF_INET6, name, &ia6) == 1)
		return Tip;
	if(strchr(name, '.') != nil)
		return Tdom;
	return Tsys;
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.