From 3776d592f117c8c5b0d2c37d265cb8ee2ac21695 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 1 Jul 1996 22:16:41 +0000 Subject: Mon Jul 1 12:29:50 1996 Roland McGrath * nss/Makefile (databases): Change host to hosts. * nss/host-lookup.c: Renamed to nss/hosts-lookup.c. --- nss/Makefile | 2 +- nss/host-lookup.c | 23 ----------------------- nss/hosts-lookup.c | 23 +++++++++++++++++++++++ nss/nss_files/files-hosts.c | 3 ++- nss/nss_files/files-parse.c | 27 +++++++++++++++++++++------ nss/nsswitch.c | 6 +++--- 6 files changed, 50 insertions(+), 34 deletions(-) delete mode 100644 nss/host-lookup.c create mode 100644 nss/hosts-lookup.c (limited to 'nss') diff --git a/nss/Makefile b/nss/Makefile index bdf1651bb1..8e7a242344 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -28,7 +28,7 @@ distribute := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \ routines = nsswitch $(addsuffix -lookup,$(databases)) # These are the databases that go through nss dispatch. -databases = proto service host network grp pwd rpc ethers +databases = proto service hosts network grp pwd rpc ethers # Specify rules for the nss_* modules. We have some services. services := files dns diff --git a/nss/host-lookup.c b/nss/host-lookup.c deleted file mode 100644 index f511393372..0000000000 --- a/nss/host-lookup.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. -Contributed by Ulrich Drepper , 1996. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define DATABASE_NAME hosts -#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files" - -#include "XXX-lookup.c" diff --git a/nss/hosts-lookup.c b/nss/hosts-lookup.c new file mode 100644 index 0000000000..f511393372 --- /dev/null +++ b/nss/hosts-lookup.c @@ -0,0 +1,23 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper , 1996. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#define DATABASE_NAME hosts +#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files" + +#include "XXX-lookup.c" diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index dad818c941..15f00f31ce 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -32,6 +32,7 @@ Cambridge, MA 02139, USA. */ #define ENTNAME hostent #define DATAFILE _PATH_HOSTS +#define ENTDATA hostent_data struct hostent_data { unsigned char host_addr[16]; /* IPv4 or IPv6 address. */ @@ -73,7 +74,7 @@ LINE_PARSER /* Illegal address: ignore line. */ return 0; - /* Store a pointer to the addressin the expected form. */ + /* Store a pointer to the address in the expected form. */ entdata->h_addr_ptrs[0] = entdata->host_addr; entdata->h_addr_ptrs[1] = NULL; result->h_addr_list = entdata->h_addr_ptrs; diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c index de456995a2..be35ae1a8a 100644 --- a/nss/nss_files/files-parse.c +++ b/nss/nss_files/files-parse.c @@ -33,17 +33,31 @@ Cambridge, MA 02139, USA. */ struct parser_data { - struct CONCAT(ENTNAME,_data) entdata; +#ifdef ENTDATA + struct ENTDATA entdata; +#define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata +#else +#define ENTDATA_DECL(data) +#endif char linebuffer[0]; }; +#ifdef ENTDATA +/* The function can't be exported, because the entdata structure + is defined only in files-foo.c. */ +#define parser_stclass static inline +#else +/* Export the line parser function so it can be used in nss_db. */ +#define parser_stclass /* Global */ +#define parse_line CONCAT(_nss_files_parse_,ENTNAME) +#endif + #define LINE_PARSER(BODY) \ -static inline int \ +parser_stclass int \ parse_line (char *line, struct STRUCTURE *result, \ struct parser_data *data, int datalen) \ { \ - struct CONCAT(ENTNAME,_data) *const entdata __attribute__ ((unused)) \ - = &data->entdata; \ + ENTDATA_DECL (data); \ BODY; \ TRAILING_LIST_PARSER; \ return 1; \ @@ -107,9 +121,10 @@ parse_list (char *line, struct parser_data *data, int datalen) char *eol, **list, **p; /* Find the end of the line buffer. */ - eol = strchr (line, '\0') + 1; + eol = strchr (data->linebuffer, '\0') + 1; /* Adjust the pointer so it is aligned for storing pointers. */ - eol += (eol - (char *) 0) % __alignof__ (char *); + eol += __alignof__ (char *) - 1; + eol -= (eol - (char *) 0) % __alignof__ (char *); /* We will start the storage here for the vector of pointers. */ list = (char **) eol; diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 9b6c4eb12f..c748eb1bef 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -249,8 +249,8 @@ nss_lookup_function (service_user *ni, const char *fct_name) + strlen (fct_name) + 1); char name[namlen]; struct link_map *map = ni->library->lib_handle; - Elf32_Addr loadbase; - const Elf32_Sym *ref = NULL; + ElfW(Addr) loadbase; + const ElfW(Sym) *ref = NULL; void get_sym (void) { struct link_map *scope[2] = { map, NULL }; @@ -397,7 +397,7 @@ nss_parse_service_list (const char *line) while (1) { service_user *new_service; - char *name; + const char *name; while (isspace (line[0])) ++line; -- cgit 1.4.1