/* Netgroup file parser in nss_files modules.
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
/* Remove these characters from the stored line. */
result->cursor -= 2;
- /* Get netxt line. */
+ /* Get next line. */
curlen = getline (&line, &line_len, fp);
if (curlen <= 0)
break;
}
-static enum nss_status
+enum nss_status
_nss_netgroup_parseline (char **cursor, struct __netgrent *result,
- char *buffer, int buflen)
+ char *buffer, size_t buflen, int *errnop)
{
enum nss_status status;
const char *host, *user, *domain;
/* Some sanity checks. */
if (cp == NULL)
- /* User bug. setnetgrent() wasn't called before. */
- abort ();
+ return NSS_STATUS_NOTFOUND;
/* First skip leading spaces. */
while (isspace (*cp))
to the private buffer we have to make sure it is big enough. */
if (cp - host > buflen)
{
- __set_errno (ERANGE);
+ *errnop = ERANGE;
status = NSS_STATUS_UNAVAIL;
}
else
status = NSS_STATUS_SUCCESS;
- /* Rememember where we stopped reading. */
+ /* Remember where we stopped reading. */
*cursor = cp;
result->first = 0;
enum nss_status
-_nss_files_getnetgrent_r (struct __netgrent *result, char *buffer, int buflen)
+_nss_files_getnetgrent_r (struct __netgrent *result, char *buffer,
+ size_t buflen, int *errnop)
{
enum nss_status status;
- status = _nss_netgroup_parseline (&result->cursor, result, buffer, buflen);
+ status = _nss_netgroup_parseline (&result->cursor, result, buffer, buflen,
+ errnop);
return status;
}