summaryrefslogtreecommitdiff
path: root/nss
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
committerRoland McGrath <roland@gnu.org>1996-07-01 22:16:41 +0000
commit3776d592f117c8c5b0d2c37d265cb8ee2ac21695 (patch)
tree9cae15e988bc6b4eb1e2737db59bceaab58e0be7 /nss
parent7cbc698400bfe2a64f12b0cb703fda0fdecb5a59 (diff)
downloadglibc-3776d592f117c8c5b0d2c37d265cb8ee2ac21695.tar.gz
Mon Jul 1 12:29:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* nss/Makefile (databases): Change host to hosts. * nss/host-lookup.c: Renamed to nss/hosts-lookup.c.
Diffstat (limited to 'nss')
-rw-r--r--nss/Makefile2
-rw-r--r--nss/hosts-lookup.c (renamed from nss/host-lookup.c)0
-rw-r--r--nss/nss_files/files-hosts.c3
-rw-r--r--nss/nss_files/files-parse.c27
-rw-r--r--nss/nsswitch.c6
5 files changed, 27 insertions, 11 deletions
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/hosts-lookup.c
index f511393372..f511393372 100644
--- a/nss/host-lookup.c
+++ b/nss/hosts-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;