summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2010-04-18 15:03:27 +0000
committerbernard.xiong <[email protected]>2010-04-18 15:03:27 +0000
commit6f3e01a9c5736de512bbee5bec0458cc4621c8de (patch)
treee875ac7e4fd6e48341f891cab48beecdc2ec04f7 /libc
parentb90694ead12656a8025f043b5f066761328989d8 (diff)
move to components directory
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@636 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'libc')
-rw-r--r--libc/minilibc/SConscript10
-rw-r--r--libc/minilibc/ctype.c32
-rw-r--r--libc/minilibc/ctype.h20
-rw-r--r--libc/minilibc/math.c12
-rw-r--r--libc/minilibc/math.h4
-rw-r--r--libc/minilibc/stddef.h4
-rw-r--r--libc/minilibc/stdint.h33
-rw-r--r--libc/minilibc/stdio.h5
-rw-r--r--libc/minilibc/stdlib.c41
-rw-r--r--libc/minilibc/stdlib.h27
-rw-r--r--libc/minilibc/string.c623
-rw-r--r--libc/minilibc/string.h78
-rw-r--r--libc/minilibc/sys/time.h43
-rw-r--r--libc/minilibc/sys/types.h24
-rw-r--r--libc/minilibc/time.c174
-rw-r--r--libc/minilibc/time.h6
16 files changed, 0 insertions, 1136 deletions
diff --git a/libc/minilibc/SConscript b/libc/minilibc/SConscript
deleted file mode 100644
index 729d2fea00..0000000000
--- a/libc/minilibc/SConscript
+++ /dev/null
@@ -1,10 +0,0 @@
-Import('env')
-Import('RTT_ROOT')
-
-# The set of source files associated with this SConscript file.
-src_local = Glob('*.c')
-
-env.Append(CPPPATH = RTT_ROOT + '/libc/minilibc')
-
-obj = env.Object(src_local)
-Return('obj')
diff --git a/libc/minilibc/ctype.c b/libc/minilibc/ctype.c
deleted file mode 100644
index 8e02e1a904..0000000000
--- a/libc/minilibc/ctype.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * File : ctype.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- */
-
-#include <rtthread.h>
-#include <sys/types.h>
-
-#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
-#include "ctype.h"
-
-int isprint (int ch)
-{
- ch&=0x7f;
- return (ch>=32 && ch<127);
-}
-
-int isalpha(int ch)
-{
- return (unsigned int)((ch | 0x20) - 'a') < 26u;
-}
-
-#endif
diff --git a/libc/minilibc/ctype.h b/libc/minilibc/ctype.h
deleted file mode 100644
index fdbf7bf003..0000000000
--- a/libc/minilibc/ctype.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * File : ctype.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- */
-#ifndef __CTYPE_H__
-#define __CTYPE_H__
-
-int isprint(int c) __attribute__ ((__const__));
-int isalpha (int c) __attribute__ ((__const__));
-
-#endif
diff --git a/libc/minilibc/math.c b/libc/minilibc/math.c
deleted file mode 100644
index d86abe5877..0000000000
--- a/libc/minilibc/math.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <math.h>
-
-/* Fix me */
-double sin(double x)
-{
- #warning sin function not supported for this platform
-}
-
-double cos(double x)
-{
- #warning cos function not supported for this platform
-}
diff --git a/libc/minilibc/math.h b/libc/minilibc/math.h
deleted file mode 100644
index ac480d534a..0000000000
--- a/libc/minilibc/math.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __STDIO_H__
-#define __STDIO_H__
-
-#endif
diff --git a/libc/minilibc/stddef.h b/libc/minilibc/stddef.h
deleted file mode 100644
index b260acf79e..0000000000
--- a/libc/minilibc/stddef.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __STDDEF_H__
-#define __STDDEF_H__
-
-#endif
diff --git a/libc/minilibc/stdint.h b/libc/minilibc/stdint.h
deleted file mode 100644
index ce9c500867..0000000000
--- a/libc/minilibc/stdint.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __STDINT_H__
-#define __STDINT_H__
-
-#include <rtthread.h>
-
-typedef rt_int8_t int8_t;
-typedef rt_uint8_t uint8_t;
-typedef rt_int16_t int16_t;
-typedef rt_uint16_t uint16_t;
-typedef rt_int32_t int32_t;
-typedef rt_uint32_t uint32_t;
-
-/*
- * 7.18.2 Limits of specified-width integer types.
- *
- * The following object-like macros specify the minimum and maximum limits
- * of integer types corresponding to the typedef names defined above.
- */
-
-/* 7.18.2.1 Limits of exact-width integer types */
-#define INT8_MIN (-0x7f - 1)
-#define INT16_MIN (-0x7fff - 1)
-#define INT32_MIN (-0x7fffffff - 1)
-
-#define INT8_MAX 0x7f
-#define INT16_MAX 0x7fff
-#define INT32_MAX 0x7fffffff
-
-#define UINT8_MAX 0xff
-#define UINT16_MAX 0xffff
-#define UINT32_MAX 0xffffffffU
-
-#endif
diff --git a/libc/minilibc/stdio.h b/libc/minilibc/stdio.h
deleted file mode 100644
index cf115c499a..0000000000
--- a/libc/minilibc/stdio.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef __STDIO_H__
-#define __STDIO_H__
-
-#endif
-
diff --git a/libc/minilibc/stdlib.c b/libc/minilibc/stdlib.c
deleted file mode 100644
index 7c14036351..0000000000
--- a/libc/minilibc/stdlib.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * File : stdlib.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- */
-
-#include <rtthread.h>
-
-#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
-#include "stdlib.h"
-
-int errno = 0;
-int atoi(const char* s)
-{
- long int v=0;
- int sign=1;
- while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++;
- switch (*s)
- {
- case '-':
- sign=-1;
- case '+':
- ++s;
- }
- while ((unsigned int) (*s - '0') < 10u)
- {
- v=v*10+*s-'0';
- ++s;
- }
- return sign==-1?-v:v;
-}
-
-#endif
diff --git a/libc/minilibc/stdlib.h b/libc/minilibc/stdlib.h
deleted file mode 100644
index 89318b30d9..0000000000
--- a/libc/minilibc/stdlib.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * File : stdlib.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- */
-
-#ifndef __STDLIB_H__
-#define __STDLIB_H__
-
-#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
-int atoi(const char *nptr);
-#endif
-
-#define malloc rt_malloc
-#define free rt_free
-#define realloc rt_realloc
-#define calloc rt_calloc
-
-#endif
diff --git a/libc/minilibc/string.c b/libc/minilibc/string.c
deleted file mode 100644
index 52726f2cbf..0000000000
--- a/libc/minilibc/string.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * File : string.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- * 2010-02-15 Gary Lee add strlcpy
- * 2010-03-17 Bernard add strlcpy implementation to this file.
- * fix strlcpy declaration
- * 2010-03-24 Bernard add strchr and strtok implementation.
- */
-
-#include <rtthread.h>
-
-#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
-#include "string.h"
-
-/* there is no strcpy and strcmp implementation in RT-Thread */
-char *strcpy(char *dest, const char *src)
-{
- return (char *)rt_strncpy(dest, src, rt_strlen(src) + 1);
-}
-
-char *strncpy(char *dest, const char *src, size_t siz)
-{
- return (char *)rt_strncpy(dest, src, siz);
-}
-
-size_t strlcpy(char *dst, const char *src, size_t siz)
-{
- register char *d = dst;
- register const char *s = src;
- register size_t n = siz;
-
- /* Copy as many bytes as will fit */
- if (n != 0 && --n != 0)
- {
- do
- {
- if ((*d++ = *s++) == 0) break;
- } while (--n != 0);
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src */
- if (n == 0)
- {
- if (siz != 0) *d = '\0'; /* NUL-terminate dst */
- while (*s++) ;
- }
-
- return(s - src - 1); /* count does not include NUL */
-}
-
-int strcmp (const char *s1, const char *s2)
-{
- while (*s1 && *s1 == *s2)
- s1++, s2++;
- return (*s1 - *s2);
-}
-
-/**
- * strncmp - Compare two length-limited strings
- * @cs: One string
- * @ct: Another string
- * @count: The maximum number of bytes to compare
- */
-int strncmp(const char *cs,const char *ct, size_t count)
-{
- register signed char __res = 0;
-
- while (count) {
- if ((__res = *cs - *ct++) != 0 || !*cs++)
- break;
- count--;
- }
-
- return __res;
-}
-
-char *strcat(char * dest, const char * src)
-{
- char *tmp = dest;
-
- while (*dest)
- dest++;
- while ((*dest++ = *src++) != '\0')
- ;
-
- return tmp;
-}
-
-char *strncat(char *dest, const char *src, size_t count)
-{
- char *tmp = dest;
-
- if (count) {
- while (*dest)
- dest++;
- while ((*dest++ = *src++)) {
- if (--count == 0) {
- *dest = '\0';
- break;
- }
- }
- }
-
- return tmp;
-}
-
-char *strrchr(const char *t, int c)
-{
- register char ch;
- register const char *l=0;
-
- ch = c;
- for (;;)
- {
- if (*t == ch) l=t;
- if (!*t) return (char*)l;
- ++t;
- }
-
- return (char*)l;
-}
-
-
-int strncasecmp ( const char* s1, const char* s2, size_t len )
-{
- register unsigned int x2;
- register unsigned int x1;
- register const char* end = s1 + len;
-
- while (1)
- {
- if ((s1 >= end) )
- return 0;
-
- x2 = *s2 - 'A'; if ((x2 < 26u)) x2 += 32;
- x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32;
- s1++; s2++;
-
- if ((x2 != x1))
- break;
-
- if ((x1 == (unsigned int)-'A'))
- break;
- }
-
- return x1 - x2;
-}
-
-/* private function */
-#define isdigit(c) ((unsigned)((c) - '0') < 10)
-
-rt_inline int divide(int *n, int base)
-{
- rt_int32_t res;
-
- /* optimized for processor which does not support divide instructions. */
- if (base == 10)
- {
- res = ((int)*n) % 10U;
- *n = ((int)*n) / 10U;
- }
- else
- {
- res = ((int)*n) % 16U;
- *n = ((int)*n) / 16U;
- }
-
- return res;
-}
-
-rt_inline int skip_atoi(const char **s)
-{
- register int i=0;
- while (isdigit(**s)) i = i*10 + *((*s)++) - '0';
-
- return i;
-}
-
-unsigned char _ctype[] = {
-_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
-_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
-_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
-_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
-_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
-_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
-_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
-_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
-_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
-_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
-_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
-_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
-_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
-_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
-_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
-_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */
-_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */
-_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */
-_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */
-_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */
-_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
-_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
-
-#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
-
-#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
-#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
-#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
-#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
-#define islower(c) ((__ismask(c)&(_L)) != 0)
-#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
-#define ispunct(c) ((__ismask(c)&(_P)) != 0)
-#define isspace(c) ((__ismask(c)&(_S)) != 0)
-#define isupper(c) ((__ismask(c)&(_U)) != 0)
-#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
-
-#define isascii(c) (((unsigned char)(c))<=0x7f)
-#define toascii(c) (((unsigned char)(c))&0x7f)
-
-static inline unsigned char __tolower(unsigned char c)
-{
- if (isupper(c))
- c -= 'A'-'a';
- return c;
-}
-
-static inline unsigned char __toupper(unsigned char c)
-{
- if (islower(c))
- c -= 'a'-'A';
- return c;
-}
-
-int tolower(int c)
-{
- return __tolower(c);
-}
-
-int toupper(int c)
-{
- return __toupper(c);
-}
-
-/**
- * simple_strtoul - convert a string to an unsigned long
- * @cp: The start of the string
- * @endp: A pointer to the end of the parsed string will be placed here
- * @base: The number base to use
- */
-unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
-{
- unsigned long result = 0,value;
-
- if (!base) {
- base = 10;
- if (*cp == '0') {
- base = 8;
- cp++;
- if ((toupper(*cp) == 'X') && isxdigit(cp[1])) {
- cp++;
- base = 16;
- }
- }
- } else if (base == 16) {
- if (cp[0] == '0' && toupper(cp[1]) == 'X')
- cp += 2;
- }
- while (isxdigit(*cp) &&
- (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) {
- result = result*base + value;
- cp++;
- }
- if (endp)
- *endp = (char *)cp;
- return result;
-}
-
-/**
- * simple_strtol - convert a string to a signed long
- * @cp: The start of the string
- * @endp: A pointer to the end of the parsed string will be placed here
- * @base: The number base to use
- */
-long simple_strtol(const char *cp,char **endp,unsigned int base)
-{
- if(*cp=='-')
- return -simple_strtoul(cp+1,endp,base);
- return simple_strtoul(cp,endp,base);
-}
-
-/**
- * simple_strtoull - convert a string to an unsigned long long
- * @cp: The start of the string
- * @endp: A pointer to the end of the parsed string will be placed here
- * @base: The number base to use
- */
-unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
-{
- unsigned long long result = 0, value;
-
- if (*cp == '0') {
- cp++;
- if ((toupper(*cp) == 'X') && isxdigit (cp[1])) {
- base = 16;
- cp++;
- }
- if (!base) {
- base = 8;
- }
- }
- if (!base) {
- base = 10;
- }
- while (isxdigit (*cp) && (value = isdigit (*cp)
- ? *cp - '0'
- : (islower (*cp) ? toupper (*cp) : *cp) - 'A' + 10) < base) {
- result = result * base + value;
- cp++;
- }
- if (endp)
- *endp = (char *) cp;
- return result;
-}
-
-/**
- * simple_strtoll - convert a string to a signed long long
- * @cp: The start of the string
- * @endp: A pointer to the end of the parsed string will be placed here
- * @base: The number base to use
- */
-long long simple_strtoll(const char *cp,char **endp,unsigned int base)
-{
- if(*cp=='-')
- return -simple_strtoull(cp+1,endp,base);
- return simple_strtoull(cp,endp,base);
-}
-
-/**
- * vsscanf - Unformat a buffer into a list of arguments
- * @buf: input buffer
- * @fmt: format of buffer
- * @args: arguments
- */
-int vsscanf(const char * buf, const char * fmt, va_list args)
-{
- const char *str = buf;
- char *next;
- int num = 0;
- int qualifier;
- int base;
- int field_width = -1;
- int is_sign = 0;
-
- while(*fmt && *str) {
- /* skip any white space in format */
- /* white space in format matchs any amount of
- * white space, including none, in the input.
- */
- if (isspace(*fmt)) {
- while (isspace(*fmt))
- ++fmt;
- while (isspace(*str))
- ++str;
- }
-
- /* anything that is not a conversion must match exactly */
- if (*fmt != '%' && *fmt) {
- if (*fmt++ != *str++)
- break;
- continue;
- }
-
- if (!*fmt)
- break;
- ++fmt;
-
- /* skip this conversion.
- * advance both strings to next white space
- */
- if (*fmt == '*') {
- while (!isspace(*fmt) && *fmt)
- fmt++;
- while (!isspace(*str) && *str)
- str++;
- continue;
- }
-
- /* get field width */
- if (isdigit(*fmt))
- field_width = skip_atoi(&fmt);
-
- /* get conversion qualifier */
- qualifier = -1;
- if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z') {
- qualifier = *fmt;
- fmt++;
- }
- base = 10;
- is_sign = 0;
-
- if (!*fmt || !*str)
- break;
-
- switch(*fmt++) {
- case 'c':
- {
- char *s = (char *) va_arg(args,char*);
- if (field_width == -1)
- field_width = 1;
- do {
- *s++ = *str++;
- } while(field_width-- > 0 && *str);
- num++;
- }
- continue;
- case 's':
- {
- char *s = (char *) va_arg(args, char *);
- if(field_width == -1)
- field_width = INT_MAX;
- /* first, skip leading white space in buffer */
- while (isspace(*str))
- str++;
-
- /* now copy until next white space */
- while (*str && !isspace(*str) && field_width--) {
- *s++ = *str++;
- }
- *s = '\0';
- num++;
- }
- continue;
- case 'n':
- /* return number of characters read so far */
- {
- int *i = (int *)va_arg(args,int*);
- *i = str - buf;
- }
- continue;
- case 'o':
- base = 8;
- break;
- case 'x':
- case 'X':
- base = 16;
- break;
- case 'd':
- case 'i':
- is_sign = 1;
- case 'u':
- break;
- case '%':
- /* looking for '%' in str */
- if (*str++ != '%')
- return num;
- continue;
- default:
- /* invalid format; stop here */
- return num;
- }
-
- /* have some sort of integer conversion.
- * first, skip white space in buffer.
- */
- while (isspace(*str))
- str++;
-
- if (!*str || !isdigit(*str))
- break;
-
- switch(qualifier) {
- case 'h':
- if (is_sign) {
- short *s = (short *) va_arg(args,short *);
- *s = (short) simple_strtol(str,&next,base);
- } else {
- unsigned short *s = (unsigned short *) va_arg(args, unsigned short *);
- *s = (unsigned short) simple_strtoul(str, &next, base);
- }
- break;
- case 'l':
- if (is_sign) {
- long *l = (long *) va_arg(args,long *);
- *l = simple_strtol(str,&next,base);
- } else {
- unsigned long *l = (unsigned long*) va_arg(args,unsigned long*);
- *l = simple_strtoul(str,&next,base);
- }
- break;
- case 'L':
- if (is_sign) {
- long long *l = (long long*) va_arg(args,long long *);
- *l = simple_strtoll(str,&next,base);
- } else {
- unsigned long long *l = (unsigned long long*) va_arg(args,unsigned long long*);
- *l = simple_strtoull(str,&next,base);
- }
- break;
- case 'Z':
- {
- unsigned long *s = (unsigned long*) va_arg(args,unsigned long*);
- *s = (unsigned long) simple_strtoul(str,&next,base);
- }
- break;
- default:
- if (is_sign) {
- int *i = (int *) va_arg(args, int*);
- *i = (int) simple_strtol(str,&next,base);
- } else {
- unsigned int *i = (unsigned int*) va_arg(args, unsigned int*);
- *i = (unsigned int) simple_strtoul(str,&next,base);
- }
- break;
- }
- num++;
-
- if (!next)
- break;
- str = next;
- }
- return num;
-}
-
-/**
- * sscanf - Unformat a buffer into a list of arguments
- * @buf: input buffer
- * @fmt: formatting of buffer
- * @...: resulting arguments
- */
-int sscanf(const char * buf, const char * fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args,fmt);
- i = vsscanf(buf,fmt,args);
- va_end(args);
-
- return i;
-}
-
-size_t strspn(const char *s, const char *accept)
-{
- size_t l=0;
- int a=1,i, al=strlen(accept);
-
- while((a)&&(*s))
- {
- for(a=i=0;(!a)&&(i<al);i++)
- if (*s==accept[i]) a=1;
- if (a) l++;
- s++;
- }
- return l;
-}
-
-size_t strcspn(const char *s, const char *reject)
-{
- size_t l=0;
- int a=1,i,al=strlen(reject);
-
- while((a)&&(*s))
- {
- for(i=0;(a)&&(i<al);i++)
- if (*s==reject[i]) a=0;
- if (a) l++;
- s++;
- }
- return l;
-}
-
-char*strtok_r(char*s,const char*delim,char**ptrptr)
-{
- char*tmp=0;
-
- if (s==0) s=*ptrptr;
- s += strspn(s,delim); /* overread leading delimiter */
- if (*s)
- {
- tmp=s;
- s+=strcspn(s,delim);
-
- if (*s) *s++=0; /* not the end ? => terminate it */
- }
- *ptrptr=s;
- return tmp;
-}
-
-char *strtok(char *s, const char *delim)
-{
- static char *strtok_pos;
- return strtok_r(s,delim,&strtok_pos);
-}
-
-char *strchr(const char *s1, int i)
-{
- const unsigned char *s = (const unsigned char *)s1;
- unsigned char c = (unsigned int)i;
-
- while (*s && *s != c)
- {
- s++;
- }
-
- if (*s != c)
- {
- s = NULL;
- }
-
- return (char *) s;
-}
-
-#endif
diff --git a/libc/minilibc/string.h b/libc/minilibc/string.h
deleted file mode 100644
index f9cc9a6591..0000000000
--- a/libc/minilibc/string.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * File : string.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rt-thread.org/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2008-08-14 Bernard the first version
- */
-#ifndef __STRING_H__
-#define __STRING_H__
-
-#include <rtthread.h>
-#include <sys/types.h>
-
-/* replace for standard string library */
-#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC)
-
-#define ZEROPAD (1 << 0) /* pad with zero */
-#define SIGN (1 << 1) /* unsigned/signed long */
-#define PLUS (1 << 2) /* show plus */
-#define SPACE (1 << 3) /* space if plus */
-#define LEFT (1 << 4) /* left justified */
-#define SPECIAL (1 << 5) /* 0x */
-#define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */
-
-#define INT_MAX ((int)(~0U>>1))
-#define INT_MIN (-INT_MAX - 1)
-#define UINT_MAX (~0U)
-#define LONG_MAX ((long)(~0UL>>1))
-#define LONG_MIN (-LONG_MAX - 1)
-#define ULONG_MAX (~0UL)
-
-#define _U 0x01 /* upper */
-#define _L 0x02 /* lower */
-#define _D 0x04 /* digit */
-#define _C 0x08 /* cntrl */
-#define _P 0x10 /* punct */
-#define _S 0x20 /* white space (space/lf/tab) */
-#define _X 0x40 /* hex digit */
-#define _SP 0x80 /* hard space (0x20) */
-
-void* memset(void *s, int c, size_t n);
-void* memcpy(void *dest, const void *src, size_t n);
-void* memmove(void *dest, const void *src, size_t n);
-int memcmp(const void *s1, const void *s2, size_t n);
-
-int tolower(int c);
-int toupper(int c);
-
-int strcmp (const char *s1, const char *s2);
-int strncmp(const char *cs,const char *ct, size_t count);
-int strcasecmp(const char *a, const char *b);
-int strncasecmp(const char *cs, const char *ct, size_t count);
-int sscanf(const char * buf, const char * fmt, ...);
-size_t strlen(const char *s);
-char *strstr(const char * s1,const char * s2);
-char *strcpy(char *dest, const char *src);
-char *strncpy(char *dest, const char *src, size_t n);
-size_t strlcpy(char *dst, const char *src, size_t siz);
-char *strncat(char *dest, const char *src, size_t count);
-char *strcat(char * dest, const char * src);
-char *strchr(const char *s1, int i);
-char *strrchr(const char *t, int c);
-char *strdup(const char *s);
-char *strtok(char *s, const char *delim);
-char*strtok_r(char*s, const char*delim, char**ptrptr);
-
-size_t strcspn(const char *s, const char *reject);
-size_t strspn (const char *s, const char *accept);
-
-#endif
-
-#endif
diff --git a/libc/minilibc/sys/time.h b/libc/minilibc/sys/time.h
deleted file mode 100644
index 4cd5cb8ba8..0000000000
--- a/libc/minilibc/sys/time.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef _SYS_TIME_H_
-#define _SYS_TIME_H_
-
-#include <sys/types.h>
-
-/*
- * Structure returned by gettimeofday(2) system call,
- * and used in other calls.
- */
-struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
-};
-
-/*
- * Structure defined by POSIX.1b to be like a timeval.
- */
-struct timespec {
- time_t tv_sec; /* seconds */
- long tv_nsec; /* and nanoseconds */
-};
-
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-struct tm {
- int tm_sec; /* Seconds. [0-60] (1 leap second) */
- int tm_min; /* Minutes. [0-59] */
- int tm_hour; /* Hours. [0-23] */
- int tm_mday; /* Day. [1-31] */
- int tm_mon; /* Month. [0-11] */
- int tm_year; /* Year - 1900. */
- int tm_wday; /* Day of week. [0-6] */
- int tm_yday; /* Days in year.[0-365] */
- int tm_isdst; /* DST. [-1/0/1]*/
-
- long int tm_gmtoff; /* Seconds east of UTC. */
- const char *tm_zone; /* Timezone abbreviation. */
-};
-
-#endif
diff --git a/libc/minilibc/sys/types.h b/libc/minilibc/sys/types.h
deleted file mode 100644
index a9a1dafa2e..0000000000
--- a/libc/minilibc/sys/types.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef __TYPES_H__
-#define __TYPES_H__
-
-#include <rtthread.h>
-
-typedef rt_off_t off_t;
-typedef rt_size_t size_t;
-
-typedef rt_uint8_t u_char;
-typedef rt_uint16_t u_short;
-typedef rt_ubase_t u_int;
-typedef rt_uint32_t u_long;
-
-typedef rt_uint8_t u_int8_t;
-typedef rt_uint16_t u_int16_t;
-typedef rt_uint32_t u_int32_t;
-
-typedef rt_time_t time_t;
-
-#ifndef NULL
-#define NULL RT_NULL
-#endif
-
-#endif
diff --git a/libc/minilibc/time.c b/libc/minilibc/time.c
deleted file mode 100644
index 4c39c3c25d..0000000000
--- a/libc/minilibc/time.c
+++ /dev/null
@@ -1,174 +0,0 @@
-#include <time.h>
-
-/* days per month -- nonleap! */
-const short __spm[13] =
- { 0,
- (31),
- (31+28),
- (31+28+31),
- (31+28+31+30),
- (31+28+31+30+31),
- (31+28+31+30+31+30),
- (31+28+31+30+31+30+31),
- (31+28+31+30+31+30+31+31),
- (31+28+31+30+31+30+31+31+30),
- (31+28+31+30+31+30+31+31+30+31),
- (31+28+31+30+31+30+31+31+30+31+30),
- (31+28+31+30+31+30+31+31+30+31+30+31),
- };
-static long int timezone;
-static const char days[] = "Sun Mon Tue Wed Thu Fri Sat ";
-static const char months[] = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
-
-/* seconds per day */
-#define SPD 24*60*60
-
-int __isleap(int year) {
- /* every fourth year is a leap year except for century years that are
- * not divisible by 400. */
-/* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */
- return (!(year%4) && ((year%100) || !(year%400)));
-}
-
-struct tm *gmtime_r(const time_t *timep, struct tm *r) {
- time_t i;
- register time_t work=*timep%(SPD);
- r->tm_sec=work%60; work/=60;
- r->tm_min=work%60; r->tm_hour=work/60;
- work=*timep/(SPD);
- r->tm_wday=(4+work)%7;
- for (i=1970; ; ++i) {
- register time_t k=__isleap(i)?366:365;
- if (work>=k)
- work-=k;
- else
- break;
- }
- r->tm_year=i-1900;
- r->tm_yday=work;
-
- r->tm_mday=1;
- if (__isleap(i) && (work>58)) {
- if (work==59) r->tm_mday=2; /* 29.2. */
- work-=1;
- }
-
- for (i=11; i && (__spm[i]>work); --i) ;
- r->tm_mon=i;
- r->tm_mday+=work-__spm[i];
- return r;
-}
-
-struct tm* localtime_r(const time_t* t, struct tm* r) {
- time_t tmp;
- struct timezone tz;
- gettimeofday(0, &tz);
- timezone=tz.tz_minuteswest*60L;
- tmp=*t+timezone;
- return gmtime_r(&tmp,r);
-}
-
-struct tm* localtime(const time_t* t) {
- static struct tm tmp;
- return localtime_r(t,&tmp);
-}
-
-time_t timegm(struct tm *const t) {
- register time_t day;
- register time_t i;
- register time_t years = t->tm_year - 70;
-
- if (t->tm_sec>60) { t->tm_min += t->tm_sec/60; t->tm_sec%=60; }
- if (t->tm_min>60) { t->tm_hour += t->tm_min/60; t->tm_min%=60; }
- if (t->tm_hour>60) { t->tm_mday += t->tm_hour/60; t->tm_hour%=60; }
- if (t->tm_mon>12) { t->tm_year += t->tm_mon/12; t->tm_mon%=12; }
- while (t->tm_mday>__spm[1+t->tm_mon]) {
- if (t->tm_mon==1 && __isleap(t->tm_year+1900)) {
- if (t->tm_mon==31+29) break;
- --t->tm_mday;
- }
- t->tm_mday-=__spm[t->tm_mon];
- ++t->tm_mon;
- if (t->tm_mon>11) { t->tm_mon=0; ++t->tm_year; }
- }
-
- if (t->tm_year < 70)
- return (time_t) -1;
-
- /* Days since 1970 is 365 * number of years + number of leap years since 1970 */
- day = years * 365 + (years + 1) / 4;
-
- /* After 2100 we have to substract 3 leap years for every 400 years
- This is not intuitive. Most mktime implementations do not support
- dates after 2059, anyway, so we might leave this out for it's
- bloat. */
- if ((years -= 131) >= 0) {
- years /= 100;
- day -= (years >> 2) * 3 + 1;
- if ((years &= 3) == 3) years--;
- day -= years;
- }
-
- day += t->tm_yday = __spm [t->tm_mon] + t->tm_mday-1 + ( __isleap (t->tm_year+1900) & (t->tm_mon > 1) );
-
- /* day is now the number of days since 'Jan 1 1970' */
- i = 7;
- t->tm_wday = (day + 4) % i; /* Sunday=0, Monday=1, ..., Saturday=6 */
-
- i = 24;
- day *= i;
- i = 60;
- return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
-}
-
-time_t mktime(register struct tm* const t) {
- time_t x=timegm(t);
- struct timezone tz;
- gettimeofday(0, &tz);
- timezone=tz.tz_minuteswest*60L;
- x+=timezone;
- return x;
-}
-
-static void num2str(char *c,int i) {
- c[0]=i/10+'0';
- c[1]=i%10+'0';
-}
-
-char *asctime_r(const struct tm *t, char *buf) {
- /* "Wed Jun 30 21:49:08 1993\n" */
- *(int*)buf=*(int*)(days+(t->tm_wday<<2));
- *(int*)(buf+4)=*(int*)(months+(t->tm_mon<<2));
- num2str(buf+8,t->tm_mday);
- if (buf[8]=='0') buf[8]=' ';
- buf[10]=' ';
- num2str(buf+11,t->tm_hour);
- buf[13]=':';
- num2str(buf+14,t->tm_min);
- buf[16]=':';
- num2str(buf+17,t->tm_sec);
- buf[19]=' ';
- num2str(buf+20,(t->tm_year+1900)/100);
- num2str(buf+22,(t->tm_year+1900)%100);
- buf[24]='\n';
- return buf;
-}
-
-char *asctime(const struct tm *timeptr) {
- static char buf[25];
- return asctime_r(timeptr,buf);
-}
-
-char *ctime(const time_t *timep) {
- return asctime(localtime(timep));
-}
-
-int gettimeofday (struct timeval *tp, void *ignore)
-{
- time_t t;
-
- t = time(NULL);
- tp->tv_sec = t;
- tp->tv_usec = 0;
- return 0;
-}
diff --git a/libc/minilibc/time.h b/libc/minilibc/time.h
deleted file mode 100644
index 0b2aabbed1..0000000000
--- a/libc/minilibc/time.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __TIME_H__
-#define __TIME_H__
-
-#include <sys/time.h>
-
-#endif