shithub: scc

Download patch

ref: 41247e13bc2d5f5a142e7524d39e494f5b391ad5
parent: cfe807ad6019b35141c53981f42e2289c66e9bb1
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Jun 20 10:00:12 EDT 2016

Install scc headers is a custom directory

It is going to be useful to have the standard headers in a known
directory which will not cause conflicts with the system headers.

diff: cannot open b/libc/include/amd64-sysv//null: file does not exist: 'b/libc/include/amd64-sysv//null' diff: cannot open b/libc/include/i386-sysv//null: file does not exist: 'b/libc/include/i386-sysv//null' diff: cannot open b/libc/include/qbe//null: file does not exist: 'b/libc/include/qbe//null'
--- a/Makefile
+++ b/Makefile
@@ -35,9 +35,12 @@
 install: all
 	mkdir -p $(PREFIX)/libexec/scc/
 	mkdir -p $(PREFIX)/bin/
+	mkdir -p $(PREFIX)/include/scc
 	cp -f bin/cc* $(PREFIX)/libexec/scc/
 	cp -f bin/cc1 $(PREFIX)/bin/cpp
 	cp -f bin/scc $(PREFIX)/bin/
+	cp -fr libc/include/* $(PREFIX)/include/scc/
+	find $(PREFIX)/include/scc/ -type f | xargs chmod 644
 	cd $(PREFIX)/libexec/scc/ && chmod 755 cc* && strip cc*
 	cd $(PREFIX)/bin && chmod 755 cpp scc && strip cpp scc
 
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -472,6 +472,7 @@
 	char *file, *p, **bp;
 	size_t filelen;
 	static char *sysinclude[] = {
+		PREFIX "/include/scc/" ARCH  "/",
 		PREFIX"/include/",
 		PREFIX"/local/include/",
 		NULL
--- a/config.mk
+++ b/config.mk
@@ -17,7 +17,12 @@
 # AR = ar
 
 # for Plan9 add -D_SUSV2_SOURCE
-SCC_CFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\"$(PREFIX)\" $(CFLAGS)
+SCC_CFLAGS = -DARCH=\"$(ARCH)\" \
+             -Iarch/$(ARCH) \
+             -DPREFIX=\"$(PREFIX)\" \
+             -DNDEBUG \
+             $(CFLAGS)
+
 SCC_LDFLAGS = $(LDFLAGS)
 
 .c.o:
--- /dev/null
+++ b/libc/include/amd64-sysv/assert.h
@@ -1,0 +1,9 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ASSERT_H
+#define _ASSERT_H
+
+#ifndef NDEBUG
+#define assert(exp) __assert(#exp, __FILE__, __LINE__)
+#endif
+
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/ctype.h
@@ -1,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+int isalnum(int c);
+int isalpha(int c);
+int islower(int c);
+int isupper(int c);
+int isdigit(int c);
+int isxdigit(int c);
+int iscntrl(int c);
+int isgraph(int c);
+int isspace(int c);
+int isblank(int c);
+int isprint(int c);
+int ispunct(int c);
+int tolower(int c);
+int toupper(int c);
+
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/errno.h
@@ -1,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/signal.h
@@ -1,0 +1,8 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+void ( *signal(int signum, void (*handler)(int)) ) (int);
+int raise(int sig);
+
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/stdio.h
@@ -1,0 +1,79 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define EOF            -1
+#define BUFSIZ        512
+#define FILENAME_MAX  256
+#define FOPEN_MAX      16
+#define _IOFBF          0
+#define _IOLBF          1
+#define _IONBF          2
+#define L_tmpnam      256
+#define SEEK_CUR        0
+#define SEEK_END        1
+#define SEEK_SET        2
+#define TMP_MAX        25
+
+typedef struct _FILE FILE;
+
+extern FILE *fopen(const char *, const char *mode);
+extern FILE *freopen(const char *path, const char *mode, FILE *fp);
+extern int fclose(FILE *fp);
+
+extern int fflush(FILE *fp);
+extern void setbuf(FILE *fp, char *buf);
+extern int setvbuf(FILE *fp, char *buf, size_t size);
+
+extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp);
+extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp);
+
+extern int fgetc(FILE *fp);
+extern int getc(FILE *fp);
+extern int getchar(void);
+
+extern int fputc(int c, FILE *fp);
+extern int putc(int c, FILE *fp);
+extern int putchar(int c);
+
+extern char *fgets(char *s, int size, FILE *fp);
+extern char *gets(char *s);
+
+extern int fputs(char *s, FILE *fp);
+extern int puts(char *s);
+
+extern int scanf(const char *fmt, ...);
+extern int fscanf(FILE *fp, const char *fmt, ...);
+extern int sscanf(char *s, const char *fmt, ...);
+
+extern int printf(const char *fmt, ...);
+extern int fprintf(FILE *fp, const char *fmt, ...);
+extern int sprintf(char *s, const char *fmt, ...);
+extern int snprintf(char *s, size_t size, const char *fmt, ...);
+
+extern void perror(const char *s);
+
+extern long ftell(FILE *fp);
+extern long fseek(FILE *fp);
+extern void rewind(FILE *fp);
+
+extern void clearerr(FILE *fp);
+extern int feof(FILE *fp);
+extern int ferror(FILE *fp);
+
+extern int remove(const char *name);
+extern int rename(const char *old, const char *new);
+extern FILE *tmpfile(void);
+extern FILE *tmpnam(char *s);
+
+extern FILE *stdin, *stdio, *stderr;
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/stdlib.h
@@ -1,0 +1,56 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+#define RAND_MAX     32767
+
+extern double atof(const char *ptr);
+extern int atoi(const char *s);
+extern long atol(const char *s);
+extern long long atoll(const char *s);
+
+extern float strtof(const char *s, char **end);
+extern double strtod(const char *s, char **end);
+extern long double strtold(const char *s, char **end);
+
+extern long strtol(const char *s, char **end, int base);
+extern long long strtoll(const char *s, char **end, int base);
+extern unsigned long stroul(const char *s, char **end, int base);
+extern unsigned long long stroull(const char *s, char **end, int base);
+
+extern void *calloc(size_t nitems, size_t size);
+extern void free(void *ptr);
+extern void *realloc(void *ptr, size_t size);
+
+extern void abort(void);
+extern int atexit(void (*func)(void));
+extern void exit(int status);
+extern char *getenv(const char *name);
+extern int system(const char *cmd);
+
+extern void *bsearch(const void *key,
+                     const void *base, size_t nitems, size_t size,
+                     int (*cmp)(const void *, const void *));
+extern void qsort(void *base, size_t nitems, size_t size,
+                  int (*cmp)(const void *, const void *));
+
+extern void abs(int x);
+/* div_t div(int num, int denom); */
+extern long labs(long int x);
+/* ldiv_t ldiv(long int number, long int denom);
+
+extern int rand(void);
+extern void srand(unsigned seed);
+
+#endif
--- /dev/null
+++ b/libc/include/amd64-sysv/string.h
@@ -1,0 +1,35 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STRING_H
+#define _STRING_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned size_t;
+#endif
+
+extern char *strcpy(char *dst, const char *src);
+extern char *strncpy(char *dst, const char *src, size_t n);
+extern char *strcat(char *dst, const char *src);
+extern char *strncat(char *dst, const char *src, size_t n);
+extern size_t strxfrm(char *dst, const *char *src, size_t n);
+extern size_t strlen(const char *s);
+extern int strcmp(const char *s1, const char *s2);
+extern int strcoll(const char *s1, const char *s2);
+extern char *strchr(const char *s, int c);
+extern char *strrchr(const char *s, int c);
+extern size_t strspn(const char *s, const char *accept);
+extern size_t strcspn(const char *s, const char *reject);
+extern size_t strpbrk(const char *s, const char *accept);
+extern size_t strstr(const char *s, const char *sub);
+extern char *strtok(const char *s, const char *delim);
+
+extern void *memset(void *s, int c, size_t n);
+extern void *memcpy(void *dst, const void *src, size_t n);
+extern void *memmove(void *dst, const void *src, size_t n);
+extern int memcmp(const void *s1, const void *s2, size_t n);
+extern coid *memchr(const void *s, int c, size_t n);
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/assert.h
@@ -1,0 +1,9 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ASSERT_H
+#define _ASSERT_H
+
+#ifndef NDEBUG
+#define assert(exp) __assert(#exp, __FILE__, __LINE__)
+#endif
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/ctype.h
@@ -1,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+int isalnum(int c);
+int isalpha(int c);
+int islower(int c);
+int isupper(int c);
+int isdigit(int c);
+int isxdigit(int c);
+int iscntrl(int c);
+int isgraph(int c);
+int isspace(int c);
+int isblank(int c);
+int isprint(int c);
+int ispunct(int c);
+int tolower(int c);
+int toupper(int c);
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/errno.h
@@ -1,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/signal.h
@@ -1,0 +1,8 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+void ( *signal(int signum, void (*handler)(int)) ) (int);
+int raise(int sig);
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/stdio.h
@@ -1,0 +1,79 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define EOF            -1
+#define BUFSIZ        512
+#define FILENAME_MAX  256
+#define FOPEN_MAX      16
+#define _IOFBF          0
+#define _IOLBF          1
+#define _IONBF          2
+#define L_tmpnam      256
+#define SEEK_CUR        0
+#define SEEK_END        1
+#define SEEK_SET        2
+#define TMP_MAX        25
+
+typedef struct _FILE FILE;
+
+extern FILE *fopen(const char *, const char *mode);
+extern FILE *freopen(const char *path, const char *mode, FILE *fp);
+extern int fclose(FILE *fp);
+
+extern int fflush(FILE *fp);
+extern void setbuf(FILE *fp, char *buf);
+extern int setvbuf(FILE *fp, char *buf, size_t size);
+
+extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp);
+extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp);
+
+extern int fgetc(FILE *fp);
+extern int getc(FILE *fp);
+extern int getchar(void);
+
+extern int fputc(int c, FILE *fp);
+extern int putc(int c, FILE *fp);
+extern int putchar(int c);
+
+extern char *fgets(char *s, int size, FILE *fp);
+extern char *gets(char *s);
+
+extern int fputs(char *s, FILE *fp);
+extern int puts(char *s);
+
+extern int scanf(const char *fmt, ...);
+extern int fscanf(FILE *fp, const char *fmt, ...);
+extern int sscanf(char *s, const char *fmt, ...);
+
+extern int printf(const char *fmt, ...);
+extern int fprintf(FILE *fp, const char *fmt, ...);
+extern int sprintf(char *s, const char *fmt, ...);
+extern int snprintf(char *s, size_t size, const char *fmt, ...);
+
+extern void perror(const char *s);
+
+extern long ftell(FILE *fp);
+extern long fseek(FILE *fp);
+extern void rewind(FILE *fp);
+
+extern void clearerr(FILE *fp);
+extern int feof(FILE *fp);
+extern int ferror(FILE *fp);
+
+extern int remove(const char *name);
+extern int rename(const char *old, const char *new);
+extern FILE *tmpfile(void);
+extern FILE *tmpnam(char *s);
+
+extern FILE *stdin, *stdio, *stderr;
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/stdlib.h
@@ -1,0 +1,56 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+#define RAND_MAX     32767
+
+extern double atof(const char *ptr);
+extern int atoi(const char *s);
+extern long atol(const char *s);
+extern long long atoll(const char *s);
+
+extern float strtof(const char *s, char **end);
+extern double strtod(const char *s, char **end);
+extern long double strtold(const char *s, char **end);
+
+extern long strtol(const char *s, char **end, int base);
+extern long long strtoll(const char *s, char **end, int base);
+extern unsigned long stroul(const char *s, char **end, int base);
+extern unsigned long long stroull(const char *s, char **end, int base);
+
+extern void *calloc(size_t nitems, size_t size);
+extern void free(void *ptr);
+extern void *realloc(void *ptr, size_t size);
+
+extern void abort(void);
+extern int atexit(void (*func)(void));
+extern void exit(int status);
+extern char *getenv(const char *name);
+extern int system(const char *cmd);
+
+extern void *bsearch(const void *key,
+                     const void *base, size_t nitems, size_t size,
+                     int (*cmp)(const void *, const void *));
+extern void qsort(void *base, size_t nitems, size_t size,
+                  int (*cmp)(const void *, const void *));
+
+extern void abs(int x);
+/* div_t div(int num, int denom); */
+extern long labs(long int x);
+/* ldiv_t ldiv(long int number, long int denom);
+
+extern int rand(void);
+extern void srand(unsigned seed);
+
+#endif
--- /dev/null
+++ b/libc/include/i386-sysv/string.h
@@ -1,0 +1,35 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STRING_H
+#define _STRING_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned size_t;
+#endif
+
+extern char *strcpy(char *dst, const char *src);
+extern char *strncpy(char *dst, const char *src, size_t n);
+extern char *strcat(char *dst, const char *src);
+extern char *strncat(char *dst, const char *src, size_t n);
+extern size_t strxfrm(char *dst, const *char *src, size_t n);
+extern size_t strlen(const char *s);
+extern int strcmp(const char *s1, const char *s2);
+extern int strcoll(const char *s1, const char *s2);
+extern char *strchr(const char *s, int c);
+extern char *strrchr(const char *s, int c);
+extern size_t strspn(const char *s, const char *accept);
+extern size_t strcspn(const char *s, const char *reject);
+extern size_t strpbrk(const char *s, const char *accept);
+extern size_t strstr(const char *s, const char *sub);
+extern char *strtok(const char *s, const char *delim);
+
+extern void *memset(void *s, int c, size_t n);
+extern void *memcpy(void *dst, const void *src, size_t n);
+extern void *memmove(void *dst, const void *src, size_t n);
+extern int memcmp(const void *s1, const void *s2, size_t n);
+extern coid *memchr(const void *s, int c, size_t n);
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/assert.h
@@ -1,0 +1,9 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ASSERT_H
+#define _ASSERT_H
+
+#ifndef NDEBUG
+#define assert(exp) __assert(#exp, __FILE__, __LINE__)
+#endif
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/ctype.h
@@ -1,0 +1,20 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+int isalnum(int c);
+int isalpha(int c);
+int islower(int c);
+int isupper(int c);
+int isdigit(int c);
+int isxdigit(int c);
+int iscntrl(int c);
+int isgraph(int c);
+int isspace(int c);
+int isblank(int c);
+int isprint(int c);
+int ispunct(int c);
+int tolower(int c);
+int toupper(int c);
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/errno.h
@@ -1,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/signal.h
@@ -1,0 +1,8 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+void ( *signal(int signum, void (*handler)(int)) ) (int);
+int raise(int sig);
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/stdio.h
@@ -1,0 +1,79 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define EOF            -1
+#define BUFSIZ        512
+#define FILENAME_MAX  256
+#define FOPEN_MAX      16
+#define _IOFBF          0
+#define _IOLBF          1
+#define _IONBF          2
+#define L_tmpnam      256
+#define SEEK_CUR        0
+#define SEEK_END        1
+#define SEEK_SET        2
+#define TMP_MAX        25
+
+typedef struct _FILE FILE;
+
+extern FILE *fopen(const char *, const char *mode);
+extern FILE *freopen(const char *path, const char *mode, FILE *fp);
+extern int fclose(FILE *fp);
+
+extern int fflush(FILE *fp);
+extern void setbuf(FILE *fp, char *buf);
+extern int setvbuf(FILE *fp, char *buf, size_t size);
+
+extern size_t fread(void *ptr, size_t size, size_t n, FILE *fp);
+extern size_t fwrite(const void *ptr, size_t size, size n, FILE *fp);
+
+extern int fgetc(FILE *fp);
+extern int getc(FILE *fp);
+extern int getchar(void);
+
+extern int fputc(int c, FILE *fp);
+extern int putc(int c, FILE *fp);
+extern int putchar(int c);
+
+extern char *fgets(char *s, int size, FILE *fp);
+extern char *gets(char *s);
+
+extern int fputs(char *s, FILE *fp);
+extern int puts(char *s);
+
+extern int scanf(const char *fmt, ...);
+extern int fscanf(FILE *fp, const char *fmt, ...);
+extern int sscanf(char *s, const char *fmt, ...);
+
+extern int printf(const char *fmt, ...);
+extern int fprintf(FILE *fp, const char *fmt, ...);
+extern int sprintf(char *s, const char *fmt, ...);
+extern int snprintf(char *s, size_t size, const char *fmt, ...);
+
+extern void perror(const char *s);
+
+extern long ftell(FILE *fp);
+extern long fseek(FILE *fp);
+extern void rewind(FILE *fp);
+
+extern void clearerr(FILE *fp);
+extern int feof(FILE *fp);
+extern int ferror(FILE *fp);
+
+extern int remove(const char *name);
+extern int rename(const char *old, const char *new);
+extern FILE *tmpfile(void);
+extern FILE *tmpnam(char *s);
+
+extern FILE *stdin, *stdio, *stderr;
+#endif
--- /dev/null
+++ b/libc/include/qbe/stdlib.h
@@ -1,0 +1,56 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+#define RAND_MAX     32767
+
+extern double atof(const char *ptr);
+extern int atoi(const char *s);
+extern long atol(const char *s);
+extern long long atoll(const char *s);
+
+extern float strtof(const char *s, char **end);
+extern double strtod(const char *s, char **end);
+extern long double strtold(const char *s, char **end);
+
+extern long strtol(const char *s, char **end, int base);
+extern long long strtoll(const char *s, char **end, int base);
+extern unsigned long stroul(const char *s, char **end, int base);
+extern unsigned long long stroull(const char *s, char **end, int base);
+
+extern void *calloc(size_t nitems, size_t size);
+extern void free(void *ptr);
+extern void *realloc(void *ptr, size_t size);
+
+extern void abort(void);
+extern int atexit(void (*func)(void));
+extern void exit(int status);
+extern char *getenv(const char *name);
+extern int system(const char *cmd);
+
+extern void *bsearch(const void *key,
+                     const void *base, size_t nitems, size_t size,
+                     int (*cmp)(const void *, const void *));
+extern void qsort(void *base, size_t nitems, size_t size,
+                  int (*cmp)(const void *, const void *));
+
+extern void abs(int x);
+/* div_t div(int num, int denom); */
+extern long labs(long int x);
+/* ldiv_t ldiv(long int number, long int denom);
+
+extern int rand(void);
+extern void srand(unsigned seed);
+
+#endif
--- /dev/null
+++ b/libc/include/qbe/string.h
@@ -1,0 +1,35 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _STRING_H
+#define _STRING_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned size_t;
+#endif
+
+extern char *strcpy(char *dst, const char *src);
+extern char *strncpy(char *dst, const char *src, size_t n);
+extern char *strcat(char *dst, const char *src);
+extern char *strncat(char *dst, const char *src, size_t n);
+extern size_t strxfrm(char *dst, const *char *src, size_t n);
+extern size_t strlen(const char *s);
+extern int strcmp(const char *s1, const char *s2);
+extern int strcoll(const char *s1, const char *s2);
+extern char *strchr(const char *s, int c);
+extern char *strrchr(const char *s, int c);
+extern size_t strspn(const char *s, const char *accept);
+extern size_t strcspn(const char *s, const char *reject);
+extern size_t strpbrk(const char *s, const char *accept);
+extern size_t strstr(const char *s, const char *sub);
+extern char *strtok(const char *s, const char *delim);
+
+extern void *memset(void *s, int c, size_t n);
+extern void *memcpy(void *dst, const void *src, size_t n);
+extern void *memmove(void *dst, const void *src, size_t n);
+extern int memcmp(const void *s1, const void *s2, size_t n);
+extern coid *memchr(const void *s, int c, size_t n);
+
+#endif
--- a/libc/include/z80/stdio.h
+++ b/libc/include/z80/stdio.h
@@ -8,6 +8,7 @@
 
 #ifndef _SIZET
 typedef unsigned size_t;
+#define _SIZET
 #endif
 
 #define EOF            -1
--- a/libc/include/z80/stdlib.h
+++ b/libc/include/z80/stdlib.h
@@ -4,6 +4,7 @@
 
 #ifndef _SIZET
 typedef unsigned size_t;
+#define _SIZET
 #endif
 
 #ifndef NULL