aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/std.h
blob: 0a40232dcd35c64a6b2cc716f72055d000f5ebe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef DUCC_STD_H
#define DUCC_STD_H

#include <stddef.h>

typedef struct FILE FILE;

extern FILE* stdin;
extern FILE* stdout;
extern FILE* stderr;

int atoi(const char*);
void* calloc(size_t, size_t);
void exit(int);
int fclose(FILE*);
int fprintf(FILE*, const char*, ...);
char* fgets(char*, int, FILE*);
FILE* fopen(const char*, const char*);
int getchar(void);
int isalnum(int);
int isalpha(int);
int isdigit(int);
int isspace(int);
void* memcpy(void*, const void*, size_t);
void* memmove(void*, const void*, size_t);
void* memset(void*, int, size_t);
int mkstemps(char*, int);
int printf(const char*, ...);
void* realloc(void*, size_t);
int sprintf(char*, const char*, ...);
int strcmp(const char*, const char*);
size_t strlen(const char*);
int strncmp(const char*, const char*, size_t);
char* strdup(const char*);
char* strndup(const char*, size_t);
char* strstr(const char*, const char*);
char* strrchr(const char*, int);
long strtol(const char*, char**, int);
int system(const char*);

#define assert(x) \
    do { \
        if (!(x)) { \
            fatal_error("%s:%d: assertion failed", __FILE__, __LINE__); \
        } \
    } while (0)

#include <stdarg.h>

int vfprintf(FILE*, const char*, va_list);

#define F_OK 0
#define R_OK 4
int access(const char*, int);

#define PATH_MAX 4096

typedef long ssize_t;
ssize_t readlink(const char*, char*, size_t);
char* dirname(char*);

#define BOOL int
#define TRUE 1
#define FALSE 0

#endif