src/usr.sbin/mountd/mountd.c
/*
 * Return a pointer to the part of the sockaddr that contains the
 * raw address, and set *nbytes to its length in bytes. Returns
 * NULL if the address family is unknown.
 */
Return a pointer to the part of the sockaddr that contains the
raw address, and set *nbytes to its length in bytes. Returns
NULL if the address family is unknown.
Return a pointer to the part of the sockaddr that contains the raw address and set * nbytes to its length in bytes . Returns NULL if the address family is unknown .
static void *
sa_rawaddr(struct sockaddr *sa, int *nbytes) {
	void *p;
	int len;
	switch (sa->sa_family) {
	case AF_INET:
		len = sizeof(((struct sockaddr_in *)sa)->sin_addr);
		p = &((struct sockaddr_in *)sa)->sin_addr;
		break;
	case AF_INET6:
		len = sizeof(((struct sockaddr_in6 *)sa)->sin6_addr);
		p = &((struct sockaddr_in6 *)sa)->sin6_addr;
		break;
	default:
		p = NULL;
		len = 0;
	}
	if (nbytes != NULL)
		*nbytes = len;
	return (p);
}
static void * sa_rawaddr ( struct sockaddr * sa , int * nbytes ) { void * p ; int len ; switch ( sa -> sa_family ) { case AF_INET : len = sizeof ( ( ( struct sockaddr_in * ) sa ) -> sin_addr ) ; p = & ( ( struct sockaddr_in * ) sa ) -> sin_addr ; break ; case AF_INET6 : len = sizeof ( ( ( struct sockaddr_in6 * ) sa ) -> sin6_addr ) ; p = & ( ( struct sockaddr_in6 * ) sa ) -> sin6_addr ; break ; default : p = NULL ; len = 0 ; } if ( nbytes != NULL ) * nbytes = len ; return ( p ) ; }
Return a pointer to the part of the sockaddr that contains the
 raw address, and set *nbytes to its length in bytes.
Return a pointer to the part of the sockaddr that contains the raw address and set * nbytes to its length in bytes .