zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/misc/error/Makefile b/ap/build/uClibc/libc/misc/error/Makefile
new file mode 100644
index 0000000..4a8f4a0
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/error/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/misc/error/Makefile.in b/ap/build/uClibc/libc/misc/error/Makefile.in
new file mode 100644
index 0000000..b76a0df
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/error/Makefile.in
@@ -0,0 +1,29 @@
+# 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/misc/error
+
+CSRC :=
+ifeq ($(UCLIBC_HAS_BSD_ERR),y)
+CSRC += err.c
+endif
+ifeq ($(UCLIBC_HAS_GNU_ERROR),y)
+CSRC += error.c
+endif
+
+MISC_ERROR_DIR := $(top_srcdir)libc/misc/error
+MISC_ERROR_OUT := $(top_builddir)libc/misc/error
+
+MISC_ERROR_SRC := $(patsubst %.c,$(MISC_ERROR_DIR)/%.c,$(CSRC))
+MISC_ERROR_OBJ := $(patsubst %.c,$(MISC_ERROR_OUT)/%.o,$(CSRC))
+
+libc-y += $(MISC_ERROR_OBJ)
+
+objclean-y += CLEAN_libc/misc/error
+
+CLEAN_libc/misc/error:
+ $(do_rm) $(addprefix $(MISC_ERROR_OUT)/*., o os)
diff --git a/ap/build/uClibc/libc/misc/error/err.c b/ap/build/uClibc/libc/misc/error/err.c
new file mode 100644
index 0000000..9ddb596
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/error/err.c
@@ -0,0 +1,120 @@
+/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <err.h>
+#ifdef __UCLIBC_HAS_THREADS__
+#include <pthread.h>
+#endif
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning REMINDER: Deal with wide oriented stderr case.
+#endif
+
+#if defined __USE_BSD
+
+
+
+static void vwarn_work(const char *format, va_list args, int showerr)
+{
+ /* 0123 45678 9 a b*/
+ static const char fmt[] = "%s: \0: %s\n\0\n";
+ const char *f;
+ char buf[64];
+ __STDIO_AUTO_THREADLOCK_VAR;
+
+ /* Do this first, in case something below changes errno. */
+ f = fmt + 11; /* At 11. */
+ if (showerr) {
+ f -= 4; /* At 7. */
+ __xpg_strerror_r(errno, buf, sizeof(buf));
+ }
+
+ __STDIO_AUTO_THREADLOCK(stderr);
+
+ fprintf(stderr, fmt, __uclibc_progname);
+ if (format) {
+ vfprintf(stderr, format, args);
+ f -= 2; /* At 5 (showerr) or 9. */
+ }
+ fprintf(stderr, f, buf);
+
+ __STDIO_AUTO_THREADUNLOCK(stderr);
+}
+
+void vwarn(const char *format, va_list args)
+{
+ vwarn_work(format, args, 1);
+}
+libc_hidden_def(vwarn)
+
+void warn(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vwarn(format, args);
+ va_end(args);
+}
+
+void vwarnx(const char *format, va_list args)
+{
+ vwarn_work(format, args, 0);
+}
+libc_hidden_def(vwarnx)
+
+void warnx(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vwarnx(format, args);
+ va_end(args);
+}
+
+void verr(int status, const char *format, va_list args)
+{
+ vwarn(format, args);
+ exit(status);
+}
+libc_hidden_def(verr)
+
+void attribute_noreturn err(int status, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ verr(status, format, args);
+ /* This should get optimized away. We'll leave it now for safety. */
+ /* The loop is added only to keep gcc happy. */
+ while(1)
+ va_end(args);
+}
+
+void verrx(int status, const char *format, va_list args)
+{
+ vwarnx(format, args);
+ exit(status);
+}
+libc_hidden_def(verrx)
+
+void attribute_noreturn errx(int status, const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ verrx(status, format, args);
+ /* This should get optimized away. We'll leave it now for safety. */
+ /* The loop is added only to keep gcc happy. */
+ while(1)
+ va_end(args);
+}
+#endif
diff --git a/ap/build/uClibc/libc/misc/error/error.c b/ap/build/uClibc/libc/misc/error/error.c
new file mode 100644
index 0000000..a30a4de
--- /dev/null
+++ b/ap/build/uClibc/libc/misc/error/error.c
@@ -0,0 +1,106 @@
+/* Error handler for noninteractive utilities
+ Copyright (C) 1990-1998, 2000-2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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. */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+/* Adjusted slightly by Erik Andersen <andersen@uclibc.org> */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <error.h>
+
+
+/* This variable is incremented each time `error' is called. */
+unsigned int error_message_count = 0;
+/* Sometimes we want to have at most one error per line. This
+ variable controls whether this mode is selected or not. */
+int error_one_per_line;
+/* If NULL, error will flush stdout, then print on stderr the program
+ name, a colon and a space. Otherwise, error will call this
+ function without parameters instead. */
+void (*error_print_progname) (void) = NULL;
+
+extern __typeof(error) __error attribute_hidden;
+void __error (int status, int errnum, const char *message, ...)
+{
+ va_list args;
+
+ fflush (stdout);
+
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ fprintf (stderr, "%s: ", __uclibc_progname);
+
+ va_start (args, message);
+ vfprintf (stderr, message, args);
+ va_end (args);
+ ++error_message_count;
+ if (errnum) {
+ fprintf (stderr, ": %s", strerror (errnum));
+ }
+ putc ('\n', stderr);
+ if (status)
+ exit (status);
+}
+weak_alias(__error,error)
+
+extern __typeof(error_at_line) __error_at_line attribute_hidden;
+void __error_at_line (int status, int errnum, const char *file_name,
+ unsigned int line_number, const char *message, ...)
+{
+ va_list args;
+
+ if (error_one_per_line) {
+ static const char *old_file_name;
+ static unsigned int old_line_number;
+
+ if (old_line_number == line_number &&
+ (file_name == old_file_name || !strcmp (old_file_name, file_name)))
+ /* Simply return and print nothing. */
+ return;
+
+ old_file_name = file_name;
+ old_line_number = line_number;
+ }
+
+ fflush (stdout);
+
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ fprintf (stderr, "%s:", __uclibc_progname);
+
+ if (file_name != NULL)
+ fprintf (stderr, "%s:%d: ", file_name, line_number);
+
+ va_start (args, message);
+ vfprintf (stderr, message, args);
+ va_end (args);
+
+ ++error_message_count;
+ if (errnum) {
+ fprintf (stderr, ": %s", strerror (errnum));
+ }
+ putc ('\n', stderr);
+ if (status)
+ exit (status);
+}
+weak_alias(__error_at_line,error_at_line)