Compare commits

...

2 Commits
master ... lua

6 changed files with 37 additions and 2 deletions

View File

@ -145,6 +145,8 @@ set(SOURCES
src/stdio/snprintf.c
src/stdio/sprintf.c
src/stdio/streams.c
src/stdio/tmpfile.c
src/stdio/tmpnam.c
src/stdio/ungetc.c
src/stdio/vasprintf.c
src/stdio/vdprintf.c
@ -162,6 +164,7 @@ set(SOURCES
src/stdlib/calloc.c
src/stdlib/div.c
src/stdlib/exit.c
src/stdlib/getenv.c
src/stdlib/labs.c
src/stdlib/ldiv.c
src/stdlib/llabs.c
@ -177,6 +180,7 @@ set(SOURCES
src/stdlib/strtoll.c
src/stdlib/strtoul.c
src/stdlib/strtoull.c
src/stdlib/system.c
# string
src/string/memchr.c
src/string/memcmp.c

6
src/stdio/tmpfile.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
FILE *tmpfile(void)
{
return NULL;
}

7
src/stdio/tmpnam.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
char *tmpnam(char *s)
{
(void)s;
return NULL;
}

7
src/stdlib/getenv.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdlib.h>
char *getenv(char const *name)
{
(void)name;
return NULL;
}

11
src/stdlib/system.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdlib.h>
int system(char const *command)
{
/* No command: determine whether there is a shell */
if(!command)
return 0;
/* Command: pretend it fails and return 1 */
return 1;
}

View File

@ -18,12 +18,12 @@ static const char *month_names[12] = {
}; break
/* Perform a sub-call to strftime to expand a complex format */
#define do_strftime(fmt) { \
size_t _written = strftime2(s+len, n-len, fmt, time); \
size_t _written = strftime(s+len, n-len, fmt, time); \
if(_written == 0) goto full; \
len += _written; \
}; break
size_t strftime2(char * restrict s, size_t n, const char * restrict format,
size_t strftime(char * restrict s, size_t n, const char * restrict format,
const struct tm * restrict time)
{
size_t len = 0;