/* Mail alias file parser in nss_files module.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
/* Parsing the database file into `struct aliasent' data structures. */
static enum nss_status
get_next_alias (const char *match, struct aliasent *result,
- char *buffer, size_t buflen)
+ char *buffer, size_t buflen, int *errnop)
{
enum nss_status status = NSS_STATUS_NOTFOUND;
int ignore = 0;
{
/* The line is too long for our buffer. */
no_more_room:
- __set_errno (ERANGE);
+ *errnop = ERANGE;
status = NSS_STATUS_TRYAGAIN;
break;
}
looking for. If it does not match we simply ignore all
lines until the next line containing the start of a new
alias is found. */
- ignore = match != NULL && strcmp (result->alias_name, match) != 0;
+ ignore = (match != NULL
+ && strcasecmp (result->alias_name, match) != 0);
while (! ignore)
{
enum nss_status
-_nss_files_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen)
+_nss_files_getaliasent_r (struct aliasent *result, char *buffer, size_t buflen,
+ int *errnop)
{
/* Return next entry in host file. */
enum nss_status status = NSS_STATUS_SUCCESS;
/* Read lines until we get a definite result. */
do
- status = get_next_alias (NULL, result, buffer, buflen);
+ status = get_next_alias (NULL, result, buffer, buflen, errnop);
while (status == NSS_STATUS_RETURN);
/* If we successfully read an entry remember this position. */
enum nss_status
_nss_files_getaliasbyname_r (const char *name, struct aliasent *result,
- char *buffer, size_t buflen)
+ char *buffer, size_t buflen, int *errnop)
{
/* Return next entry in host file. */
enum nss_status status = NSS_STATUS_SUCCESS;
/* Read lines until we get a definite result. */
do
- status = get_next_alias (name, result, buffer, buflen);
+ status = get_next_alias (name, result, buffer, buflen, errnop);
while (status == NSS_STATUS_RETURN);
}