Add check for invalid numbers.
[tinycc.git] / tcclib.h
bloba7cc8a38716957eafbc4215d0d7515e4f72139f7
1 /* Simple libc header for TCC
2 *
3 * Add any function you want from the libc there. This file is here
4 * only for your convenience so that you do not need to put the whole
5 * glibc include files on your floppy disk
6 */
7 #ifndef _TCCLIB_H
8 #define _TCCLIB_H
10 #include <stddef.h>
11 #include <stdarg.h>
13 /* stdlib.h */
14 void *calloc(size_t nmemb, size_t size);
15 void *malloc(size_t size);
16 void free(void *ptr);
17 void *realloc(void *ptr, size_t size);
18 int atoi(const char *nptr);
19 long int strtol(const char *nptr, char **endptr, int base);
20 unsigned long int strtoul(const char *nptr, char **endptr, int base);
22 /* stdio.h */
23 typedef struct __FILE FILE;
24 #define EOF (-1)
25 extern FILE *stdin;
26 extern FILE *stdout;
27 extern FILE *stderr;
28 FILE *fopen(const char *path, const char *mode);
29 FILE *fdopen(int fildes, const char *mode);
30 FILE *freopen(const char *path, const char *mode, FILE *stream);
31 int fclose(FILE *stream);
32 size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
33 size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
34 int fgetc(FILE *stream);
35 char *fgets(char *s, int size, FILE *stream);
36 int getc(FILE *stream);
37 int getchar(void);
38 char *gets(char *s);
39 int ungetc(int c, FILE *stream);
40 int fflush(FILE *stream);
42 int printf(const char *format, ...);
43 int fprintf(FILE *stream, const char *format, ...);
44 int sprintf(char *str, const char *format, ...);
45 int snprintf(char *str, size_t size, const char *format, ...);
46 int asprintf(char **strp, const char *format, ...);
47 int dprintf(int fd, const char *format, ...);
48 int vprintf(const char *format, va_list ap);
49 int vfprintf(FILE *stream, const char *format, va_list ap);
50 int vsprintf(char *str, const char *format, va_list ap);
51 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
52 int vasprintf(char **strp, const char *format, va_list ap);
53 int vdprintf(int fd, const char *format, va_list ap);
55 void perror(const char *s);
57 /* string.h */
58 char *strcat(char *dest, const char *src);
59 char *strchr(const char *s, int c);
60 char *strrchr(const char *s, int c);
61 char *strcpy(char *dest, const char *src);
62 void *memcpy(void *dest, const void *src, size_t n);
63 void *memmove(void *dest, const void *src, size_t n);
64 void *memset(void *s, int c, size_t n);
65 char *strdup(const char *s);
67 /* dlfcn.h */
68 #define RTLD_LAZY 0x001
69 #define RTLD_NOW 0x002
70 #define RTLD_GLOBAL 0x100
72 void *dlopen(const char *filename, int flag);
73 const char *dlerror(void);
74 void *dlsym(void *handle, char *symbol);
75 int dlclose(void *handle);
77 #endif /* _TCCLIB_H */