#include "pcdefs.h"
#include <memory.h>

/* return host in network byte order */
/* This function assumes a 4-component name. */
u_long
inet_addr(name)
char *name;
{
	u_char addr[4];
	u_char *ap;

	memset(addr, 0, 4);
	for (ap = addr; ap < &addr[4]; ap++) {
		while (*name >= '0' && *name <= '9')
			*ap = (u_char)(10 * *ap + (u_char)*name++ - '0');
		if (*name == 0)
			break;
		if (*name != '.')
			return (u_long)-1;
		name++;
	}
	return *(u_long *)addr;
}
