From 733b757d7d09d4ac0759d3818506ae3aa02d9183 Mon Sep 17 00:00:00 2001 From: CTurt Date: Mon, 31 Aug 2015 23:57:09 +0100 Subject: [PATCH] Rand and strncpy --- include/libc.h | 4 ++++ source/libc.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/libc.h b/include/libc.h index 323d18b..27f4744 100644 --- a/include/libc.h +++ b/include/libc.h @@ -12,6 +12,7 @@ extern void *(*realloc)(void* ptr, size_t size); extern void *(*memset)(void *destination, int value, size_t num); extern void *(*memcpy)(void *destination, const void *source, size_t num); extern char *(*strcpy)(char *destination, const char *source); +extern char *(*strncpy)(char *destination, const char *source, size_t num); extern char *(*strcat)(char *dest, const char *src); extern char *(*strncat)(char *dest, const char *src, size_t n); extern size_t (*strlen)(const char *s); @@ -23,6 +24,9 @@ extern int (*sscanf)(const char *str, const char *format, ...); extern char *(*strchr)(const char *s, int c); extern char *(*strrchr)(const char *s, int c); +extern void (*srand)(unsigned int seed); +extern int (*rand)(void); + extern char *(*asctime)(const struct tm *tm); extern char *(*asctime_r)(const struct tm *tm, char *buf); extern char *(*ctime)(const time_t *timep); diff --git a/source/libc.c b/source/libc.c index ab9ded1..4d32ea0 100644 --- a/source/libc.c +++ b/source/libc.c @@ -9,6 +9,7 @@ void *(*realloc)(void* ptr, size_t size); void *(*memset)(void *destination, int value, size_t num); void *(*memcpy)(void *destination, const void *source, size_t num); char *(*strcpy)(char *destination, const char *source); +char *(*strncpy)(char *destination, const char *source, size_t num); char *(*strcat)(char *dest, const char *src); char *(*strncat)(char *dest, const char *src, size_t n); size_t (*strlen)(const char *s); @@ -20,6 +21,9 @@ int (*sscanf)(const char *str, const char *format, ...); char *(*strchr)(const char *s, int c); char *(*strrchr)(const char *s, int c); +void (*srand)(unsigned int seed); +int (*rand)(void); + char *(*asctime)(const struct tm *tm); char *(*asctime_r)(const struct tm *tm, char *buf); char *(*ctime)(const time_t *timep); @@ -51,6 +55,7 @@ void initLibc(void) { RESOLVE(libc, memset); RESOLVE(libc, memcpy); RESOLVE(libc, strcpy); + RESOLVE(libc, strncpy); RESOLVE(libc, strcat); RESOLVE(libc, strncat); RESOLVE(libc, strlen); @@ -61,7 +66,10 @@ void initLibc(void) { RESOLVE(libc, sscanf); RESOLVE(libc, strchr); RESOLVE(libc, strrchr); - + + RESOLVE(libc, srand); + RESOLVE(libc, rand); + RESOLVE(libc, asctime); RESOLVE(libc, asctime_r); RESOLVE(libc, ctime); -- 2.11.4.GIT