glibc/nss/nss_files/files-network.c
Ulrich Drepper 9d0881aa76 Update.
2001-09-20  H.J. Lu  <hjl@gnu.org>

	* include/dlfcn.h (__RTLD_SPROF): New definiton.
	* elf/dl-open.c (dl_open_worker): Return immediately after loading
	for __RTLD_SPROF.
	* elf/sprof.c (main): Default to the filename if soname doesn't exist.
	(load_shobj): Call dlopen with `RTLD_LAZY | __RTLD_SPROF.

2001-09-20  H.J. Lu  <hjl@gnu.org>

	* elf/dl-profile.c (_dl_mcount): Use old *narcsp value for newarc,
	don't add 1.

2001-09-22  Ulrich Drepper  <drepper@redhat.com>

	* nss/getent.c: Accept -s parameter to overwrite rules in
	nsswitch.conf.  Patch by Nalin Dahyabhai <nalin@redhat.com>.

	* nss/nss_files/files-network.c (LINE_PARSER): Pad addr string
	with as many ".0" as necessary to form a complete address
	inet_network understands.

	* nss/getent.c: Various cleanups.  Use simpler and fewer function
	calls.

2001-09-20  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/s390-32/bits/setjmp.h: Correct pointer comparison in
	_JMPBUF_UNWINDS.
	* sysdeps/s390/s390-64/bits/setjmp.h: Likewise.

2001-09-22  Ulrich Drepper  <drepper@redhat.com>

	* iconvdata/Makefile: Add rules to build and distribute IBM1160 and
	IBM1161.
	* iconvdata/gconv-modules: Add entries for IBM1160 and IBM1161.
	* iconvdata/ibm1160.c: New file.
	* iconvdata/ibm1160.h: New file.
	* iconvdata/ibm1161.c: New file.
	* iconvdata/ibm1161.h: New file.

2001-09-19  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/alpha/dl-machine.h (elf_machine_load_address): Compute the
	difference between base address and first PT_LOAD's virtual address,
	not the base address.

2001-09-11  Tom Rix  <trix@redhat.com>

	* sysdeps/unix/sysv/aix/init-first.c (init):  Use USE_NONONPTION_FLAG
	ifdef for __getopt_clean_environment.
	* sysdeps/unix/sysv/aix/libc-start.c: Add real implementation.

	* sysdeps/unix/sysv/linux/x86_64/Dist: New file.
	* sysdeps/x86_64/Dist: New file.
	* sysdeps/x86_64/soft-fp/Dist: New file.
2001-09-23 02:10:30 +00:00

88 lines
2.2 KiB
C

/* Networks file parser in nss_files module.
Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#define ENTNAME netent
#define DATABASE "networks"
#define NEED_H_ERRNO
struct netent_data {};
#define TRAILING_LIST_MEMBER n_aliases
#define TRAILING_LIST_SEPARATOR_P isspace
#include "files-parse.c"
LINE_PARSER
("#",
{
char *addr;
char *cp;
int n = 1;
STRING_FIELD (result->n_name, isspace, 1);
STRING_FIELD (addr, isspace, 1);
/* 'inet_network' does not add zeroes at the end if the network number
does not four byte values. We add them outselves if necessary. */
cp = strchr (addr, '.');
if (cp != NULL)
{
++n;
cp = strchr (cp + 1, '.');
if (cp != NULL)
{
++n;
cp = strchr (cp + 1, '.');
if (cp != NULL)
++n;
}
}
if (n < 4)
{
char *newp = (char *) alloca (strlen (addr) + (4 - n) * 2 + 1);
cp = stpcpy (newp, addr);
do
{
*cp++ = '.';
*cp++ = '0';
}
while (++n < 4);
*cp = '\0';
addr = newp;
}
result->n_net = inet_network (addr);
result->n_addrtype = AF_INET;
})
#include "files-XXX.c"
DB_LOOKUP (netbyname, ,,
LOOKUP_NAME_CASE (n_name, n_aliases),
const char *name)
DB_LOOKUP (netbyaddr, ,,
{
if (result->n_addrtype == type && result->n_net == net)
/* Bingo! */
break;
}, uint32_t net, int type)