1 #ifndef STDLIB_H
2 #define STDLIB_H
3
4
5
6
7
8
9
10
11 extern int rand(void);
12 extern void* srand(unsigned int seed);
13
14 extern void qsort(void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
15
16 extern long sprintf(char *s, const char *st, ...);
17
18 extern long strtol(const char *nptr, char **endptr, int base);
19 extern unsigned long strtoul(const char *nptr, char **endptr, int base);
20 #define atoi(n) strtol((n),NULL,0)
21
22 extern void *malloc(long size);
23 extern void free(void *p);
24
25 extern int open(const char *name, int flags, int mode );
26 extern int close(int fd);
27 extern int write(int fd, const void *buffer, long nbytes);
28 extern int read(int fd, void *buffer, long nbytes);
29 extern int lseek(int fd, long offset, int whence);
30 extern int rename(const char *oldname, const char *newname);
31 extern int chdir(char *pathname);
32 extern int remove(const char *name);
33
34 extern int abs( int v );
35
36
37
38
39
40
41
42
43 struct stat
44 {
45 unsigned long st_attrib;
46 unsigned long st_size;
47 unsigned long st_ctime;
48 unsigned long st_mtime;
49 };
50
51 extern long mkdir(const char *dirname);
52 extern int stat(const char *name, struct stat *pStat);
53
54
55
56
57
58 #define O_RDONLY 0
59 #define O_WRONLY 1
60 #define O_RDWR 2
61 #define O_APPEND 8
62
63
64
65 #define O_TRUNC 0x200
66 #define O_CREAT 0x100
67
68
69
70
71
72 #define DOS_ATTR_RDONLY 0x01
73 #define DOS_ATTR_HIDDEN 0x02
74 #define DOS_ATTR_SYSTEM 0x04
75 #define DOS_ATTR_VOL_LABEL 0x08
76 #define DOS_ATTR_DIRECTORY 0x10
77 #define DOS_ATTR_ARCHIVE 0x20
78
79
80
81
82
83 extern void msleep(long msec);
84
85 extern unsigned char SetFileAttributes(const char* fn, unsigned char attr);
86
87 extern long mkdir_if_not_exist(const char *dirname);
88
89 extern void *umalloc(long size);
90 extern void ufree(void *p);
91
92
93
94 #endif