2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
9 #include "__arosc_privdata.h"
17 #include <exec/lists.h>
19 #include <proto/exec.h>
20 #include <proto/dos.h>
21 #include <aros/symbolsets.h>
22 #include <aros/debug.h>
25 int __smode2oflags(const char *mode
)
37 ret
= O_WRONLY
| O_CREAT
| O_TRUNC
;
41 ret
= O_WRONLY
| O_CREAT
| O_APPEND
;
54 else if (*mode
== 't')
56 // Silently ignore 't' (=text).
57 // It's deprecated, but it's still in some sources,
58 // and on other platforms they can compiled without problems.
64 ret
= O_RDWR
| (ret
& ~O_ACCMODE
);
68 if (*mode
== 'b' && !theresb
)
82 int __oflags2sflags(int omode
)
86 switch (omode
& O_ACCMODE
)
97 ret
= _STDIO_READ
| _STDIO_WRITE
;
105 if (omode
& O_APPEND
)
106 ret
|= _STDIO_APPEND
;
111 int __init_stdio(struct aroscbase
*aroscbase
)
113 NEWLIST(&aroscbase
->acb_stdio_files
);
117 !(stdin
= fdopen(STDIN_FILENO
, NULL
)) ||
118 !(stdout
= fdopen(STDOUT_FILENO
, NULL
)) ||
119 !(stderr
= fdopen(STDERR_FILENO
, NULL
))
122 SetIoErr(ERROR_NO_FREE_STORE
);
129 ADD2OPENLIB(__init_stdio
, 5);