/[LeafOK_CVS]/pvpgn-1.7.4/src/compat/inet_ntoa.c
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/compat/inet_ntoa.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
CVS Tags: pvpgn_1-7-4-0_MIL
Branch point for: GNU, MAIN
Content type: text/x-csrc
Initial revision

1 sysadm 1.1 /*
2     * Copyright (C) 1999 Ross Combs (rocombs@cs.nmsu.edu)
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License
6     * as published by the Free Software Foundation; either version 2
7     * of the License, or (at your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful,
10     * but WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     * GNU General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with this program; if not, write to the Free Software
16     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17     */
18     #include "common/setup_before.h"
19     #ifndef HAVE_INET_NTOA
20    
21     #include <stdio.h>
22     #ifdef HAVE_STDDEF_H
23     # include <stddef.h>
24     #else
25     # ifndef NULL
26     # define NULL ((void *)0)
27     # endif
28     #endif
29     #ifdef HAVE_SYS_TYPES
30     # include <sys/types.h>
31     #endif
32     #ifdef HAVE_SYS_PARAM_H
33     # include <sys/param.h>
34     #endif
35     #ifdef HAVE_NETINET_IN_H
36     # include <netinet/in.h>
37     #endif
38     #ifdef HAVE_ARPA_INET_H
39     # include <arpa/inet.h>
40     #endif
41     #include "inet_ntoa.h"
42     #include "common/setup_after.h"
43    
44    
45     extern char const * inet_ntoa(struct in_addr const * addr)
46     {
47     static char buff[16];
48     unsigned long val;
49    
50     if (!addr)
51     return NULL;
52    
53     val = ntohl(addr->s_addr);
54     sprintf(buff,"%u.%u.%u.%u",
55     (val>>24)&0xff,
56     (val>>16)&0xff,
57     (val>> 8)&0xff,
58     (val )&0xff);
59     return buff;
60     }
61    
62     #else
63     typedef int filenotempty; /* make ISO standard happy */
64     #endif

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1