29 lines
822 B
C++
29 lines
822 B
C++
#ifndef _H_CX_LIBC
|
|
#define _H_CX_LIBC
|
|
#include <cx/stddef.hpp>
|
|
|
|
typedef void FILE;
|
|
|
|
#define stdin 0
|
|
#define stdout 1
|
|
#define stderr 2
|
|
|
|
namespace libc {
|
|
extern "C" {
|
|
void* malloc(size_t size);
|
|
void* realloc(void* ptr, size_t size);
|
|
void free(void* ptr);
|
|
int snprintf(char* __restrict s, size_t maxlen, const char* __restrict format, ...);
|
|
int putchar(int c);
|
|
int puts(const char* s);
|
|
char* getenv(const char* name);
|
|
ssize_t write(int fd, const void* buf, size_t n);
|
|
ssize_t read(int fd, void* buf, size_t nbytes);
|
|
// returns buf on success, and NULL on error or when end of file occurs while no characters have been read.
|
|
char* fgets(char* buf, int size, FILE* stream);
|
|
int feof(FILE* stream);
|
|
int fflush(FILE* stream);
|
|
}
|
|
} // namespace libc
|
|
|
|
#endif // _H_CX_LIBC
|