summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libstdio/fopen.c
blob: 3d9c281987bb33d7dd9959fdd9ff79daab795407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <sys/types.h>
#include <dietstdio.h>
#include <unistd.h>

extern int __stdio_atexit;

FILE *fopen (const char *path, const char *mode) {
  int f=0;	/* O_RDONLY, O_WRONLY or O_RDWR */
  int fd;

  f=__stdio_parse_mode(mode);
  if ((fd=open(path,f,0666))<0)
    return 0;
  return __stdio_init_file(fd,1);
}