[hackers] [scc] Install scc headers is a custom directory || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 20 Jun 2016 14:02:24 +0200 (CEST)

commit 392865a83653ffd582efd2c855cab9ac853cadc2
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Jun 20 14:00:12 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Jun 20 14:00:12 2016 +0200

    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 --git a/Makefile b/Makefile
index 7148f69..d28cabd 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -35,9 +35,12 @@ $(ARCHS):
 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
 
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 9b89b12..96ee358 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -472,6 +472,7 @@ include(void)
         char *file, *p, **bp;
         size_t filelen;
         static char *sysinclude[] = {
+ PREFIX "/include/scc/" ARCH "/",
                 PREFIX"/include/",
                 PREFIX"/local/include/",
                 NULL
diff --git a/config.mk b/config.mk
index d2b349e..dc93d9c 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -17,7 +17,12 @@ MANPREFIX = ${PREFIX}/share/man
 # 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:
diff --git a/libc/include/amd64-sysv/assert.h b/libc/include/amd64-sysv/assert.h
new file mode 100644
index 0000000..339c7aa
--- /dev/null
+++ b/libc/include/amd64-sysv/assert.h
_AT_@ -0,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
diff --git a/libc/include/amd64-sysv/ctype.h b/libc/include/amd64-sysv/ctype.h
new file mode 100644
index 0000000..5f18d76
--- /dev/null
+++ b/libc/include/amd64-sysv/ctype.h
_AT_@ -0,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
diff --git a/libc/include/amd64-sysv/errno.h b/libc/include/amd64-sysv/errno.h
new file mode 100644
index 0000000..ffb42ca
--- /dev/null
+++ b/libc/include/amd64-sysv/errno.h
_AT_@ -0,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
diff --git a/libc/include/amd64-sysv/signal.h b/libc/include/amd64-sysv/signal.h
new file mode 100644
index 0000000..24735f2
--- /dev/null
+++ b/libc/include/amd64-sysv/signal.h
_AT_@ -0,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
diff --git a/libc/include/amd64-sysv/stdio.h b/libc/include/amd64-sysv/stdio.h
new file mode 100644
index 0000000..e9df1a4
--- /dev/null
+++ b/libc/include/amd64-sysv/stdio.h
_AT_@ -0,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
diff --git a/libc/include/amd64-sysv/stdlib.h b/libc/include/amd64-sysv/stdlib.h
new file mode 100644
index 0000000..a265254
--- /dev/null
+++ b/libc/include/amd64-sysv/stdlib.h
_AT_@ -0,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
diff --git a/libc/include/amd64-sysv/string.h b/libc/include/amd64-sysv/string.h
new file mode 100644
index 0000000..5bbac19
--- /dev/null
+++ b/libc/include/amd64-sysv/string.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/assert.h b/libc/include/i386-sysv/assert.h
new file mode 100644
index 0000000..339c7aa
--- /dev/null
+++ b/libc/include/i386-sysv/assert.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/ctype.h b/libc/include/i386-sysv/ctype.h
new file mode 100644
index 0000000..5f18d76
--- /dev/null
+++ b/libc/include/i386-sysv/ctype.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/errno.h b/libc/include/i386-sysv/errno.h
new file mode 100644
index 0000000..ffb42ca
--- /dev/null
+++ b/libc/include/i386-sysv/errno.h
_AT_@ -0,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
diff --git a/libc/include/i386-sysv/signal.h b/libc/include/i386-sysv/signal.h
new file mode 100644
index 0000000..24735f2
--- /dev/null
+++ b/libc/include/i386-sysv/signal.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/stdio.h b/libc/include/i386-sysv/stdio.h
new file mode 100644
index 0000000..e9df1a4
--- /dev/null
+++ b/libc/include/i386-sysv/stdio.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/stdlib.h b/libc/include/i386-sysv/stdlib.h
new file mode 100644
index 0000000..a265254
--- /dev/null
+++ b/libc/include/i386-sysv/stdlib.h
_AT_@ -0,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
diff --git a/libc/include/i386-sysv/string.h b/libc/include/i386-sysv/string.h
new file mode 100644
index 0000000..5bbac19
--- /dev/null
+++ b/libc/include/i386-sysv/string.h
_AT_@ -0,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
diff --git a/libc/include/qbe/assert.h b/libc/include/qbe/assert.h
new file mode 100644
index 0000000..339c7aa
--- /dev/null
+++ b/libc/include/qbe/assert.h
_AT_@ -0,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
diff --git a/libc/include/qbe/ctype.h b/libc/include/qbe/ctype.h
new file mode 100644
index 0000000..5f18d76
--- /dev/null
+++ b/libc/include/qbe/ctype.h
_AT_@ -0,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
diff --git a/libc/include/qbe/errno.h b/libc/include/qbe/errno.h
new file mode 100644
index 0000000..ffb42ca
--- /dev/null
+++ b/libc/include/qbe/errno.h
_AT_@ -0,0 +1,7 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+extern int errno;
+
+#endif
diff --git a/libc/include/qbe/signal.h b/libc/include/qbe/signal.h
new file mode 100644
index 0000000..24735f2
--- /dev/null
+++ b/libc/include/qbe/signal.h
_AT_@ -0,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
diff --git a/libc/include/qbe/stdio.h b/libc/include/qbe/stdio.h
new file mode 100644
index 0000000..e9df1a4
--- /dev/null
+++ b/libc/include/qbe/stdio.h
_AT_@ -0,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
diff --git a/libc/include/qbe/stdlib.h b/libc/include/qbe/stdlib.h
new file mode 100644
index 0000000..a265254
--- /dev/null
+++ b/libc/include/qbe/stdlib.h
_AT_@ -0,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
diff --git a/libc/include/qbe/string.h b/libc/include/qbe/string.h
new file mode 100644
index 0000000..5bbac19
--- /dev/null
+++ b/libc/include/qbe/string.h
_AT_@ -0,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
diff --git a/libc/include/z80/stdio.h b/libc/include/z80/stdio.h
index d5463a0..636796f 100644
--- a/libc/include/z80/stdio.h
+++ b/libc/include/z80/stdio.h
_AT_@ -8,6 +8,7 @@
 
 #ifndef _SIZET
 typedef unsigned size_t;
+#define _SIZET
 #endif
 
 #define EOF -1
diff --git a/libc/include/z80/stdlib.h b/libc/include/z80/stdlib.h
index f135694..ff27b04 100644
--- a/libc/include/z80/stdlib.h
+++ b/libc/include/z80/stdlib.h
_AT_@ -4,6 +4,7 @@
 
 #ifndef _SIZET
 typedef unsigned size_t;
+#define _SIZET
 #endif
 
 #ifndef NULL
Received on Mon Jun 20 2016 - 14:02:24 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 20 2016 - 14:12:13 CEST