Exemple #1
0
struct passwd *
getpwnam(const char * name)
{
  int passwd_fd;
  struct passwd * passwd;

  if (name==NULL)
    {
      errno=EINVAL;
      return NULL;
    }

  if ((passwd_fd=open("/etc/passwd", O_RDONLY))<0)
    return NULL;

  while ((passwd=__getpwent(passwd_fd))!=NULL)
    if (!strcmp(passwd->pw_name, name))
      {
	close(passwd_fd);
	return passwd;
      }	  

  close(passwd_fd);
  return NULL;
}
Exemple #2
0
Fichier : pwent.c Projet : 8l/FUZIX
struct passwd *
getpwent(void)
{
  if (pw_fd==-1)
    setpwent();
  if (pw_fd!=-1)
    return __getpwent(pw_fd);
  return NULL;  
}
struct passwd *fgetpwent(FILE * file)
{
	if (file == NULL) {
		errno = EINTR;
		return NULL;
	}

	return __getpwent(fileno(file));
}