[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit

Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/libc/pwd_grp/.indent.pro b/ap/build/uClibc/libc/pwd_grp/.indent.pro
new file mode 100644
index 0000000..492ecf1
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/ap/build/uClibc/libc/pwd_grp/Makefile b/ap/build/uClibc/libc/pwd_grp/Makefile
new file mode 100644
index 0000000..11f362a
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir=../../
+top_builddir=../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/pwd_grp/Makefile.in b/ap/build/uClibc/libc/pwd_grp/Makefile.in
new file mode 100644
index 0000000..757adc8
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/Makefile.in
@@ -0,0 +1,33 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/pwd_grp
+
+PWDGRP_DIR := $(top_srcdir)libc/pwd_grp
+PWDGRP_OUT := $(top_builddir)libc/pwd_grp
+
+CSRC := $(notdir $(wildcard $(PWDGRP_DIR)/*.c))
+CSRC := $(filter-out pwd_grp.c pwd_grp_internal.c,$(CSRC))
+
+ifneq ($(UCLIBC_HAS_SHADOW),y)
+SHADOW_CSRC := \
+	fgetspent_r.c fgetspent.c getspent_r.c getspent.c \
+	getspnam_r.c getspnam.c lckpwdf.c putspent.c \
+	sgetspent_r.c sgetspent.c __parsespent.c
+# getspuid_r.c getspuid.c
+CSRC := $(filter-out $(SHADOW_CSRC),$(CSRC))
+endif
+
+PWDGRP_SRC := $(patsubst %.c,$(PWDGRP_DIR)/%.c,$(CSRC))
+PWDGRP_OBJ := $(patsubst %.c,$(PWDGRP_OUT)/%.o,$(CSRC))
+
+libc-y += $(PWDGRP_OBJ)
+
+objclean-y += CLEAN_libc/pwd_grp
+
+CLEAN_libc/pwd_grp:
+	$(do_rm) $(addprefix $(PWDGRP_OUT)/*., o os)
diff --git a/ap/build/uClibc/libc/pwd_grp/__getgrouplist_internal.c b/ap/build/uClibc/libc/pwd_grp/__getgrouplist_internal.c
new file mode 100644
index 0000000..c2edc99
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/__getgrouplist_internal.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L___getgrouplist_internal
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/__parsegrent.c b/ap/build/uClibc/libc/pwd_grp/__parsegrent.c
new file mode 100644
index 0000000..e3ac4ad
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/__parsegrent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L___parsegrent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/__parsepwent.c b/ap/build/uClibc/libc/pwd_grp/__parsepwent.c
new file mode 100644
index 0000000..2804a0a
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/__parsepwent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L___parsepwent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/__parsespent.c b/ap/build/uClibc/libc/pwd_grp/__parsespent.c
new file mode 100644
index 0000000..08321d0
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/__parsespent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L___parsespent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/__pgsreader.c b/ap/build/uClibc/libc/pwd_grp/__pgsreader.c
new file mode 100644
index 0000000..ac39ce9
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/__pgsreader.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L___pgsreader
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetgrent.c b/ap/build/uClibc/libc/pwd_grp/fgetgrent.c
new file mode 100644
index 0000000..695aee1
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetgrent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetgrent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetgrent_r.c b/ap/build/uClibc/libc/pwd_grp/fgetgrent_r.c
new file mode 100644
index 0000000..ea97af7
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetgrent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetgrent_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetpwent.c b/ap/build/uClibc/libc/pwd_grp/fgetpwent.c
new file mode 100644
index 0000000..ddcc7ff
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetpwent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetpwent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetpwent_r.c b/ap/build/uClibc/libc/pwd_grp/fgetpwent_r.c
new file mode 100644
index 0000000..8b93503
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetpwent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetpwent_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetspent.c b/ap/build/uClibc/libc/pwd_grp/fgetspent.c
new file mode 100644
index 0000000..b7c1ef2
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetspent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetspent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/fgetspent_r.c b/ap/build/uClibc/libc/pwd_grp/fgetspent_r.c
new file mode 100644
index 0000000..7196d80
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/fgetspent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_fgetspent_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrent.c b/ap/build/uClibc/libc/pwd_grp/getgrent.c
new file mode 100644
index 0000000..808e4e8
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrent_r.c b/ap/build/uClibc/libc/pwd_grp/getgrent_r.c
new file mode 100644
index 0000000..5f0b7c2
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrent_r.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+
+#ifdef __USE_GNU
+# define L_getgrent_r
+# include "pwd_grp.c"
+#endif
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrgid.c b/ap/build/uClibc/libc/pwd_grp/getgrgid.c
new file mode 100644
index 0000000..96ce903
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrgid.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrgid
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrgid_r.c b/ap/build/uClibc/libc/pwd_grp/getgrgid_r.c
new file mode 100644
index 0000000..a962f4c
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrgid_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrgid_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrnam.c b/ap/build/uClibc/libc/pwd_grp/getgrnam.c
new file mode 100644
index 0000000..3b47d9a
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrnam.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrnam
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrnam_r.c b/ap/build/uClibc/libc/pwd_grp/getgrnam_r.c
new file mode 100644
index 0000000..592a66c
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrnam_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrnam_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getgrouplist.c b/ap/build/uClibc/libc/pwd_grp/getgrouplist.c
new file mode 100644
index 0000000..a4eba7d
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getgrouplist.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getgrouplist
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpw.c b/ap/build/uClibc/libc/pwd_grp/getpw.c
new file mode 100644
index 0000000..943da3f
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpw.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+
+#ifdef __USE_GNU
+# define L_getpw
+# include "pwd_grp.c"
+#endif
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwent.c b/ap/build/uClibc/libc/pwd_grp/getpwent.c
new file mode 100644
index 0000000..a617bc8
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwent_r.c b/ap/build/uClibc/libc/pwd_grp/getpwent_r.c
new file mode 100644
index 0000000..9f00b05
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwent_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwnam.c b/ap/build/uClibc/libc/pwd_grp/getpwnam.c
new file mode 100644
index 0000000..d00640b
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwnam.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwnam
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwnam_r.c b/ap/build/uClibc/libc/pwd_grp/getpwnam_r.c
new file mode 100644
index 0000000..a4440e7
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwnam_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwnam_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwuid.c b/ap/build/uClibc/libc/pwd_grp/getpwuid.c
new file mode 100644
index 0000000..16ac50f
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwuid.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwuid
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getpwuid_r.c b/ap/build/uClibc/libc/pwd_grp/getpwuid_r.c
new file mode 100644
index 0000000..21d39ed
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getpwuid_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getpwuid_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getspent.c b/ap/build/uClibc/libc/pwd_grp/getspent.c
new file mode 100644
index 0000000..5699b67
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getspent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getspent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getspent_r.c b/ap/build/uClibc/libc/pwd_grp/getspent_r.c
new file mode 100644
index 0000000..da147a5
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getspent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getspent_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getspnam.c b/ap/build/uClibc/libc/pwd_grp/getspnam.c
new file mode 100644
index 0000000..19e40c7
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getspnam.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getspnam
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/getspnam_r.c b/ap/build/uClibc/libc/pwd_grp/getspnam_r.c
new file mode 100644
index 0000000..053b697
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/getspnam_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_getspnam_r
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/initgroups.c b/ap/build/uClibc/libc/pwd_grp/initgroups.c
new file mode 100644
index 0000000..d02be5e
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/initgroups.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_initgroups
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/lckpwdf.c b/ap/build/uClibc/libc/pwd_grp/lckpwdf.c
new file mode 100644
index 0000000..adbc616
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/lckpwdf.c
@@ -0,0 +1,152 @@
+/* vi: set sw=4 ts=4: */
+/* Handle locking of password file.
+   Copyright (C) 1996,98,2000,02 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <features.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/file.h>
+#include <paths.h>
+#include <shadow.h>
+
+/* How long to wait for getting the lock before returning with an error.  */
+#define TIMEOUT 15 /* sec */
+
+/* File descriptor for lock file.  */
+static int lock_fd = -1;
+
+/* Prevent problems in multithreaded program by using mutex.  */
+#include <bits/uClibc_mutex.h>
+__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
+
+/* Prototypes for local functions.  */
+static void noop_handler (int __sig);
+
+
+int
+lckpwdf (void)
+{
+  sigset_t saved_set;			/* Saved set of caught signals.  */
+  struct sigaction saved_act;		/* Saved signal action.  */
+  sigset_t new_set;			/* New set of caught signals.  */
+  struct sigaction new_act;		/* New signal action.  */
+  struct flock fl;			/* Information struct for locking.  */
+  int result;
+
+  if (lock_fd != -1)
+    /* Still locked by own process.  */
+    return -1;
+
+  /* Prevent problems caused by multiple threads.  */
+  __UCLIBC_MUTEX_LOCK(mylock);
+
+  lock_fd = open (_PATH_PASSWD, O_WRONLY | O_CLOEXEC);
+  if (lock_fd == -1) {
+    goto DONE;
+  }
+#ifndef __ASSUME_O_CLOEXEC
+  /* Make sure file gets correctly closed when process finished.  */
+  fcntl (lock_fd, F_SETFD, FD_CLOEXEC);
+#endif
+
+  /* Now we have to get exclusive write access.  Since multiple
+     process could try this we won't stop when it first fails.
+     Instead we set a timeout for the system call.  Once the timer
+     expires it is likely that there are some problems which cannot be
+     resolved by waiting. (sa_flags have no SA_RESTART. Thus SIGALRM
+     will EINTR fcntl(F_SETLKW)
+
+     It is important that we don't change the signal state.  We must
+     restore the old signal behaviour.  */
+  memset (&new_act, '\0', sizeof (new_act));
+  new_act.sa_handler = noop_handler;
+  __sigfillset (&new_act.sa_mask);
+
+  /* Install new action handler for alarm and save old.
+   * This never fails in Linux.  */
+  sigaction (SIGALRM, &new_act, &saved_act);
+
+  /* Now make sure the alarm signal is not blocked.  */
+  __sigemptyset (&new_set);
+  __sigaddset (&new_set, SIGALRM);
+  sigprocmask (SIG_UNBLOCK, &new_set, &saved_set);
+
+  /* Start timer.  If we cannot get the lock in the specified time we
+     get a signal.  */
+  alarm (TIMEOUT);
+
+  /* Try to get the lock.  */
+  memset (&fl, '\0', sizeof (fl));
+  if (F_WRLCK)
+    fl.l_type = F_WRLCK;
+  if (SEEK_SET)
+    fl.l_whence = SEEK_SET;
+  result = fcntl (lock_fd, F_SETLKW, &fl);
+
+  /* Clear alarm.  */
+  alarm (0);
+
+  sigprocmask (SIG_SETMASK, &saved_set, NULL);
+  sigaction (SIGALRM, &saved_act, NULL);
+
+  if (result < 0) {
+    close(lock_fd);
+    lock_fd = -1;
+  }
+
+DONE:
+  __UCLIBC_MUTEX_UNLOCK(mylock);
+  return 0; /* TODO: return result? */
+}
+
+
+int
+ulckpwdf (void)
+{
+  int result;
+
+  if (lock_fd == -1)
+    /* There is no lock set.  */
+    result = -1;
+  else
+    {
+      /* Prevent problems caused by multiple threads.  */
+      __UCLIBC_MUTEX_LOCK(mylock);
+
+      result = close (lock_fd);
+
+      /* Mark descriptor as unused.  */
+      lock_fd = -1;
+
+      /* Clear mutex.  */
+      __UCLIBC_MUTEX_UNLOCK(mylock);
+    }
+
+  return result;
+}
+
+
+static void
+noop_handler (int sig attribute_unused) {
+
+  /* We simply return which makes the `fcntl' call return with an error.  */
+}
diff --git a/ap/build/uClibc/libc/pwd_grp/putgrent.c b/ap/build/uClibc/libc/pwd_grp/putgrent.c
new file mode 100644
index 0000000..20a6faf
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/putgrent.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+
+#ifdef __USE_GNU
+# define L_putgrent
+# include "pwd_grp.c"
+#endif
diff --git a/ap/build/uClibc/libc/pwd_grp/putpwent.c b/ap/build/uClibc/libc/pwd_grp/putpwent.c
new file mode 100644
index 0000000..045462e
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/putpwent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_putpwent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/putspent.c b/ap/build/uClibc/libc/pwd_grp/putspent.c
new file mode 100644
index 0000000..d6b5b28
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/putspent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_putspent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/pwd_grp.c b/ap/build/uClibc/libc/pwd_grp/pwd_grp.c
new file mode 100644
index 0000000..f5c22f8
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/pwd_grp.c
@@ -0,0 +1,1185 @@
+/*
+ * Copyright (C) 2003     Manuel Novoa III <mjn3@uclibc.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*  Nov 6, 2003  Initial version.
+ *
+ *  NOTE: This implementation is quite strict about requiring all
+ *    field seperators.  It also does not allow leading whitespace
+ *    except when processing the numeric fields.  glibc is more
+ *    lenient.  See the various glibc difference comments below.
+ *
+ *  TODO:
+ *    Move to dynamic allocation of (currently statically allocated)
+ *      buffers; especially for the group-related functions since
+ *      large group member lists will cause error returns.
+ *
+ */
+
+#include <features.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stddef.h>
+#include <errno.h>
+#include <assert.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <grp.h>
+#include <paths.h>
+#ifdef __UCLIBC_HAS_SHADOW__
+# include <shadow.h>
+#endif
+#include <bits/uClibc_mutex.h>
+
+/**********************************************************************/
+/* Prototypes for internal functions. */
+
+extern int __parsepwent(void *pw, char *line) attribute_hidden;
+extern int __parsegrent(void *gr, char *line) attribute_hidden;
+extern int __parsespent(void *sp, char *line) attribute_hidden;
+
+extern int __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
+			   char *__restrict line_buff, size_t buflen, FILE *f) attribute_hidden;
+
+extern gid_t* __getgrouplist_internal(const char *user, gid_t gid, int *ngroups) attribute_hidden;
+
+/**********************************************************************/
+/* For the various fget??ent_r funcs, return
+ *
+ *  0: success
+ *  ENOENT: end-of-file encountered
+ *  ERANGE: buflen too small
+ *  other error values possible. See __pgsreader.
+ *
+ * Also, *result == resultbuf on success and NULL on failure.
+ *
+ * NOTE: glibc difference - For the ENOENT case, glibc also sets errno.
+ *   We do not, as it really isn't an error if we reach the end-of-file.
+ *   Doing so is analogous to having fgetc() set errno on EOF.
+ */
+/**********************************************************************/
+#ifdef L_fgetpwent_r
+
+#ifdef __USE_SVID
+int fgetpwent_r(FILE *__restrict stream, struct passwd *__restrict resultbuf,
+				char *__restrict buffer, size_t buflen,
+				struct passwd **__restrict result)
+{
+	int rv;
+
+	*result = NULL;
+
+	if (!(rv = __pgsreader(__parsepwent, resultbuf, buffer, buflen, stream))) {
+		*result = resultbuf;
+	}
+
+	return rv;
+}
+libc_hidden_def(fgetpwent_r)
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_fgetgrent_r
+
+#ifdef __USE_SVID
+int fgetgrent_r(FILE *__restrict stream, struct group *__restrict resultbuf,
+				char *__restrict buffer, size_t buflen,
+				struct group **__restrict result)
+{
+	int rv;
+
+	*result = NULL;
+
+	if (!(rv = __pgsreader(__parsegrent, resultbuf, buffer, buflen, stream))) {
+		*result = resultbuf;
+	}
+
+	return rv;
+}
+libc_hidden_def(fgetgrent_r)
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_fgetspent_r
+
+int fgetspent_r(FILE *__restrict stream, struct spwd *__restrict resultbuf,
+				char *__restrict buffer, size_t buflen,
+				struct spwd **__restrict result)
+{
+	int rv;
+
+	*result = NULL;
+
+	if (!(rv = __pgsreader(__parsespent, resultbuf, buffer, buflen, stream))) {
+		*result = resultbuf;
+	}
+
+	return rv;
+}
+libc_hidden_def(fgetspent_r)
+
+#endif
+/**********************************************************************/
+/* For the various fget??ent funcs, return NULL on failure and a
+ * pointer to the appropriate struct (statically allocated) on success.
+ */
+/**********************************************************************/
+#ifdef L_fgetpwent
+
+#ifdef __USE_SVID
+
+struct passwd *fgetpwent(FILE *stream)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct passwd resultbuf;
+	struct passwd *result;
+
+	fgetpwent_r(stream, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_fgetgrent
+
+#ifdef __USE_SVID
+
+struct group *fgetgrent(FILE *stream)
+{
+	static char buffer[__UCLIBC_GRP_BUFFER_SIZE__];
+	static struct group resultbuf;
+	struct group *result;
+
+	fgetgrent_r(stream, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_fgetspent
+
+
+struct spwd *fgetspent(FILE *stream)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct spwd resultbuf;
+	struct spwd *result;
+
+	fgetspent_r(stream, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_sgetspent_r
+
+int sgetspent_r(const char *string, struct spwd *result_buf,
+				char *buffer, size_t buflen, struct spwd **result)
+{
+	int rv = ERANGE;
+
+	*result = NULL;
+
+	if (buflen < __UCLIBC_PWD_BUFFER_SIZE__) {
+	DO_ERANGE:
+		__set_errno(rv);
+		goto DONE;
+	}
+
+	if (string != buffer) {
+		if (strlen(string) >= buflen) {
+			goto DO_ERANGE;
+		}
+		strcpy(buffer, string);
+	}
+
+	if (!(rv = __parsespent(result_buf, buffer))) {
+		*result = result_buf;
+	}
+
+ DONE:
+	return rv;
+}
+libc_hidden_def(sgetspent_r)
+
+#endif
+/**********************************************************************/
+
+#ifdef GETXXKEY_R_FUNC
+#error GETXXKEY_R_FUNC is already defined!
+#endif
+
+#ifdef L_getpwnam_r
+#define GETXXKEY_R_FUNC		getpwnam_r
+#define GETXXKEY_R_PARSER	__parsepwent
+#define GETXXKEY_R_ENTTYPE	struct passwd
+#define GETXXKEY_R_TEST(ENT)	(!strcmp((ENT)->pw_name, key))
+#define DO_GETXXKEY_R_KEYTYPE	const char *__restrict
+#define DO_GETXXKEY_R_PATHNAME  _PATH_PASSWD
+#include "pwd_grp_internal.c"
+#endif
+
+#ifdef L_getgrnam_r
+#define GETXXKEY_R_FUNC		getgrnam_r
+#define GETXXKEY_R_PARSER	__parsegrent
+#define GETXXKEY_R_ENTTYPE	struct group
+#define GETXXKEY_R_TEST(ENT)	(!strcmp((ENT)->gr_name, key))
+#define DO_GETXXKEY_R_KEYTYPE	const char *__restrict
+#define DO_GETXXKEY_R_PATHNAME  _PATH_GROUP
+#include "pwd_grp_internal.c"
+#endif
+
+#ifdef L_getspnam_r
+#define GETXXKEY_R_FUNC		getspnam_r
+#define GETXXKEY_R_PARSER	__parsespent
+#define GETXXKEY_R_ENTTYPE	struct spwd
+#define GETXXKEY_R_TEST(ENT)	(!strcmp((ENT)->sp_namp, key))
+#define DO_GETXXKEY_R_KEYTYPE	const char *__restrict
+#define DO_GETXXKEY_R_PATHNAME  _PATH_SHADOW
+#include "pwd_grp_internal.c"
+#endif
+
+#ifdef L_getpwuid_r
+#define GETXXKEY_R_FUNC		getpwuid_r
+#define GETXXKEY_R_PARSER	__parsepwent
+#define GETXXKEY_R_ENTTYPE	struct passwd
+#define GETXXKEY_R_TEST(ENT)	((ENT)->pw_uid == key)
+#define DO_GETXXKEY_R_KEYTYPE	uid_t
+#define DO_GETXXKEY_R_PATHNAME  _PATH_PASSWD
+#include "pwd_grp_internal.c"
+#endif
+
+#ifdef L_getgrgid_r
+#define GETXXKEY_R_FUNC		getgrgid_r
+#define GETXXKEY_R_PARSER	__parsegrent
+#define GETXXKEY_R_ENTTYPE	struct group
+#define GETXXKEY_R_TEST(ENT)	((ENT)->gr_gid == key)
+#define DO_GETXXKEY_R_KEYTYPE	gid_t
+#define DO_GETXXKEY_R_PATHNAME  _PATH_GROUP
+#include "pwd_grp_internal.c"
+#endif
+
+/**********************************************************************/
+#ifdef L_getpwuid
+
+
+struct passwd *getpwuid(uid_t uid)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct passwd resultbuf;
+	struct passwd *result;
+
+	getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getgrgid
+
+
+struct group *getgrgid(gid_t gid)
+{
+	static char buffer[__UCLIBC_GRP_BUFFER_SIZE__];
+	static struct group resultbuf;
+	struct group *result;
+
+	getgrgid_r(gid, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getspuid_r
+
+/* This function is non-standard and is currently not built.  It seems
+ * to have been created as a reentrant version of the non-standard
+ * functions getspuid.  Why getspuid was added, I do not know. */
+
+
+int getspuid_r(uid_t uid, struct spwd *__restrict resultbuf,
+		       char *__restrict buffer, size_t buflen,
+		       struct spwd **__restrict result)
+{
+	int rv;
+	struct passwd *pp;
+	struct passwd password;
+	char pwd_buff[__UCLIBC_PWD_BUFFER_SIZE__];
+
+	*result = NULL;
+	if (!(rv = getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), &pp))) {
+		rv = getspnam_r(password.pw_name, resultbuf, buffer, buflen, result);
+	}
+
+	return rv;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getspuid
+
+/* This function is non-standard and is currently not built.
+ * Why it was added, I do not know. */
+
+struct spwd *getspuid(uid_t uid)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct spwd resultbuf;
+	struct spwd *result;
+
+	getspuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getpwnam
+
+
+struct passwd *getpwnam(const char *name)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct passwd resultbuf;
+	struct passwd *result;
+
+	getpwnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getgrnam
+
+
+struct group *getgrnam(const char *name)
+{
+	static char buffer[__UCLIBC_GRP_BUFFER_SIZE__];
+	static struct group resultbuf;
+	struct group *result;
+
+	getgrnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getspnam
+
+
+struct spwd *getspnam(const char *name)
+{
+	static char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct spwd resultbuf;
+	struct spwd *result;
+
+	getspnam_r(name, &resultbuf, buffer, sizeof(buffer), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getpw
+
+
+int getpw(uid_t uid, char *buf)
+{
+	struct passwd resultbuf;
+	struct passwd *result;
+	char buffer[__UCLIBC_PWD_BUFFER_SIZE__];
+
+	if (!buf) {
+		__set_errno(EINVAL);
+	} else if (!getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result)) {
+		if (sprintf(buf, "%s:%s:%lu:%lu:%s:%s:%s\n",
+					resultbuf.pw_name, resultbuf.pw_passwd,
+					(unsigned long)(resultbuf.pw_uid),
+					(unsigned long)(resultbuf.pw_gid),
+					resultbuf.pw_gecos, resultbuf.pw_dir,
+					resultbuf.pw_shell) >= 0
+			) {
+			return 0;
+		}
+	}
+
+	return -1;
+}
+
+#endif
+/**********************************************************************/
+
+#ifdef L_getpwent_r
+__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
+
+static FILE *pwf /*= NULL*/;
+
+void setpwent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (pwf) {
+		rewind(pwf);
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+void endpwent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (pwf) {
+		fclose(pwf);
+		pwf = NULL;
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+
+int getpwent_r(struct passwd *__restrict resultbuf,
+			   char *__restrict buffer, size_t buflen,
+			   struct passwd **__restrict result)
+{
+	int rv;
+
+	__UCLIBC_MUTEX_LOCK(mylock);
+
+	*result = NULL;				/* In case of error... */
+
+	if (!pwf) {
+		if (!(pwf = fopen(_PATH_PASSWD, "r"))) {
+			rv = errno;
+			goto ERR;
+		}
+		__STDIO_SET_USER_LOCKING(pwf);
+	}
+
+	if (!(rv = __pgsreader(__parsepwent, resultbuf,
+						   buffer, buflen, pwf))) {
+		*result = resultbuf;
+	}
+
+ ERR:
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+
+	return rv;
+}
+libc_hidden_def(getpwent_r)
+
+#endif
+/**********************************************************************/
+#ifdef L_getgrent_r
+__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
+
+static FILE *grf /*= NULL*/;
+
+void setgrent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (grf) {
+		rewind(grf);
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+void endgrent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (grf) {
+		fclose(grf);
+		grf = NULL;
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+int getgrent_r(struct group *__restrict resultbuf,
+			   char *__restrict buffer, size_t buflen,
+			   struct group **__restrict result)
+{
+	int rv;
+
+	__UCLIBC_MUTEX_LOCK(mylock);
+
+	*result = NULL;				/* In case of error... */
+
+	if (!grf) {
+		if (!(grf = fopen(_PATH_GROUP, "r"))) {
+			rv = errno;
+			goto ERR;
+		}
+		__STDIO_SET_USER_LOCKING(grf);
+	}
+
+	if (!(rv = __pgsreader(__parsegrent, resultbuf,
+						   buffer, buflen, grf))) {
+		*result = resultbuf;
+	}
+
+ ERR:
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+
+	return rv;
+}
+libc_hidden_def(getgrent_r)
+
+#endif
+/**********************************************************************/
+#ifdef L_getspent_r
+__UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
+
+static FILE *spf /*= NULL*/;
+
+void setspent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (spf) {
+		rewind(spf);
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+void endspent(void)
+{
+	__UCLIBC_MUTEX_LOCK(mylock);
+	if (spf) {
+		fclose(spf);
+		spf = NULL;
+	}
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+}
+
+int getspent_r(struct spwd *resultbuf, char *buffer,
+			   size_t buflen, struct spwd **result)
+{
+	int rv;
+
+	__UCLIBC_MUTEX_LOCK(mylock);
+
+	*result = NULL;				/* In case of error... */
+
+	if (!spf) {
+		if (!(spf = fopen(_PATH_SHADOW, "r"))) {
+			rv = errno;
+			goto ERR;
+		}
+		__STDIO_SET_USER_LOCKING(spf);
+	}
+
+	if (!(rv = __pgsreader(__parsespent, resultbuf,
+						   buffer, buflen, spf))) {
+		*result = resultbuf;
+	}
+
+ ERR:
+	__UCLIBC_MUTEX_UNLOCK(mylock);
+
+	return rv;
+}
+libc_hidden_def(getspent_r)
+
+#endif
+/**********************************************************************/
+#ifdef L_getpwent
+
+
+struct passwd *getpwent(void)
+{
+	static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct passwd pwd;
+	struct passwd *result;
+
+	getpwent_r(&pwd, line_buff, sizeof(line_buff), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getgrent
+
+
+struct group *getgrent(void)
+{
+	static char line_buff[__UCLIBC_GRP_BUFFER_SIZE__];
+	static struct group gr;
+	struct group *result;
+
+	getgrent_r(&gr, line_buff, sizeof(line_buff), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getspent
+
+
+struct spwd *getspent(void)
+{
+	static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct spwd spwd;
+	struct spwd *result;
+
+	getspent_r(&spwd, line_buff, sizeof(line_buff), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_sgetspent
+
+
+struct spwd *sgetspent(const char *string)
+{
+	static char line_buff[__UCLIBC_PWD_BUFFER_SIZE__];
+	static struct spwd spwd;
+	struct spwd *result;
+
+	sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), &result);
+	return result;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L___getgrouplist_internal
+
+gid_t attribute_hidden *__getgrouplist_internal(const char *user, gid_t gid, int *ngroups)
+{
+	FILE *grfile;
+	gid_t *group_list;
+	int num_groups;
+	struct group group;
+	char buff[__UCLIBC_PWD_BUFFER_SIZE__];
+
+	*ngroups = num_groups = 1;
+
+	/* We alloc space for 8 gids at a time. */
+	group_list = malloc(8 * sizeof(group_list[0]));
+	if (!group_list)
+		return NULL;
+
+	group_list[0] = gid;
+	grfile = fopen(_PATH_GROUP, "r");
+	/* If /etc/group doesn't exist, we still return 1-element vector */
+	if (!grfile)
+		return group_list;
+
+	__STDIO_SET_USER_LOCKING(grfile);
+
+	while (!__pgsreader(__parsegrent, &group, buff, sizeof(buff), grfile)) {
+		char **m;
+
+		assert(group.gr_mem); /* Must have at least a NULL terminator. */
+		if (group.gr_gid == gid)
+			continue;
+		for (m = group.gr_mem; *m; m++) {
+			if (strcmp(*m, user) != 0)
+				continue;
+			if (!(num_groups & 7)) {
+				gid_t *tmp = realloc(group_list, (num_groups+8) * sizeof(group_list[0]));
+				if (!tmp)
+					goto DO_CLOSE;
+				group_list = tmp;
+			}
+			group_list[num_groups++] = group.gr_gid;
+			break;
+		}
+	}
+
+ DO_CLOSE:
+	fclose(grfile);
+	*ngroups = num_groups;
+	return group_list;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_getgrouplist
+
+#if defined __USE_BSD || defined __USE_GNU
+int getgrouplist(const char *user, gid_t gid, gid_t *groups, int *ngroups)
+{
+	int sz = *ngroups;
+	gid_t *group_list = __getgrouplist_internal(user, gid, ngroups);
+
+	if (!group_list) {
+		/* malloc failure - what shall we do?
+		 * fail with ENOMEM? I bet users never check for that */
+		/* *ngroups = 1; - already done by __getgrouplist_internal */
+		if (sz) {
+			groups[0] = gid;
+			return 1;
+		}
+		return -1;
+	}
+	/* *ngroups is non-zero here */
+
+	if (sz > *ngroups)
+		sz = *ngroups;
+	if (sz)
+		memcpy(groups, group_list, sz * sizeof(group_list[0]));
+	free(group_list);
+	if (sz < *ngroups)
+		return -1;
+	return sz;
+}
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_initgroups
+
+#ifdef __USE_BSD
+
+int initgroups(const char *user, gid_t gid)
+{
+	int rv;
+	int num_groups = ((unsigned)~0) >> 1; /* INT_MAX */
+	gid_t *group_list = __getgrouplist_internal(user, gid, &num_groups);
+	if (!group_list)
+		return -1;
+	rv = setgroups(num_groups, group_list);
+	free(group_list);
+	return rv;
+}
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_putpwent
+
+#ifdef __USE_SVID
+int putpwent(const struct passwd *__restrict p, FILE *__restrict f)
+{
+	int rv = -1;
+
+	if (!p || !f) {
+		__set_errno(EINVAL);
+	} else {
+		/* No extra thread locking is needed above what fprintf does. */
+		if (fprintf(f, "%s:%s:%lu:%lu:%s:%s:%s\n",
+					p->pw_name, p->pw_passwd,
+					(unsigned long)(p->pw_uid),
+					(unsigned long)(p->pw_gid),
+					p->pw_gecos, p->pw_dir, p->pw_shell) >= 0
+			) {
+			rv = 0;
+		}
+	}
+
+	return rv;
+}
+#endif
+
+#endif
+/**********************************************************************/
+#ifdef L_putgrent
+
+int putgrent(const struct group *__restrict p, FILE *__restrict f)
+{
+	static const char format[] = ",%s";
+	char **m;
+	const char *fmt;
+	int rv = -1;
+	__STDIO_AUTO_THREADLOCK_VAR;
+
+	if (!p || !f) {				/* Sigh... glibc checks. */
+		__set_errno(EINVAL);
+	} else {
+		__STDIO_AUTO_THREADLOCK(f);
+
+		if (fprintf(f, "%s:%s:%lu:",
+					p->gr_name, p->gr_passwd,
+					(unsigned long)(p->gr_gid)) >= 0
+			) {
+
+			fmt = format + 1;
+
+			assert(p->gr_mem);
+			m = p->gr_mem;
+
+			do {
+				if (!*m) {
+					if (__fputc_unlocked('\n', f) >= 0) {
+						rv = 0;
+					}
+					break;
+				}
+				if (fprintf(f, fmt, *m) < 0) {
+					break;
+				}
+				++m;
+				fmt = format;
+			} while (1);
+
+		}
+
+		__STDIO_AUTO_THREADUNLOCK(f);
+	}
+
+	return rv;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L_putspent
+
+static const unsigned char _sp_off[] = {
+	offsetof(struct spwd, sp_lstchg),	/* 2 - not a char ptr */
+	offsetof(struct spwd, sp_min),		/* 3 - not a char ptr */
+	offsetof(struct spwd, sp_max),		/* 4 - not a char ptr */
+	offsetof(struct spwd, sp_warn),		/* 5 - not a char ptr */
+	offsetof(struct spwd, sp_inact),	/* 6 - not a char ptr */
+	offsetof(struct spwd, sp_expire),	/* 7 - not a char ptr */
+};
+
+int putspent(const struct spwd *p, FILE *stream)
+{
+	static const char ld_format[] = "%ld:";
+	const char *f;
+	long int x;
+	size_t i;
+	int rv = -1;
+	__STDIO_AUTO_THREADLOCK_VAR;
+
+	/* Unlike putpwent and putgrent, glibc does not check the args. */
+
+	__STDIO_AUTO_THREADLOCK(stream);
+
+	if (fprintf(stream, "%s:%s:", p->sp_namp,
+				(p->sp_pwdp ? p->sp_pwdp : "")) < 0
+		) {
+		goto DO_UNLOCK;
+	}
+
+	for (i=0 ; i < sizeof(_sp_off) ; i++) {
+		f = ld_format;
+		if ((x = *(const long int *)(((const char *) p) + _sp_off[i])) == -1) {
+			f += 3;
+		}
+		if (fprintf(stream, f, x) < 0) {
+			goto DO_UNLOCK;
+		}
+	}
+
+	if ((p->sp_flag != ~0UL) && (fprintf(stream, "%lu", p->sp_flag) < 0)) {
+		goto DO_UNLOCK;
+	}
+
+	if (__fputc_unlocked('\n', stream) > 0) {
+		rv = 0;
+	}
+
+ DO_UNLOCK:
+	__STDIO_AUTO_THREADUNLOCK(stream);
+
+	return rv;
+}
+
+#endif
+/**********************************************************************/
+/* Internal uClibc functions.                                         */
+/**********************************************************************/
+#ifdef L___parsepwent
+
+static const unsigned char pw_off[] = {
+	offsetof(struct passwd, pw_name),	/* 0 */
+	offsetof(struct passwd, pw_passwd),	/* 1 */
+	offsetof(struct passwd, pw_uid),	/* 2 - not a char ptr */
+	offsetof(struct passwd, pw_gid),	/* 3 - not a char ptr */
+	offsetof(struct passwd, pw_gecos),	/* 4 */
+	offsetof(struct passwd, pw_dir),	/* 5 */
+	offsetof(struct passwd, pw_shell)	/* 6 */
+};
+
+int attribute_hidden __parsepwent(void *data, char *line)
+{
+	char *endptr;
+	char *p;
+	int i;
+
+	i = 0;
+	do {
+		p = ((char *) ((struct passwd *) data)) + pw_off[i];
+
+		if ((i & 6) ^ 2) {	/* i!=2 and i!=3 */
+			*((char **) p) = line;
+			if (i==6) {
+				return 0;
+			}
+			/* NOTE: glibc difference - glibc allows omission of
+			 * ':' seperators after the gid field if all remaining
+			 * entries are empty.  We require all separators. */
+			if (!(line = strchr(line, ':'))) {
+				break;
+			}
+		} else {
+			unsigned long t = strtoul(line, &endptr, 10);
+			/* Make sure we had at least one digit, and that the
+			 * failing char is the next field seperator ':'.  See
+			 * glibc difference note above. */
+			/* TODO: Also check for leading whitespace? */
+			if ((endptr == line) || (*endptr != ':')) {
+				break;
+			}
+			line = endptr;
+			if (i & 1) {		/* i == 3 -- gid */
+				*((gid_t *) p) = t;
+			} else {			/* i == 2 -- uid */
+				*((uid_t *) p) = t;
+			}
+		}
+
+		*line++ = 0;
+		++i;
+	} while (1);
+
+	return -1;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L___parsegrent
+
+static const unsigned char gr_off[] = {
+	offsetof(struct group, gr_name),	/* 0 */
+	offsetof(struct group, gr_passwd),	/* 1 */
+	offsetof(struct group, gr_gid)		/* 2 - not a char ptr */
+};
+
+int attribute_hidden __parsegrent(void *data, char *line)
+{
+	char *endptr;
+	char *p;
+	int i;
+	char **members;
+	char *end_of_buf;
+
+	end_of_buf = ((struct group *) data)->gr_name; /* Evil hack! */
+	i = 0;
+	do {
+		p = ((char *) ((struct group *) data)) + gr_off[i];
+
+		if (i < 2) {
+			*((char **) p) = line;
+			if (!(line = strchr(line, ':'))) {
+				break;
+			}
+			*line++ = 0;
+			++i;
+		} else {
+			*((gid_t *) p) = strtoul(line, &endptr, 10);
+
+			/* NOTE: glibc difference - glibc allows omission of the
+			 * trailing colon when there is no member list.  We treat
+			 * this as an error. */
+
+			/* Make sure we had at least one digit, and that the
+			 * failing char is the next field seperator ':'.  See
+			 * glibc difference note above. */
+			if ((endptr == line) || (*endptr != ':')) {
+				break;
+			}
+
+			i = 1;				/* Count terminating NULL ptr. */
+			p = endptr;
+
+			if (p[1]) { /* We have a member list to process. */
+				/* Overwrite the last ':' with a ',' before counting.
+				 * This allows us to test for initial ',' and adds
+				 * one ',' so that the ',' count equals the member
+				 * count. */
+				*p = ',';
+				do {
+					/* NOTE: glibc difference - glibc allows and trims leading
+					 * (but not trailing) space.  We treat this as an error. */
+					/* NOTE: glibc difference - glibc allows consecutive and
+					 * trailing commas, and ignores "empty string" users.  We
+					 * treat this as an error. */
+					if (*p == ',') {
+						++i;
+						*p = 0;	/* nul-terminate each member string. */
+						if (!*++p || (*p == ',') || isspace(*p)) {
+							goto ERR;
+						}
+					}
+				} while (*++p);
+			}
+
+			/* Now align (p+1), rounding up. */
+			/* Assumes sizeof(char **) is a power of 2. */
+			members = (char **)( (((intptr_t) p) + sizeof(char **))
+								 & ~((intptr_t)(sizeof(char **) - 1)) );
+
+			if (((char *)(members + i)) > end_of_buf) {	/* No space. */
+				break;
+			}
+
+			((struct group *) data)->gr_mem = members;
+
+			if (--i) {
+				p = endptr;	/* Pointing to char prior to first member. */
+				do {
+					*members++ = ++p;
+					if (!--i) break;
+					while (*++p) {}
+				} while (1);
+			}
+			*members = NULL;
+
+			return 0;
+		}
+	} while (1);
+
+ ERR:
+	return -1;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L___parsespent
+
+static const unsigned char sp_off[] = {
+	offsetof(struct spwd, sp_namp),		/* 0 */
+	offsetof(struct spwd, sp_pwdp),		/* 1 */
+	offsetof(struct spwd, sp_lstchg),	/* 2 - not a char ptr */
+	offsetof(struct spwd, sp_min),		/* 3 - not a char ptr */
+	offsetof(struct spwd, sp_max),		/* 4 - not a char ptr */
+	offsetof(struct spwd, sp_warn),		/* 5 - not a char ptr */
+	offsetof(struct spwd, sp_inact),	/* 6 - not a char ptr */
+	offsetof(struct spwd, sp_expire),	/* 7 - not a char ptr */
+	offsetof(struct spwd, sp_flag)		/* 8 - not a char ptr */
+};
+
+int attribute_hidden __parsespent(void *data, char * line)
+{
+	char *endptr;
+	char *p;
+	int i;
+
+	i = 0;
+	do {
+		p = ((char *) ((struct spwd *) data)) + sp_off[i];
+		if (i < 2) {
+			*((char **) p) = line;
+			if (!(line = strchr(line, ':'))) {
+				break;
+			}
+		} else {
+#if 0
+			if (i==5) {			/* Support for old format. */
+				while (isspace(*line)) ++line; /* glibc eats space here. */
+				if (!*line) {
+					((struct spwd *) data)->sp_warn = -1;
+					((struct spwd *) data)->sp_inact = -1;
+					((struct spwd *) data)->sp_expire = -1;
+					((struct spwd *) data)->sp_flag = ~0UL;
+					return 0;
+				}
+			}
+#endif
+
+			*((long *) p) = (long) strtoul(line, &endptr, 10);
+
+			if (endptr == line) {
+				*((long *) p) = ((i != 8) ? -1L : ((long)(~0UL)));
+			}
+
+			line = endptr;
+
+			if (i == 8) {
+				if (!*endptr) {
+					return 0;
+				}
+				break;
+			}
+
+			if (*endptr != ':') {
+				break;
+			}
+
+		}
+
+		*line++ = 0;
+		++i;
+	} while (1);
+
+	return EINVAL;
+}
+
+#endif
+/**********************************************************************/
+#ifdef L___pgsreader
+
+/* Reads until if EOF, or until if finds a line which fits in the buffer
+ * and for which the parser function succeeds.
+ *
+ * Returns 0 on success and ENOENT for end-of-file (glibc concession).
+ */
+
+int attribute_hidden __pgsreader(int (*__parserfunc)(void *d, char *line), void *data,
+				char *__restrict line_buff, size_t buflen, FILE *f)
+{
+	size_t line_len;
+	int skip;
+	int rv = ERANGE;
+	__STDIO_AUTO_THREADLOCK_VAR;
+
+	if (buflen < __UCLIBC_PWD_BUFFER_SIZE__) {
+		__set_errno(rv);
+	} else {
+		__STDIO_AUTO_THREADLOCK(f);
+
+		skip = 0;
+		do {
+			if (!fgets_unlocked(line_buff, buflen, f)) {
+				if (feof_unlocked(f)) {
+					rv = ENOENT;
+				}
+				break;
+			}
+
+			line_len = strlen(line_buff) - 1; /* strlen() must be > 0. */
+			if (line_buff[line_len] == '\n') {
+				line_buff[line_len] = 0;
+			} else if (line_len + 2 == buflen) { /* line too long */
+				++skip;
+				continue;
+			}
+
+			if (skip) {
+				--skip;
+				continue;
+			}
+
+			/* NOTE: glibc difference - glibc strips leading whitespace from
+			 * records.  We do not allow leading whitespace. */
+
+			/* Skip empty lines, comment lines, and lines with leading
+			 * whitespace. */
+			if (*line_buff && (*line_buff != '#') && !isspace(*line_buff)) {
+				if (__parserfunc == __parsegrent) {	/* Do evil group hack. */
+					/* The group entry parsing function needs to know where
+					 * the end of the buffer is so that it can construct the
+					 * group member ptr table. */
+					((struct group *) data)->gr_name = line_buff + buflen;
+				}
+
+				if (!__parserfunc(data, line_buff)) {
+					rv = 0;
+					break;
+				}
+			}
+		} while (1);
+
+		__STDIO_AUTO_THREADUNLOCK(f);
+	}
+
+	return rv;
+}
+
+#endif
+/**********************************************************************/
diff --git a/ap/build/uClibc/libc/pwd_grp/pwd_grp_internal.c b/ap/build/uClibc/libc/pwd_grp/pwd_grp_internal.c
new file mode 100644
index 0000000..c897478
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/pwd_grp_internal.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2003     Manuel Novoa III <mjn3@uclibc.org>
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*  Nov 6, 2003  Initial version.
+ *
+ *  NOTE: This implementation is quite strict about requiring all
+ *    field seperators.  It also does not allow leading whitespace
+ *    except when processing the numeric fields.  glibc is more
+ *    lenient.  See the various glibc difference comments below.
+ *
+ *  TODO:
+ *    Move to dynamic allocation of (currently statically allocated)
+ *      buffers; especially for the group-related functions since
+ *      large group member lists will cause error returns.
+ *
+ */
+
+#include <features.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stddef.h>
+#include <errno.h>
+#include <assert.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <grp.h>
+#include <paths.h>
+#ifdef __UCLIBC_HAS_SHADOW__
+#include <shadow.h>
+#endif
+#ifdef __UCLIBC_HAS_THREADS__
+#include <pthread.h>
+#endif
+
+/**********************************************************************/
+/* Sizes for statically allocated buffers. */
+
+/* If you change these values, also change _SC_GETPW_R_SIZE_MAX and
+ * _SC_GETGR_R_SIZE_MAX in libc/unistd/sysconf.c to match */
+#define PWD_BUFFER_SIZE 256
+#define GRP_BUFFER_SIZE 256
+
+/**********************************************************************/
+/* Prototypes for internal functions. */
+
+#ifndef GETXXKEY_R_FUNC
+#error GETXXKEY_R_FUNC is not defined!
+#endif
+/**********************************************************************/
+#ifdef GETXXKEY_R_FUNC
+
+libc_hidden_proto(GETXXKEY_R_FUNC)
+int GETXXKEY_R_FUNC(DO_GETXXKEY_R_KEYTYPE key,
+					GETXXKEY_R_ENTTYPE *__restrict resultbuf,
+					char *__restrict buffer, size_t buflen,
+					GETXXKEY_R_ENTTYPE **__restrict result)
+{
+	FILE *stream;
+	int rv;
+
+	*result = NULL;
+
+	if (!(stream = fopen(DO_GETXXKEY_R_PATHNAME, "r"))) {
+		rv = errno;
+	} else {
+		__STDIO_SET_USER_LOCKING(stream);
+		do {
+			if (!(rv = __pgsreader(GETXXKEY_R_PARSER, resultbuf,
+								   buffer, buflen, stream))
+				) {
+				if (GETXXKEY_R_TEST(resultbuf)) { /* Found key? */
+					*result = resultbuf;
+					break;
+				}
+			} else {
+				if (rv == ENOENT) {	/* end-of-file encountered. */
+					rv = 0;
+				}
+				break;
+			}
+		} while (1);
+		fclose(stream);
+	}
+
+	return rv;
+}
+libc_hidden_def(GETXXKEY_R_FUNC)
+
+#endif
+/**********************************************************************/
+#undef GETXXKEY_R_FUNC_HIDDEN
+#undef GETXXKEY_R_FUNC
+#undef GETXXKEY_R_PARSER
+#undef GETXXKEY_R_ENTTYPE
+#undef GETXXKEY_R_TEST
+#undef DO_GETXXKEY_R_KEYTYPE
+#undef DO_GETXXKEY_R_PATHNAME
diff --git a/ap/build/uClibc/libc/pwd_grp/sgetspent.c b/ap/build/uClibc/libc/pwd_grp/sgetspent.c
new file mode 100644
index 0000000..877a247
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/sgetspent.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_sgetspent
+#include "pwd_grp.c"
diff --git a/ap/build/uClibc/libc/pwd_grp/sgetspent_r.c b/ap/build/uClibc/libc/pwd_grp/sgetspent_r.c
new file mode 100644
index 0000000..131e0bd
--- /dev/null
+++ b/ap/build/uClibc/libc/pwd_grp/sgetspent_r.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_sgetspent_r
+#include "pwd_grp.c"