stdio stdlib: add empty getenv/system/tmpnam/tmpfile for Lua

This commit is contained in:
Lephenixnoir 2022-08-22 15:25:55 +02:00
parent a7ae52b4c4
commit e7325c5ace
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
5 changed files with 35 additions and 0 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;
}