From 95f53957e3dcce2544fd03ca3b314f2bbb6f5b2a Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Thu, 6 Nov 2003 20:56:04 +0000 Subject: Rewrite the pwd.h, grp.h, and shadow.h functions (except lckpwdf/ulckpwdf). --- libc/pwd_grp/__getpwent_r.c | 115 -------------------------------------------- 1 file changed, 115 deletions(-) delete mode 100644 libc/pwd_grp/__getpwent_r.c (limited to 'libc/pwd_grp/__getpwent_r.c') diff --git a/libc/pwd_grp/__getpwent_r.c b/libc/pwd_grp/__getpwent_r.c deleted file mode 100644 index 6e6de4038..000000000 --- a/libc/pwd_grp/__getpwent_r.c +++ /dev/null @@ -1,115 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * __getpwent_r.c - This file is part of the libc-8086/pwd package for ELKS, - * Copyright (C) 1995, 1996 Nat Friedman . - * Copyright (C) 2001-2003 Erik Andersen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * March 7, 2001 -- Reworked to be reentrant by Erik Andersen - * Oct 9, 2003 -- Reworked again by Erik Andersen to be fully reentrant - */ - -#include -#include -#include -#include -#include -#include "config.h" - - -/* This isn't as flash as my previous version -- it doesn't dynamically - scale down the gecos on too-long lines, but it also makes fewer syscalls, - so it's probably nicer. Write me if you want the old version. Maybe I - should include it as a build-time option... ? - -Nat */ - -int __getpwent_r(struct passwd * passwd, char * line_buff, size_t buflen, int pwd_fd) -{ - char *endptr, *field_begin; - char *gid_ptr=NULL; - char *uid_ptr=NULL; - int i, line_len; - - if (buflenpw_name = field_begin; - break; - case 1: - passwd->pw_passwd = field_begin; - break; - case 2: - uid_ptr = field_begin; - break; - case 3: - gid_ptr = field_begin; - break; - case 4: - passwd->pw_gecos = field_begin; - break; - case 5: - passwd->pw_dir = field_begin; - break; - case 6: - passwd->pw_shell = field_begin; - break; - } - if (i < 6) { - field_begin = strchr(field_begin, ':'); - if (field_begin == NULL) - goto restart; - *field_begin++ = '\0'; - } - } - passwd->pw_gid = (gid_t) strtoul(gid_ptr, &endptr, 10); - if (*endptr != '\0') - goto restart; - - passwd->pw_uid = (uid_t) strtoul(uid_ptr, &endptr, 10); - if (*endptr != '\0') - goto restart; - - return 0; -} -- cgit v1.2.3