getpwent_r.c revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1998-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
static const char rcsid[] = "$Id: getpwent_r.c,v 1.8 2005/04/27 04:56:26 sra Exp $";
#endif /* LIBC_SCCS and not lint */
#include <port_before.h>
static int getpwent_r_not_required = 0;
#else
#include <errno.h>
#include <string.h>
#include <stdio.h>
#if (defined(POSIX_GETPWNAM_R) || defined(POSIX_GETPWUID_R))
#if defined(_POSIX_PTHREAD_SEMANTICS)
/* turn off solaris remapping in <grp.h> */
#include <pwd.h>
#define _POSIX_PTHREAD_SEMANTICS 1
#else
#define _UNIX95 1
#include <pwd.h>
#endif
#else
#include <pwd.h>
#endif
#include <port_after.h>
#ifdef PASS_R_RETURN
static int
/* POSIX 1003.1c */
#ifdef POSIX_GETPWNAM_R
int
#else
int
#endif
int res;
return (0);
}
return (res);
}
#ifdef POSIX_GETPWNAM_R
struct passwd *
int res;
return (NULL);
}
#endif
/* POSIX 1003.1c */
#ifdef POSIX_GETPWUID_R
int
#else
int
#endif
int res;
return (0);
}
return (res);
}
#ifdef POSIX_GETPWUID_R
struct passwd *
int res;
return (NULL);
}
#endif
/*%
* These assume a single context is in operation per thread.
* If this is not the case we will need to call irs directly
* rather than through the base functions.
*/
int res = 0;
return (PASS_R_BAD);
}
#ifdef PASS_R_ENT_ARGS
#else
setpassent_r(int stayopen)
#endif
{
#ifdef PASS_R_SET_RESULT
return (PASS_R_SET_RESULT);
#endif
}
#ifdef PASS_R_ENT_ARGS
#else
setpwent_r(void)
#endif
{
setpwent();
#ifdef PASS_R_SET_RESULT
return (PASS_R_SET_RESULT);
#endif
}
#ifdef PASS_R_ENT_ARGS
#else
endpwent_r(void)
#endif
{
endpwent();
}
#ifdef HAS_FGETPWENT
int res = 0;
return (PASS_R_BAD);
}
#endif
/* Private */
static int
char *cp;
int n;
int len;
/* Find out the amount of space required to store the answer. */
#ifdef HAVE_PW_CLASS
#endif
return (ERANGE);
}
/* copy fixed atomic values*/
#ifdef HAVE_PW_CHANGE
#endif
#ifdef HAVE_PW_EXPIRE
#endif
/* copy official name */
cp += n;
/* copy password */
cp += n;
#ifdef HAVE_PW_CLASS
/* copy class */
cp += n;
#endif
/* copy gecos */
cp += n;
/* copy directory */
cp += n;
/* copy login shell */
cp += n;
return (0);
}
#else /* PASS_R_RETURN */
static int getpwent_r_unknown_system = 0;
#endif /* PASS_R_RETURN */
#endif /* !def(_REENTRANT) || !def(DO_PTHREADS) || !def(WANT_IRS_PW) */
/*! \file */