156893Sfenner/*
256893Sfenner * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H�gskolan
356893Sfenner * (Royal Institute of Technology, Stockholm, Sweden).
456893Sfenner * All rights reserved.
5127668Sbms *
656893Sfenner * Redistribution and use in source and binary forms, with or without
756893Sfenner * modification, are permitted provided that the following conditions
856893Sfenner * are met:
9127668Sbms *
1056893Sfenner * 1. Redistributions of source code must retain the above copyright
1156893Sfenner *    notice, this list of conditions and the following disclaimer.
12127668Sbms *
1356893Sfenner * 2. Redistributions in binary form must reproduce the above copyright
1456893Sfenner *    notice, this list of conditions and the following disclaimer in the
1556893Sfenner *    documentation and/or other materials provided with the distribution.
16127668Sbms *
1756893Sfenner * 3. All advertising materials mentioning features or use of this software
1856893Sfenner *    must display the following acknowledgement:
1956893Sfenner *      This product includes software developed by the Kungliga Tekniska
2056893Sfenner *      H�gskolan and its contributors.
21127668Sbms *
2256893Sfenner * 4. Neither the name of the Institute nor the names of its contributors
2356893Sfenner *    may be used to endorse or promote products derived from this software
2456893Sfenner *    without specific prior written permission.
25127668Sbms *
2656893Sfenner * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2756893Sfenner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2856893Sfenner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2956893Sfenner * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
3056893Sfenner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3156893Sfenner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3256893Sfenner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3356893Sfenner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3456893Sfenner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3556893Sfenner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3656893Sfenner * SUCH DAMAGE.
3756893Sfenner */
3856893Sfenner
39190207Srpaulo/* $Id: inet_aton.c,v 1.6 2003-11-16 09:36:49 guy Exp $ */
4056893Sfenner
4156893Sfenner#ifndef lint
42127668Sbmsstatic const char rcsid[] _U_ =
43190207Srpaulo     "@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.6 2003-11-16 09:36:49 guy Exp $";
4456893Sfenner#endif
4556893Sfenner
46127668Sbms#include <tcpdump-stdinc.h>
4756893Sfenner
4856893Sfenner/* Minimal implementation of inet_aton.
4956893Sfenner * Cannot distinguish between failure and a local broadcast address. */
5056893Sfenner
5156893Sfenner#ifndef INADDR_NONE
5256893Sfenner#define INADDR_NONE 0xffffffff
5356893Sfenner#endif
5456893Sfenner
5556893Sfennerint
5656893Sfennerinet_aton(const char *cp, struct in_addr *addr)
5756893Sfenner{
5856893Sfenner  addr->s_addr = inet_addr(cp);
5956893Sfenner  return (addr->s_addr == INADDR_NONE) ? 0 : 1;
6056893Sfenner}
61