Annotation of XNU/bsd/libkern/inet_ntoa.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: 
                     23: /*
                     24:  * Copyright 1994, 1995 Massachusetts Institute of Technology
                     25:  *
                     26:  * Permission to use, copy, modify, and distribute this software and
                     27:  * its documentation for any purpose and without fee is hereby
                     28:  * granted, provided that both the above copyright notice and this
                     29:  * permission notice appear in all copies, that both the above
                     30:  * copyright notice and this permission notice appear in all
                     31:  * supporting documentation, and that the name of M.I.T. not be used
                     32:  * in advertising or publicity pertaining to distribution of the
                     33:  * software without specific, written prior permission.  M.I.T. makes
                     34:  * no representations about the suitability of this software for any
                     35:  * purpose.  It is provided "as is" without express or implied
                     36:  * warranty.
                     37:  *
                     38:  * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
                     39:  * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
                     40:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
                     41:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
                     42:  * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
                     43:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
                     44:  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
                     45:  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
                     46:  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
                     47:  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
                     48:  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     49:  * SUCH DAMAGE.
                     50:  */
                     51: 
                     52: #include <sys/param.h>
                     53: #include <sys/systm.h>
                     54: 
                     55: #include <netinet/in.h>
                     56: 
                     57: char *
                     58: inet_ntoa(struct in_addr ina)
                     59: {
                     60:        static char buf[4*sizeof "123"];
                     61:        unsigned char *ucp = (unsigned char *)&ina;
                     62: 
                     63:        sprintf(buf, "%d.%d.%d.%d",
                     64:                ucp[0] & 0xff,
                     65:                ucp[1] & 0xff,
                     66:                ucp[2] & 0xff,
                     67:                ucp[3] & 0xff);
                     68:        return buf;
                     69: }
                     70: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.