9 /* This depends on O_RDONLY == 0, O_WRONLY == 1, O_RDWR == 2 */
12 FILE *fopen(const char *file, const char *mode)
24 flags = O_WRONLY|O_CREAT|O_TRUNC;
27 flags = O_WRONLY|O_CREAT|O_APPEND;
37 flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR;
40 fd = open(file, flags, 0666);
45 return fdopen(fd, mode);