tinycc/tcclib.h

81 lines
2.5 KiB
C
Raw Normal View History

/* Simple libc header for TCC
*
2001-11-06 04:20:38 +03:00
* Add any function you want from the libc there. This file is here
* only for your convenience so that you do not need to put the whole
* glibc include files on your floppy disk
2001-11-06 04:20:38 +03:00
*/
2002-08-18 17:25:12 +04:00
#ifndef _TCCLIB_H
#define _TCCLIB_H
2001-12-18 00:57:01 +03:00
2001-11-11 05:54:21 +03:00
#include <stddef.h>
#include <stdarg.h>
2001-11-06 04:20:38 +03:00
/* stdlib.h */
void *calloc(size_t nmemb, size_t size);
void *malloc(size_t size);
void free(void *ptr);
void *realloc(void *ptr, size_t size);
int atoi(const char *nptr);
long int strtol(const char *nptr, char **endptr, int base);
unsigned long int strtoul(const char *nptr, char **endptr, int base);
2009-04-18 18:55:51 +04:00
void exit(int);
2001-11-06 04:20:38 +03:00
/* stdio.h */
2001-11-11 05:54:21 +03:00
typedef struct __FILE FILE;
2001-11-06 04:20:38 +03:00
#define EOF (-1)
2001-11-11 21:01:29 +03:00
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
2001-11-06 04:20:38 +03:00
FILE *fopen(const char *path, const char *mode);
FILE *fdopen(int fildes, const char *mode);
FILE *freopen(const char *path, const char *mode, FILE *stream);
int fclose(FILE *stream);
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
int fgetc(FILE *stream);
char *fgets(char *s, int size, FILE *stream);
int getc(FILE *stream);
int getchar(void);
char *gets(char *s);
int ungetc(int c, FILE *stream);
int fflush(FILE *stream);
int putchar (int c);
2001-11-06 04:20:38 +03:00
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_t size, const char *format, ...);
int asprintf(char **strp, const char *format, ...);
2002-08-18 17:25:12 +04:00
int dprintf(int fd, const char *format, ...);
2001-11-06 04:20:38 +03:00
int vprintf(const char *format, va_list ap);
int vfprintf(FILE *stream, const char *format, va_list ap);
int vsprintf(char *str, const char *format, va_list ap);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
int vasprintf(char **strp, const char *format, va_list ap);
2002-08-18 17:25:12 +04:00
int vdprintf(int fd, const char *format, va_list ap);
2001-11-06 04:20:38 +03:00
2001-11-11 05:54:21 +03:00
void perror(const char *s);
2001-11-06 04:20:38 +03:00
/* string.h */
char *strcat(char *dest, const char *src);
char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);
char *strcpy(char *dest, const char *src);
void *memcpy(void *dest, const void *src, size_t n);
2002-08-18 17:25:12 +04:00
void *memmove(void *dest, const void *src, size_t n);
2001-11-06 04:20:38 +03:00
void *memset(void *s, int c, size_t n);
char *strdup(const char *s);
size_t strlen(const char *s);
2001-11-11 05:54:21 +03:00
/* dlfcn.h */
2001-11-11 21:01:29 +03:00
#define RTLD_LAZY 0x001
#define RTLD_NOW 0x002
#define RTLD_GLOBAL 0x100
2001-11-11 05:54:21 +03:00
void *dlopen(const char *filename, int flag);
const char *dlerror(void);
void *dlsym(void *handle, char *symbol);
int dlclose(void *handle);
2002-08-18 17:25:12 +04:00
#endif /* _TCCLIB_H */