summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/armlibc/dirent.h28
-rw-r--r--components/libc/compilers/armlibc/fcntl.h2
-rw-r--r--components/libc/compilers/armlibc/libc.c2
-rw-r--r--components/libc/compilers/armlibc/libc.h2
-rw-r--r--components/libc/compilers/armlibc/libc_syms.c2
-rw-r--r--components/libc/compilers/armlibc/mem_std.c2
-rw-r--r--components/libc/compilers/armlibc/stdio.c2
-rw-r--r--components/libc/compilers/armlibc/stubs.c8
-rw-r--r--components/libc/compilers/armlibc/sys/errno.h2
-rw-r--r--components/libc/compilers/armlibc/sys/ioctl.h2
-rw-r--r--components/libc/compilers/armlibc/sys/mman.h2
-rw-r--r--components/libc/compilers/armlibc/sys/stat.h2
-rw-r--r--components/libc/compilers/armlibc/sys/types.h2
-rw-r--r--components/libc/compilers/armlibc/sys/unistd.h2
-rw-r--r--components/libc/compilers/armlibc/unistd.h2
-rw-r--r--components/libc/compilers/common/sys/time.h2
-rw-r--r--components/libc/compilers/common/termios.h2
-rw-r--r--components/libc/compilers/common/time.c6
-rw-r--r--components/libc/compilers/common/unistd.c2
-rw-r--r--components/libc/compilers/dlib/dirent.h2
-rw-r--r--components/libc/compilers/dlib/environ.c2
-rw-r--r--components/libc/compilers/dlib/fcntl.h2
-rw-r--r--components/libc/compilers/dlib/libc.c2
-rw-r--r--components/libc/compilers/dlib/libc.h2
-rw-r--r--components/libc/compilers/dlib/rmtx.c4
-rw-r--r--components/libc/compilers/dlib/stdio.c2
-rw-r--r--components/libc/compilers/dlib/sys/errno.h2
-rw-r--r--components/libc/compilers/dlib/sys/mman.h2
-rw-r--r--components/libc/compilers/dlib/sys/signal.h2
-rw-r--r--components/libc/compilers/dlib/sys/stat.h2
-rw-r--r--components/libc/compilers/dlib/sys/types.h2
-rw-r--r--components/libc/compilers/dlib/sys/unistd.h34
-rw-r--r--components/libc/compilers/dlib/syscall_close.c2
-rw-r--r--components/libc/compilers/dlib/syscall_lseek.c2
-rw-r--r--components/libc/compilers/dlib/syscall_mem.c2
-rw-r--r--components/libc/compilers/dlib/syscall_open.c2
-rw-r--r--components/libc/compilers/dlib/syscall_read.c2
-rw-r--r--components/libc/compilers/dlib/syscall_remove.c2
-rw-r--r--components/libc/compilers/dlib/syscall_write.c2
-rw-r--r--components/libc/compilers/dlib/syscalls.h2
-rw-r--r--components/libc/compilers/dlib/unistd.h2
-rw-r--r--components/libc/compilers/minilibc/ctype.c34
-rw-r--r--components/libc/compilers/minilibc/ctype.h2
-rw-r--r--components/libc/compilers/minilibc/errno.h4
-rw-r--r--components/libc/compilers/minilibc/inttypes.h2
-rw-r--r--components/libc/compilers/minilibc/math.c2
-rw-r--r--components/libc/compilers/minilibc/math.h2
-rw-r--r--components/libc/compilers/minilibc/qsort.c4
-rw-r--r--components/libc/compilers/minilibc/rand.c16
-rw-r--r--components/libc/compilers/minilibc/signal.h2
-rw-r--r--components/libc/compilers/minilibc/stddef.h2
-rw-r--r--components/libc/compilers/minilibc/stdint.h12
-rw-r--r--components/libc/compilers/minilibc/stdio.h10
-rw-r--r--components/libc/compilers/minilibc/stdlib.c70
-rw-r--r--components/libc/compilers/minilibc/stdlib.h2
-rw-r--r--components/libc/compilers/minilibc/string.c806
-rw-r--r--components/libc/compilers/minilibc/string.h32
-rw-r--r--components/libc/compilers/minilibc/sys/mman.h2
-rw-r--r--components/libc/compilers/minilibc/sys/stat.h50
-rw-r--r--components/libc/compilers/minilibc/sys/time.h36
-rw-r--r--components/libc/compilers/minilibc/sys/types.h4
-rw-r--r--components/libc/compilers/minilibc/time.c2
-rw-r--r--components/libc/compilers/minilibc/time.h2
-rw-r--r--components/libc/compilers/newlib/libc.c4
-rw-r--r--components/libc/compilers/newlib/libc.h4
-rw-r--r--components/libc/compilers/newlib/libc_syms.c2
-rw-r--r--components/libc/compilers/newlib/stdio.c6
-rw-r--r--components/libc/compilers/newlib/sys/dirent.h34
-rw-r--r--components/libc/compilers/newlib/sys/mman.h2
-rw-r--r--components/libc/compilers/newlib/sys/statfs.h8
-rw-r--r--components/libc/compilers/newlib/sys/termios.h2
-rw-r--r--components/libc/compilers/newlib/syscalls.c2
72 files changed, 657 insertions, 657 deletions
diff --git a/components/libc/compilers/armlibc/dirent.h b/components/libc/compilers/armlibc/dirent.h
index d3bc58cbc5..2c0521d2e3 100644
--- a/components/libc/compilers/armlibc/dirent.h
+++ b/components/libc/compilers/armlibc/dirent.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -18,32 +18,32 @@
*/
/* File types */
-#define FT_REGULAR 0 /* regular file */
-#define FT_SOCKET 1 /* socket file */
-#define FT_DIRECTORY 2 /* directory */
-#define FT_USER 3 /* user defined */
+#define FT_REGULAR 0 /* regular file */
+#define FT_SOCKET 1 /* socket file */
+#define FT_DIRECTORY 2 /* directory */
+#define FT_USER 3 /* user defined */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_DIR_STRUCTURE
-typedef struct
+typedef struct
{
- int fd; /* directory file */
- char buf[512];
- int num;
- int cur;
+ int fd; /* directory file */
+ char buf[512];
+ int num;
+ int cur;
} DIR;
#endif
#ifndef HAVE_DIRENT_STRUCTURE
struct dirent
{
- rt_uint8_t d_type; /* The type of the file */
- rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
- rt_uint16_t d_reclen; /* length of this record */
- char d_name[256]; /* The null-terminated file name */
+ rt_uint8_t d_type; /* The type of the file */
+ rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
+ rt_uint16_t d_reclen; /* length of this record */
+ char d_name[256]; /* The null-terminated file name */
};
#endif
diff --git a/components/libc/compilers/armlibc/fcntl.h b/components/libc/compilers/armlibc/fcntl.h
index 3e650a8471..f247b926e9 100644
--- a/components/libc/compilers/armlibc/fcntl.h
+++ b/components/libc/compilers/armlibc/fcntl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/libc.c b/components/libc/compilers/armlibc/libc.c
index fee390d4b4..971ddb8d49 100644
--- a/components/libc/compilers/armlibc/libc.c
+++ b/components/libc/compilers/armlibc/libc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/libc.h b/components/libc/compilers/armlibc/libc.h
index b9b1b6212d..aecf8cdc50 100644
--- a/components/libc/compilers/armlibc/libc.h
+++ b/components/libc/compilers/armlibc/libc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/libc_syms.c b/components/libc/compilers/armlibc/libc_syms.c
index 0e1c42d899..d03197a5db 100644
--- a/components/libc/compilers/armlibc/libc_syms.c
+++ b/components/libc/compilers/armlibc/libc_syms.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/mem_std.c b/components/libc/compilers/armlibc/mem_std.c
index e160104a25..c350aa68fa 100644
--- a/components/libc/compilers/armlibc/mem_std.c
+++ b/components/libc/compilers/armlibc/mem_std.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/stdio.c b/components/libc/compilers/armlibc/stdio.c
index 5262a4dd92..c786c78aa5 100644
--- a/components/libc/compilers/armlibc/stdio.c
+++ b/components/libc/compilers/armlibc/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c
index b4cc13799e..5d9331ba17 100644
--- a/components/libc/compilers/armlibc/stubs.c
+++ b/components/libc/compilers/armlibc/stubs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -9,7 +9,7 @@
* 2013-11-24 aozima fixed _sys_read()/_sys_write() issues.
* 2014-08-03 bernard If using msh, use system() implementation
* in msh.
- * 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when
+ * 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when
* RT_USING_DFS is not defined
*/
@@ -310,7 +310,7 @@ int system(const char *string)
#ifdef __MICROLIB
#include <stdio.h>
-int fputc(int c, FILE *f)
+int fputc(int c, FILE *f)
{
char ch[2] = {0};
@@ -319,7 +319,7 @@ int fputc(int c, FILE *f)
return 1;
}
-int fgetc(FILE *f)
+int fgetc(FILE *f)
{
#ifdef RT_USING_POSIX
char ch;
diff --git a/components/libc/compilers/armlibc/sys/errno.h b/components/libc/compilers/armlibc/sys/errno.h
index 9c4307ebfb..74cc986f7c 100644
--- a/components/libc/compilers/armlibc/sys/errno.h
+++ b/components/libc/compilers/armlibc/sys/errno.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/sys/ioctl.h b/components/libc/compilers/armlibc/sys/ioctl.h
index 033a57014a..df17b19a61 100644
--- a/components/libc/compilers/armlibc/sys/ioctl.h
+++ b/components/libc/compilers/armlibc/sys/ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/sys/mman.h b/components/libc/compilers/armlibc/sys/mman.h
index 8c61b32b7c..6a260ccd70 100644
--- a/components/libc/compilers/armlibc/sys/mman.h
+++ b/components/libc/compilers/armlibc/sys/mman.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/sys/stat.h b/components/libc/compilers/armlibc/sys/stat.h
index ce95230e88..c4b42083c4 100644
--- a/components/libc/compilers/armlibc/sys/stat.h
+++ b/components/libc/compilers/armlibc/sys/stat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h
index 78fee1bb99..d87a13a27e 100644
--- a/components/libc/compilers/armlibc/sys/types.h
+++ b/components/libc/compilers/armlibc/sys/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h
index 1763282812..2f188735de 100644
--- a/components/libc/compilers/armlibc/sys/unistd.h
+++ b/components/libc/compilers/armlibc/sys/unistd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/armlibc/unistd.h b/components/libc/compilers/armlibc/unistd.h
index 70187722d8..9b96d45adb 100644
--- a/components/libc/compilers/armlibc/unistd.h
+++ b/components/libc/compilers/armlibc/unistd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h
index 79cfbbfaf2..92552c294b 100644
--- a/components/libc/compilers/common/sys/time.h
+++ b/components/libc/compilers/common/sys/time.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/common/termios.h b/components/libc/compilers/common/termios.h
index 414d0c0cb3..2960d52c58 100644
--- a/components/libc/compilers/common/termios.h
+++ b/components/libc/compilers/common/termios.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 50a800b259..6c184fbf43 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -246,9 +246,9 @@ int gettimeofday(struct timeval *tp, void *ignore)
#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000
#pragma module_name = "?time"
#if _DLIB_TIME_USES_64
-time_t __time64(time_t *t)
+time_t __time64(time_t *t)
#else
-time_t __time32(time_t *t)
+time_t __time32(time_t *t)
#endif
#else
time_t time(time_t *t)
diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c
index df970b2b59..cdc065d05a 100644
--- a/components/libc/compilers/common/unistd.c
+++ b/components/libc/compilers/common/unistd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/dirent.h b/components/libc/compilers/dlib/dirent.h
index 4c897cc550..2c0521d2e3 100644
--- a/components/libc/compilers/dlib/dirent.h
+++ b/components/libc/compilers/dlib/dirent.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/environ.c b/components/libc/compilers/dlib/environ.c
index ac19758838..84b04fda55 100644
--- a/components/libc/compilers/dlib/environ.c
+++ b/components/libc/compilers/dlib/environ.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/fcntl.h b/components/libc/compilers/dlib/fcntl.h
index ce95230e88..c4b42083c4 100644
--- a/components/libc/compilers/dlib/fcntl.h
+++ b/components/libc/compilers/dlib/fcntl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c
index 8b42411a6b..d0dca7c5f6 100644
--- a/components/libc/compilers/dlib/libc.c
+++ b/components/libc/compilers/dlib/libc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/libc.h b/components/libc/compilers/dlib/libc.h
index 5b46bee0c8..fc3cafca78 100644
--- a/components/libc/compilers/dlib/libc.h
+++ b/components/libc/compilers/dlib/libc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/rmtx.c b/components/libc/compilers/dlib/rmtx.c
index 69405c8f6a..66c3f9377d 100644
--- a/components/libc/compilers/dlib/rmtx.c
+++ b/components/libc/compilers/dlib/rmtx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -22,7 +22,7 @@ void _Mtxinit(_Rmtx *m)
rt_mutex_t mutex;
RT_ASSERT(m != RT_NULL);
-
+
mutex = (rt_mutex_t)m;
rt_mutex_init(mutex, "iarMtx", RT_IPC_FLAG_FIFO);
}
diff --git a/components/libc/compilers/dlib/stdio.c b/components/libc/compilers/dlib/stdio.c
index b35ade7a38..c11157d759 100644
--- a/components/libc/compilers/dlib/stdio.c
+++ b/components/libc/compilers/dlib/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/errno.h b/components/libc/compilers/dlib/sys/errno.h
index 1ad4c8acc0..54a1d33cd0 100644
--- a/components/libc/compilers/dlib/sys/errno.h
+++ b/components/libc/compilers/dlib/sys/errno.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/mman.h b/components/libc/compilers/dlib/sys/mman.h
index 8c61b32b7c..6a260ccd70 100644
--- a/components/libc/compilers/dlib/sys/mman.h
+++ b/components/libc/compilers/dlib/sys/mman.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/signal.h b/components/libc/compilers/dlib/sys/signal.h
index 22adb1228b..a30235f2b2 100644
--- a/components/libc/compilers/dlib/sys/signal.h
+++ b/components/libc/compilers/dlib/sys/signal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/stat.h b/components/libc/compilers/dlib/sys/stat.h
index ce95230e88..c4b42083c4 100644
--- a/components/libc/compilers/dlib/sys/stat.h
+++ b/components/libc/compilers/dlib/sys/stat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h
index 7dbeddcaa9..e13a0f6d08 100644
--- a/components/libc/compilers/dlib/sys/types.h
+++ b/components/libc/compilers/dlib/sys/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h
index 29f68f24f8..a4dac0cf66 100644
--- a/components/libc/compilers/dlib/sys/unistd.h
+++ b/components/libc/compilers/dlib/sys/unistd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -17,22 +17,22 @@
#include <dfs_posix.h>
#else
-#define _FREAD 0x0001 /* read enabled */
-#define _FWRITE 0x0002 /* write enabled */
-#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
-#define _FMARK 0x0010 /* internal; mark during gc() */
-#define _FDEFER 0x0020 /* internal; defer for next gc pass */
-#define _FASYNC 0x0040 /* signal pgrp when data ready */
-#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
-#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
-#define _FCREAT 0x0200 /* open with file create */
-#define _FTRUNC 0x0400 /* open with truncation */
-#define _FEXCL 0x0800 /* error on open if file exists */
-#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
-#define _FSYNC 0x2000 /* do all writes synchronously */
-#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
-#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
-#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
+#define _FREAD 0x0001 /* read enabled */
+#define _FWRITE 0x0002 /* write enabled */
+#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
+#define _FMARK 0x0010 /* internal; mark during gc() */
+#define _FDEFER 0x0020 /* internal; defer for next gc pass */
+#define _FASYNC 0x0040 /* signal pgrp when data ready */
+#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
+#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
+#define _FCREAT 0x0200 /* open with file create */
+#define _FTRUNC 0x0400 /* open with truncation */
+#define _FEXCL 0x0800 /* error on open if file exists */
+#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
+#define _FSYNC 0x2000 /* do all writes synchronously */
+#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
+#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
+#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
#endif
diff --git a/components/libc/compilers/dlib/syscall_close.c b/components/libc/compilers/dlib/syscall_close.c
index f46162deb7..7ed1cc2f2d 100644
--- a/components/libc/compilers/dlib/syscall_close.c
+++ b/components/libc/compilers/dlib/syscall_close.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_lseek.c b/components/libc/compilers/dlib/syscall_lseek.c
index b79cc410b7..47a069bf0a 100644
--- a/components/libc/compilers/dlib/syscall_lseek.c
+++ b/components/libc/compilers/dlib/syscall_lseek.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_mem.c b/components/libc/compilers/dlib/syscall_mem.c
index 236ef1c12d..9c6de64455 100644
--- a/components/libc/compilers/dlib/syscall_mem.c
+++ b/components/libc/compilers/dlib/syscall_mem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_open.c b/components/libc/compilers/dlib/syscall_open.c
index 96e02dc32a..37bfcecb47 100644
--- a/components/libc/compilers/dlib/syscall_open.c
+++ b/components/libc/compilers/dlib/syscall_open.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c
index e248211486..afb661bd93 100644
--- a/components/libc/compilers/dlib/syscall_read.c
+++ b/components/libc/compilers/dlib/syscall_read.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c
index e7f0268b1b..629127bf74 100644
--- a/components/libc/compilers/dlib/syscall_remove.c
+++ b/components/libc/compilers/dlib/syscall_remove.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c
index 85c0da22c3..de464530b8 100644
--- a/components/libc/compilers/dlib/syscall_write.c
+++ b/components/libc/compilers/dlib/syscall_write.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/syscalls.h b/components/libc/compilers/dlib/syscalls.h
index 993962e8db..3a89f16e01 100644
--- a/components/libc/compilers/dlib/syscalls.h
+++ b/components/libc/compilers/dlib/syscalls.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/dlib/unistd.h b/components/libc/compilers/dlib/unistd.h
index a07d8409c2..72b9d538ec 100644
--- a/components/libc/compilers/dlib/unistd.h
+++ b/components/libc/compilers/dlib/unistd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/ctype.c b/components/libc/compilers/minilibc/ctype.c
index b94ff2dae8..4278d8e419 100644
--- a/components/libc/compilers/minilibc/ctype.c
+++ b/components/libc/compilers/minilibc/ctype.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -16,34 +16,34 @@
int isprint (int ch)
{
- ch&=0x7f;
- return (ch>=32 && ch<127);
+ ch&=0x7f;
+ return (ch>=32 && ch<127);
}
int isalpha(int ch)
{
- return (unsigned int)((ch | 0x20) - 'a') < 26u;
+ return (unsigned int)((ch | 0x20) - 'a') < 26u;
}
int isdigit (int ch)
{
- return (unsigned int)(ch - '0') < 10u;
+ return (unsigned int)(ch - '0') < 10u;
}
int isspace(int ch)
{
- switch(ch)
- {
- case ' ':
- case '\n':
- case '\f':
- case '\r':
- case '\t':
- case '\v':
- return 1;
- default:
- return 0;
- }
+ switch(ch)
+ {
+ case ' ':
+ case '\n':
+ case '\f':
+ case '\r':
+ case '\t':
+ case '\v':
+ return 1;
+ default:
+ return 0;
+ }
}
#endif
diff --git a/components/libc/compilers/minilibc/ctype.h b/components/libc/compilers/minilibc/ctype.h
index 5f41376ed8..9d394dd125 100644
--- a/components/libc/compilers/minilibc/ctype.h
+++ b/components/libc/compilers/minilibc/ctype.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/errno.h b/components/libc/compilers/minilibc/errno.h
index a7ee380594..b1cbe5452b 100644
--- a/components/libc/compilers/minilibc/errno.h
+++ b/components/libc/compilers/minilibc/errno.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -11,6 +11,6 @@
#include "libc/libc_errno.h"
/* Others defined in libc/libc_errno.h */
-#define ENSRNOTFOUND 163 /* Domain name not found */
+#define ENSRNOTFOUND 163 /* Domain name not found */
#endif
diff --git a/components/libc/compilers/minilibc/inttypes.h b/components/libc/compilers/minilibc/inttypes.h
index 8bab743655..595e83a085 100644
--- a/components/libc/compilers/minilibc/inttypes.h
+++ b/components/libc/compilers/minilibc/inttypes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/math.c b/components/libc/compilers/minilibc/math.c
index cd5770178e..375e94344f 100644
--- a/components/libc/compilers/minilibc/math.c
+++ b/components/libc/compilers/minilibc/math.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/math.h b/components/libc/compilers/minilibc/math.h
index 49b80d8219..327f470920 100644
--- a/components/libc/compilers/minilibc/math.h
+++ b/components/libc/compilers/minilibc/math.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/qsort.c b/components/libc/compilers/minilibc/qsort.c
index 2b97ce763c..5f11e3a4fd 100644
--- a/components/libc/compilers/minilibc/qsort.c
+++ b/components/libc/compilers/minilibc/qsort.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -24,7 +24,7 @@ static void exch(char* base,size_t size,size_t a,size_t b) {
/* Blame him for the scary variable names */
/* http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf */
static void quicksort(char* base,size_t size,ssize_t l,ssize_t r,
- int (*compar)(const void*,const void*)) {
+ int (*compar)(const void*,const void*)) {
ssize_t i=l-1, j=r, p=l-1, q=r, k;
char* v=base+r*size;
if (r<=l) return;
diff --git a/components/libc/compilers/minilibc/rand.c b/components/libc/compilers/minilibc/rand.c
index 88603dc808..8bbf42a32b 100644
--- a/components/libc/compilers/minilibc/rand.c
+++ b/components/libc/compilers/minilibc/rand.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -13,10 +13,10 @@
static unsigned int _seed=1;
/* Knuth's TAOCP section 3.6 */
-#define M ((1U<<31) -1)
-#define A 48271
-#define Q 44488 // M/A
-#define R 3399 // M%A; R < Q !!!
+#define M ((1U<<31) -1)
+#define A 48271
+#define Q 44488 // M/A
+#define R 3399 // M%A; R < Q !!!
int rand_r(unsigned int* seed)
{ int32_t X;
@@ -24,7 +24,7 @@ int rand_r(unsigned int* seed)
X = *seed;
X = A*(X%Q) - R * (int32_t) (X/Q);
if (X < 0)
- X += M;
+ X += M;
*seed = X;
return X;
@@ -35,8 +35,8 @@ int rand(void) {
}
void srand(unsigned int i)
-{
- _seed=i;
+{
+ _seed=i;
}
int random(void) __attribute__((alias("rand")));
diff --git a/components/libc/compilers/minilibc/signal.h b/components/libc/compilers/minilibc/signal.h
index f52f1e1009..e350d166b7 100644
--- a/components/libc/compilers/minilibc/signal.h
+++ b/components/libc/compilers/minilibc/signal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/stddef.h b/components/libc/compilers/minilibc/stddef.h
index 7353a157cb..496c4b8ecf 100644
--- a/components/libc/compilers/minilibc/stddef.h
+++ b/components/libc/compilers/minilibc/stddef.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/stdint.h b/components/libc/compilers/minilibc/stdint.h
index bd5fdc83f5..b2fb999c74 100644
--- a/components/libc/compilers/minilibc/stdint.h
+++ b/components/libc/compilers/minilibc/stdint.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -223,7 +223,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define WINT_MIN __WINT_MIN__
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
- || defined __STDC_LIMIT_MACROS) */
+ || defined __STDC_LIMIT_MACROS) */
#if (!defined __cplusplus || __cplusplus >= 201103L \
|| defined __STDC_CONSTANT_MACROS)
@@ -250,7 +250,7 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define UINTMAX_C(c) __UINTMAX_C(c)
#endif /* (!defined __cplusplus || __cplusplus >= 201103L
- || defined __STDC_CONSTANT_MACROS) */
+ || defined __STDC_CONSTANT_MACROS) */
#ifndef __INT_MAX__
#define __INT_MAX__ 2147483647
@@ -259,8 +259,8 @@ typedef __UINTMAX_TYPE__ uintmax_t;
#define INT_MAX (__INT_MAX__)
#define UINT_MAX (INT_MAX * 2U + 1U)
-#define LONG_MAX ((long)(~0UL>>1))
-#define LONG_MIN (-LONG_MAX - 1)
-#define ULONG_MAX (~0UL)
+#define LONG_MAX ((long)(~0UL>>1))
+#define LONG_MIN (-LONG_MAX - 1)
+#define ULONG_MAX (~0UL)
#endif
diff --git a/components/libc/compilers/minilibc/stdio.h b/components/libc/compilers/minilibc/stdio.h
index 678682cf5e..7c29ef011f 100644
--- a/components/libc/compilers/minilibc/stdio.h
+++ b/components/libc/compilers/minilibc/stdio.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -10,16 +10,16 @@
#define __STDIO_H__
#define BUFSIZ 128
-#define EOF (-1)
+#define EOF (-1)
#ifndef SEEK_SET
-#define SEEK_SET 0 /* set file offset to offset */
+#define SEEK_SET 0 /* set file offset to offset */
#endif
#ifndef SEEK_CUR
-#define SEEK_CUR 1 /* set file offset to current plus offset */
+#define SEEK_CUR 1 /* set file offset to current plus offset */
#endif
#ifndef SEEK_END
-#define SEEK_END 2 /* set file offset to EOF plus offset */
+#define SEEK_END 2 /* set file offset to EOF plus offset */
#endif
#endif
diff --git a/components/libc/compilers/minilibc/stdlib.c b/components/libc/compilers/minilibc/stdlib.c
index 8154ec5b8b..2bbad75fea 100644
--- a/components/libc/compilers/minilibc/stdlib.c
+++ b/components/libc/compilers/minilibc/stdlib.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -15,60 +15,60 @@
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;
+ 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;
}
-long int atol(const char* s)
+long int atol(const char* s)
{
- long int v=0;
- int sign=0;
- 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?-v:v;
+ long int v=0;
+ int sign=0;
+ 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?-v:v;
}
#ifdef RT_USING_HEAP
void *malloc(size_t size)
{
- return rt_malloc(size);
+ return rt_malloc(size);
}
void free(void *ptr)
{
- rt_free(ptr);
+ rt_free(ptr);
}
void *realloc(void *ptr, size_t size)
{
- return rt_realloc(ptr, size);
+ return rt_realloc(ptr, size);
}
void *calloc(size_t nelem, size_t elsize)
{
- return rt_calloc(nelem, elsize);
+ return rt_calloc(nelem, elsize);
}
#endif
diff --git a/components/libc/compilers/minilibc/stdlib.h b/components/libc/compilers/minilibc/stdlib.h
index d57d95b64d..96d3354099 100644
--- a/components/libc/compilers/minilibc/stdlib.h
+++ b/components/libc/compilers/minilibc/stdlib.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/string.c b/components/libc/compilers/minilibc/string.c
index 1ab7c0509f..4eb9cc3a42 100644
--- a/components/libc/compilers/minilibc/string.c
+++ b/components/libc/compilers/minilibc/string.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -21,44 +21,44 @@
/* 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);
+ 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);
+ 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;
+ 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);
- }
+ /* 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++) ;
- }
+ /* 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 */
+ 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);
+ while (*s1 && *s1 == *s2)
+ s1++, s2++;
+ return (*s1 - *s2);
}
/**
@@ -69,87 +69,87 @@ int strcmp (const char *s1, const char *s2)
*/
int strncmp(const char *cs,const char *ct, size_t count)
{
- register signed char __res = 0;
+ register signed char __res = 0;
- while (count) {
- if ((__res = *cs - *ct++) != 0 || !*cs++)
- break;
- count--;
- }
+ while (count) {
+ if ((__res = *cs - *ct++) != 0 || !*cs++)
+ break;
+ count--;
+ }
- return __res;
+ return __res;
}
char *strcat(char * dest, const char * src)
{
- char *tmp = dest;
+ char *tmp = dest;
- while (*dest)
- dest++;
- while ((*dest++ = *src++) != '\0')
- ;
+ while (*dest)
+ dest++;
+ while ((*dest++ = *src++) != '\0')
+ ;
- return tmp;
+ return tmp;
}
char *strncat(char *dest, const char *src, size_t count)
{
- char *tmp = dest;
+ char *tmp = dest;
- if (count) {
- while (*dest)
- dest++;
- while ((*dest++ = *src++)) {
- if (--count == 0) {
- *dest = '\0';
- break;
- }
- }
- }
+ if (count) {
+ while (*dest)
+ dest++;
+ while ((*dest++ = *src++)) {
+ if (--count == 0) {
+ *dest = '\0';
+ break;
+ }
+ }
+ }
- return tmp;
+ return tmp;
}
-char *strrchr(const char *t, int c)
+char *strrchr(const char *t, int c)
{
- register char ch;
- register const char *l=0;
+ 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;
+ 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;
+ register unsigned int x2;
+ register unsigned int x1;
+ register const char* end = s1 + len;
- while (1)
- {
- if ((s1 >= end) )
- return 0;
+ 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++;
+ x2 = *s2 - 'A'; if ((x2 < 26u)) x2 += 32;
+ x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32;
+ s1++; s2++;
- if (x2 != x1)
- break;
+ if (x2 != x1)
+ break;
- if (x1 == (unsigned int)-'A')
- break;
- }
+ if (x1 == (unsigned int)-'A')
+ break;
+ }
- return x1 - x2;
+ return x1 - x2;
}
/* private function */
@@ -157,50 +157,50 @@ int strncasecmp ( const char* s1, const char* s2, size_t len )
rt_inline int divide(int *n, int base)
{
- rt_int32_t res;
+ 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;
- }
+ /* 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;
+ return res;
}
rt_inline int skip_atoi(const char **s)
{
- register int i=0;
- while (isdigit(**s)) i = i*10 + *((*s)++) - '0';
+ register int i=0;
+ while (isdigit(**s)) i = i*10 + *((*s)++) - '0';
- return i;
+ 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 */
+_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 */
@@ -210,42 +210,42 @@ _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 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;
+ if (isupper(c))
+ c -= 'A'-'a';
+ return c;
}
static inline unsigned char __toupper(unsigned char c)
{
- if (islower(c))
- c -= 'a'-'A';
- return c;
+ if (islower(c))
+ c -= 'a'-'A';
+ return c;
}
-int tolower(int c)
+int tolower(int c)
{
- return __tolower(c);
+ return __tolower(c);
}
int toupper(int c)
{
- return __toupper(c);
+ return __toupper(c);
}
/**
@@ -256,30 +256,30 @@ int toupper(int c)
*/
unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
- unsigned long result = 0,value;
+ 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;
+ 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;
}
/**
@@ -290,9 +290,9 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
*/
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);
+ if(*cp=='-')
+ return -simple_strtoul(cp+1,endp,base);
+ return simple_strtoul(cp,endp,base);
}
/**
@@ -303,30 +303,30 @@ long simple_strtol(const char *cp,char **endp,unsigned int base)
*/
unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
{
- unsigned long long result = 0, value;
+ 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;
+ 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;
}
/**
@@ -337,284 +337,284 @@ unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
*/
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);
+ 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
+ * @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;
+ 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;
+ }
- 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;
+ }
- /* anything that is not a conversion must match exactly */
- if (*fmt != '%' && *fmt) {
- if (*fmt++ != *str++)
- break;
- continue;
- }
+ if (!*fmt)
+ break;
+ ++fmt;
- 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;
- }
+ /* 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 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;
+ /* 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;
+ 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++;
+ 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;
- }
+ /* 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++;
+ /* have some sort of integer conversion.
+ * first, skip white space in buffer.
+ */
+ while (isspace(*str))
+ str++;
- if (!*str || !isdigit(*str))
- break;
+ 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++;
+ 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;
+ 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
+ * @buf: input buffer
+ * @fmt: formatting of buffer
+ * @...: resulting arguments
*/
int sscanf(const char * buf, const char * fmt, ...)
{
- va_list args;
- int i;
+ va_list args;
+ int i;
+
+ va_start(args,fmt);
+ i = vsscanf(buf,fmt,args);
+ va_end(args);
- va_start(args,fmt);
- i = vsscanf(buf,fmt,args);
- va_end(args);
-
- return i;
+ return i;
}
size_t strspn(const char *s, const char *accept)
{
- size_t l=0;
- int a=1,i, al=strlen(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;
+ 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);
+ 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;
+ 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;
+ 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==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;
+ 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);
+ 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;
+ const unsigned char *s = (const unsigned char *)s1;
+ unsigned char c = (unsigned int)i;
- while (*s && *s != c)
- {
- s++;
- }
+ while (*s && *s != c)
+ {
+ s++;
+ }
- if (*s != c)
- {
- s = NULL;
- }
+ if (*s != c)
+ {
+ s = NULL;
+ }
- return (char *) s;
+ return (char *) s;
}
long strtol(const char *str, char **endptr, int base)
diff --git a/components/libc/compilers/minilibc/string.h b/components/libc/compilers/minilibc/string.h
index 45524c7764..6ccbc79fe9 100644
--- a/components/libc/compilers/minilibc/string.h
+++ b/components/libc/compilers/minilibc/string.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -16,22 +16,22 @@
/* 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 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 _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) */
+#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);
diff --git a/components/libc/compilers/minilibc/sys/mman.h b/components/libc/compilers/minilibc/sys/mman.h
index 8c61b32b7c..6a260ccd70 100644
--- a/components/libc/compilers/minilibc/sys/mman.h
+++ b/components/libc/compilers/minilibc/sys/mman.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/sys/stat.h b/components/libc/compilers/minilibc/sys/stat.h
index 65db477a4a..8867b84a1b 100644
--- a/components/libc/compilers/minilibc/sys/stat.h
+++ b/components/libc/compilers/minilibc/sys/stat.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -14,31 +14,31 @@
#ifdef RT_USING_DFS
#include <dfs_posix.h>
#else
-#define _FREAD 0x0001 /* read enabled */
-#define _FWRITE 0x0002 /* write enabled */
-#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
-#define _FMARK 0x0010 /* internal; mark during gc() */
-#define _FDEFER 0x0020 /* internal; defer for next gc pass */
-#define _FASYNC 0x0040 /* signal pgrp when data ready */
-#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
-#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
-#define _FCREAT 0x0200 /* open with file create */
-#define _FTRUNC 0x0400 /* open with truncation */
-#define _FEXCL 0x0800 /* error on open if file exists */
-#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
-#define _FSYNC 0x2000 /* do all writes synchronously */
-#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
-#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
-#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
+#define _FREAD 0x0001 /* read enabled */
+#define _FWRITE 0x0002 /* write enabled */
+#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
+#define _FMARK 0x0010 /* internal; mark during gc() */
+#define _FDEFER 0x0020 /* internal; defer for next gc pass */
+#define _FASYNC 0x0040 /* signal pgrp when data ready */
+#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
+#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
+#define _FCREAT 0x0200 /* open with file create */
+#define _FTRUNC 0x0400 /* open with truncation */
+#define _FEXCL 0x0800 /* error on open if file exists */
+#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
+#define _FSYNC 0x2000 /* do all writes synchronously */
+#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
+#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
+#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
-#define O_RDONLY 0 /* +1 == FREAD */
-#define O_WRONLY 1 /* +1 == FWRITE */
-#define O_RDWR 2 /* +1 == FREAD|FWRITE */
-#define O_APPEND _FAPPEND
-#define O_CREAT _FCREAT
-#define O_TRUNC _FTRUNC
-#define O_EXCL _FEXCL
-#define O_SYNC _FSYNC
+#define O_RDONLY 0 /* +1 == FREAD */
+#define O_WRONLY 1 /* +1 == FWRITE */
+#define O_RDWR 2 /* +1 == FREAD|FWRITE */
+#define O_APPEND _FAPPEND
+#define O_CREAT _FCREAT
+#define O_TRUNC _FTRUNC
+#define O_EXCL _FEXCL
+#define O_SYNC _FSYNC
#endif
#endif
diff --git a/components/libc/compilers/minilibc/sys/time.h b/components/libc/compilers/minilibc/sys/time.h
index 22a93f5c9d..aa9e6d704e 100644
--- a/components/libc/compilers/minilibc/sys/time.h
+++ b/components/libc/compilers/minilibc/sys/time.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -17,36 +17,36 @@ typedef long time_t;
* and used in other calls.
*/
struct timeval {
- long tv_sec; /* seconds */
- long tv_usec; /* and microseconds */
+ 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 */
+ 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 */
+ 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]*/
+ 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. */
+ long int tm_gmtoff; /* Seconds east of UTC. */
+ const char *tm_zone; /* Timezone abbreviation. */
};
int gettimeofday(struct timeval *tp, void *ignore);
diff --git a/components/libc/compilers/minilibc/sys/types.h b/components/libc/compilers/minilibc/sys/types.h
index 746235273c..5bed922a0a 100644
--- a/components/libc/compilers/minilibc/sys/types.h
+++ b/components/libc/compilers/minilibc/sys/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -38,7 +38,7 @@ typedef int caddr_t;
typedef unsigned int wint_t;
typedef unsigned long useconds_t;
-typedef unsigned long clock_t; /* clock() */
+typedef unsigned long clock_t; /* clock() */
#ifndef NULL
#define NULL (0)
diff --git a/components/libc/compilers/minilibc/time.c b/components/libc/compilers/minilibc/time.c
index 25e8f0e310..3ac76c883f 100644
--- a/components/libc/compilers/minilibc/time.c
+++ b/components/libc/compilers/minilibc/time.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/minilibc/time.h b/components/libc/compilers/minilibc/time.h
index 09fc7d2e67..fba310fbe4 100644
--- a/components/libc/compilers/minilibc/time.h
+++ b/components/libc/compilers/minilibc/time.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/newlib/libc.c b/components/libc/compilers/newlib/libc.c
index 2234c36f98..9834a9a015 100644
--- a/components/libc/compilers/newlib/libc.c
+++ b/components/libc/compilers/newlib/libc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -19,7 +19,7 @@
#include <pthread.h>
#endif
-int _EXFUN(putenv,(char *__string));
+int _EXFUN(putenv,(char *__string));
int libc_system_init(void)
{
diff --git a/components/libc/compilers/newlib/libc.h b/components/libc/compilers/newlib/libc.h
index fdf2ab4f60..bf294ac116 100644
--- a/components/libc/compilers/newlib/libc.h
+++ b/components/libc/compilers/newlib/libc.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -16,7 +16,7 @@
#include <sys/time.h>
#ifndef _EXFUN
-#define _EXFUN(name, proto) name proto
+#define _EXFUN(name, proto) name proto
#endif
#define MILLISECOND_PER_SECOND 1000UL
diff --git a/components/libc/compilers/newlib/libc_syms.c b/components/libc/compilers/newlib/libc_syms.c
index b150c10fd6..f0882afcfc 100644
--- a/components/libc/compilers/newlib/libc_syms.c
+++ b/components/libc/compilers/newlib/libc_syms.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/newlib/stdio.c
index 233a447396..ce5bdb75cb 100644
--- a/components/libc/compilers/newlib/stdio.c
+++ b/components/libc/compilers/newlib/stdio.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -15,7 +15,7 @@
#define STDIO_DEVICE_NAME_MAX 32
-int _EXFUN(fileno, (FILE *));
+int _EXFUN(fileno, (FILE *));
static FILE* std_console = NULL;
@@ -48,7 +48,7 @@ int libc_stdio_set_console(const char* device_name, int mode)
{
_GLOBAL_REENT->_stdin = std_console;
}
- else
+ else
{
_GLOBAL_REENT->_stdin = NULL;
}
diff --git a/components/libc/compilers/newlib/sys/dirent.h b/components/libc/compilers/newlib/sys/dirent.h
index db8c0655a1..bfba586093 100644
--- a/components/libc/compilers/newlib/sys/dirent.h
+++ b/components/libc/compilers/newlib/sys/dirent.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -17,36 +17,36 @@
*/
/* File types */
-#define FT_REGULAR 0 /* regular file */
-#define FT_SOCKET 1 /* socket file */
-#define FT_DIRECTORY 2 /* directory */
-#define FT_USER 3 /* user defined */
+#define FT_REGULAR 0 /* regular file */
+#define FT_SOCKET 1 /* socket file */
+#define FT_DIRECTORY 2 /* directory */
+#define FT_USER 3 /* user defined */
-#define DT_UNKNOWN 0x00
-#define DT_REG 0x01
-#define DT_DIR 0x02
+#define DT_UNKNOWN 0x00
+#define DT_REG 0x01
+#define DT_DIR 0x02
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_DIR_STRUCTURE
-typedef struct
+typedef struct
{
- int fd; /* directory file */
- char buf[512];
- int num;
- int cur;
+ int fd; /* directory file */
+ char buf[512];
+ int num;
+ int cur;
} DIR;
#endif
#ifndef HAVE_DIRENT_STRUCTURE
struct dirent
{
- rt_uint8_t d_type; /* The type of the file */
- rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
- rt_uint16_t d_reclen; /* length of this record */
- char d_name[256]; /* The null-terminated file name */
+ rt_uint8_t d_type; /* The type of the file */
+ rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */
+ rt_uint16_t d_reclen; /* length of this record */
+ char d_name[256]; /* The null-terminated file name */
};
#endif
diff --git a/components/libc/compilers/newlib/sys/mman.h b/components/libc/compilers/newlib/sys/mman.h
index 8c61b32b7c..6a260ccd70 100644
--- a/components/libc/compilers/newlib/sys/mman.h
+++ b/components/libc/compilers/newlib/sys/mman.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/newlib/sys/statfs.h b/components/libc/compilers/newlib/sys/statfs.h
index 3c923a21f9..0996af9a18 100644
--- a/components/libc/compilers/newlib/sys/statfs.h
+++ b/components/libc/compilers/newlib/sys/statfs.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -13,9 +13,9 @@
struct statfs
{
- rt_size_t f_bsize; /* block size */
- rt_size_t f_blocks; /* total data blocks in file system */
- rt_size_t f_bfree; /* free blocks in file system */
+ rt_size_t f_bsize; /* block size */
+ rt_size_t f_blocks; /* total data blocks in file system */
+ rt_size_t f_bfree; /* free blocks in file system */
};
#endif
diff --git a/components/libc/compilers/newlib/sys/termios.h b/components/libc/compilers/newlib/sys/termios.h
index ce95230e88..c4b42083c4 100644
--- a/components/libc/compilers/newlib/sys/termios.h
+++ b/components/libc/compilers/newlib/sys/termios.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c
index 228fa0d140..754059fe2f 100644
--- a/components/libc/compilers/newlib/syscalls.c
+++ b/components/libc/compilers/newlib/syscalls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*