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) */
18 unsigned char binmode;
22 binmode = O_WRONLY | O_CREAT | O_TRUNC;
28 binmode = O_WRONLY | O_CREAT | O_APPEND;
31 return 0; /* invalid char */
37 /* always to r/w in addition to anything already set */
41 /* currently ignored */
44 /* end of mode string reached */
47 /* invalid char in mode string */
55 FILE* _fopen (const char* name, const char* mode, FILE* f)
56 /* Open the specified file and fill the descriptor values into f */
59 unsigned char binmode;
62 /* Convert ASCII mode to binary mode */
63 if ((binmode = amode_to_bmode (mode)) == 0) {
70 fd = open (name, binmode);
72 /* Error - _oserror is set */
76 /* Remember fd, mark the file as opened */
80 /* Return the file descriptor */