LibC: add stubs for a lot of functions
This commit is contained in:
@@ -1,13 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#define stdin stdin
|
||||
#define stdout stdout
|
||||
#define stderr stderr
|
||||
|
||||
#define SEEK_CUR 0
|
||||
#define SEEK_END 1
|
||||
#define SEEK_SET 2
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int printf(const char* __restrict, ...);
|
||||
struct FILE;
|
||||
typedef struct FILE FILE;
|
||||
|
||||
extern FILE* stdin;
|
||||
extern FILE* stdout;
|
||||
extern FILE* stderr;
|
||||
|
||||
FILE* fopen(const char* __restrict__, const char* __restrict__);
|
||||
int fclose(FILE*);
|
||||
int fflush(FILE*);
|
||||
int fprintf(FILE* __restrict__, const char* __restrict__, ...);
|
||||
int fseek(FILE*, long, int);
|
||||
int printf(const char* __restrict__, ...);
|
||||
int putchar(int);
|
||||
int puts(const char*);
|
||||
int vfprintf(FILE* __restrict__, const char* __restrict__, va_list);
|
||||
long ftell(FILE*);
|
||||
size_t fread(void* __restrict__, size_t, size_t, FILE*);
|
||||
size_t fwrite(void const* __restrict__, size_t, size_t, FILE*);
|
||||
void setbuf(FILE* __restrict__, char* __restrict__);
|
||||
int sprintf(char* __restrict__, const char* __restrict__, ...);
|
||||
|
||||
__END_DECLS
|
||||
__END_DECLS
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
__attribute__((__noreturn__))
|
||||
void abort(void);
|
||||
[[noreturn]] void abort(void);
|
||||
|
||||
int abs(int);
|
||||
|
||||
int atexit(void(*)(void));
|
||||
int atoi(const char*);
|
||||
|
||||
char* getenv(const char*);
|
||||
|
||||
void* malloc(size_t);
|
||||
void* calloc(size_t, size_t);
|
||||
void free(void*);
|
||||
|
||||
__END_DECLS
|
||||
@@ -6,7 +6,7 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
int memcmp(const void*, const void*, size_t);
|
||||
void* memcpy(void* __restrict, const void* __restrict, size_t);
|
||||
void* memcpy(void* __restrict__, const void* __restrict__, size_t);
|
||||
void* memmove(void*, const void*, size_t);
|
||||
void* memset(void*, int, size_t);
|
||||
size_t strlen(const char*);
|
||||
@@ -14,8 +14,12 @@ size_t strlen(const char*);
|
||||
int strcmp(const char*, const char*);
|
||||
int strncmp(const char*, const char*, size_t);
|
||||
|
||||
char* strcpy(char* __restrict, const char* __restrict);
|
||||
char* strncpy(char* __restrict, const char* __restrict, size_t);
|
||||
char* strcpy(char* __restrict__, const char* __restrict__);
|
||||
char* strncpy(char* __restrict__, const char* __restrict__, size_t);
|
||||
|
||||
char* strcat(char* __restrict__, const char* __restrict__);
|
||||
|
||||
char* strchr(const char*, int);
|
||||
|
||||
char* strstr(const char*, const char*);
|
||||
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
// fork(), execv(), execve(), execvp(), getpid()
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
pid_t fork(void);
|
||||
|
||||
int execv(const char*, char* const[]);
|
||||
int execve(const char*, char* const[], char* const[]);
|
||||
int execvp(const char*, char* const[]);
|
||||
|
||||
pid_t getpid(void);
|
||||
|
||||
__END_DECLS
|
||||
Reference in New Issue
Block a user