4 * Ullrich von bassewitz, 17.06.1997
15 static unsigned char amode_to_bmode (const char* mode)
16 /* Convert ASCII mode (like for fopen) to binary mode (for open) */
20 unsigned char binmode = 0;
31 binmode = O_WRONLY | O_APPEND;
34 return 0; /* invalid char */
40 binmode = (binmode & ~15) | O_RDWR;
43 /* currently ignored */
46 return 0; /* invalid char */
54 FILE* _fopen (const char* name, const char* mode, FILE* f)
55 /* Open the specified file and fill the descriptor values into f */
58 unsigned char binmode;
61 /* Convert ASCII mode to binary mode */
62 if ((binmode = amode_to_bmode (mode)) == 0) {
69 fd = open (name, binmode);
71 /* Error - _oserror is set */
75 /* Remember fd, mark the file as opened */
79 /* Return the file descriptor */