1139825Simp/*-
282899Sjake * Copyright 1994, 1995 Massachusetts Institute of Technology
382899Sjake *
482899Sjake * Permission to use, copy, modify, and distribute this software and
580708Sjake * its documentation for any purpose and without fee is hereby
682899Sjake * granted, provided that both the above copyright notice and this
782899Sjake * permission notice appear in all copies, that both the above
882899Sjake * copyright notice and this permission notice appear in all
982899Sjake * supporting documentation, and that the name of M.I.T. not be used
1082899Sjake * in advertising or publicity pertaining to distribution of the
1180708Sjake * software without specific, written prior permission.  M.I.T. makes
1282899Sjake * no representations about the suitability of this software for any
1382899Sjake * purpose.  It is provided "as is" without express or implied
1482899Sjake * warranty.
1580708Sjake *
1682899Sjake * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
1782899Sjake * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
1882899Sjake * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1982899Sjake * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
2082899Sjake * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2182899Sjake * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2282899Sjake * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2382899Sjake * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2482899Sjake * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2582899Sjake * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2682899Sjake * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2780708Sjake * SUCH DAMAGE.
2880708Sjake */
2980708Sjake
3080708Sjake#include <sys/cdefs.h>
3180708Sjake__FBSDID("$FreeBSD$");
3280708Sjake
3380709Sjake#include <sys/param.h>
3480709Sjake#include <sys/systm.h>
3580709Sjake
3680709Sjake#include <netinet/in.h>
3780709Sjake
3880709Sjakechar *
3982004Sjakeinet_ntoa(struct in_addr ina)
4080709Sjake{
41131952Smarcel	static char buf[4*sizeof "123"];
4280709Sjake	unsigned char *ucp = (unsigned char *)&ina;
43115970Sjake
4480709Sjake	sprintf(buf, "%d.%d.%d.%d",
4580709Sjake		ucp[0] & 0xff,
4680709Sjake		ucp[1] & 0xff,
4786525Sjake		ucp[2] & 0xff,
48131952Smarcel		ucp[3] & 0xff);
49131952Smarcel	return buf;
5086525Sjake}
5180709Sjake
52131952Smarcelchar *
53131952Smarcelinet_ntoa_r(struct in_addr ina, char *buf)
5480709Sjake{
5580709Sjake	unsigned char *ucp = (unsigned char *)&ina;
5680709Sjake
5780709Sjake	sprintf(buf, "%d.%d.%d.%d",
5880709Sjake		ucp[0] & 0xff,
5980709Sjake		ucp[1] & 0xff,
6080709Sjake		ucp[2] & 0xff,
6180709Sjake		ucp[3] & 0xff);
6280709Sjake	return buf;
6380709Sjake}
6480709Sjake
6580709Sjake
6680709Sjake