source: trunk/sys/dietlibc/fdglue.c @ 254

Last change on this file since 254 was 1, checked in by alain, 8 years ago

First import

File size: 489 bytes
RevLine 
[1]1#include <unistd.h>
2#include <fcntl.h>
3#include <errno.h>
4#include <stdlib.h>
5#ifdef WANT_THREAD_SAFE
6#include <pthread.h>
7#endif
8#include "dietstdio.h"
9
10int __stdio_parse_mode(const char *mode) {
11  int f=0;
12  for (;;) {
13    switch (*mode) {
14    case 0: return f;
15    case 'b': break;
16    case 'r': f=O_RDONLY; break;
17    case 'w': f=O_WRONLY|O_CREAT|O_TRUNC; break;
18    case 'a': f=O_WRONLY|O_CREAT|O_APPEND; break;
19    case '+': f=(f&(~O_WRONLY))|O_RDWR; break;
20    }
21    ++mode;
22  }
23}
24
Note: See TracBrowser for help on using the repository browser.