summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/getnetbyname.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/getnetbyname.c')
-rw-r--r--src/lib/libc/net/getnetbyname.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/lib/libc/net/getnetbyname.c b/src/lib/libc/net/getnetbyname.c
index 93a2e1256c..e6540cf12c 100644
--- a/src/lib/libc/net/getnetbyname.c
+++ b/src/lib/libc/net/getnetbyname.c
@@ -1,5 +1,4 @@
1/* $NetBSD: getnetbyname.c,v 1.4 1995/02/25 06:20:31 cgd Exp $ */ 1/* $OpenBSD: getnetbyname.c,v 1.8 2005/08/06 20:30:03 espie Exp $ */
2
3/* 2/*
4 * Copyright (c) 1983, 1993 3 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -12,11 +11,7 @@
12 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software 14 * 3. Neither the name of the University nor the names of its contributors
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software 15 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission. 16 * without specific prior written permission.
22 * 17 *
@@ -33,32 +28,23 @@
33 * SUCH DAMAGE. 28 * SUCH DAMAGE.
34 */ 29 */
35 30
36#if defined(LIBC_SCCS) && !defined(lint)
37#if 0
38static char sccsid[] = "@(#)getnetbyname.c 8.1 (Berkeley) 6/4/93";
39#else
40static char rcsid[] = "$NetBSD: getnetbyname.c,v 1.4 1995/02/25 06:20:31 cgd Exp $";
41#endif
42#endif /* LIBC_SCCS and not lint */
43
44#include <netdb.h> 31#include <netdb.h>
45#include <string.h> 32#include <string.h>
46 33
47extern int _net_stayopen; 34extern int _net_stayopen;
48 35
49struct netent * 36struct netent *
50getnetbyname(name) 37_getnetbyname(const char *name)
51 register const char *name;
52{ 38{
53 register struct netent *p; 39 struct netent *p;
54 register char **cp; 40 char **cp;
55 41
56 setnetent(_net_stayopen); 42 setnetent(_net_stayopen);
57 while (p = getnetent()) { 43 while ((p = getnetent())) {
58 if (strcmp(p->n_name, name) == 0) 44 if (strcasecmp(p->n_name, name) == 0)
59 break; 45 break;
60 for (cp = p->n_aliases; *cp != 0; cp++) 46 for (cp = p->n_aliases; *cp != 0; cp++)
61 if (strcmp(*cp, name) == 0) 47 if (strcasecmp(*cp, name) == 0)
62 goto found; 48 goto found;
63 } 49 }
64found: 50found: