2018-05-29 17:15:22 +01:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
2018-07-22 13:24:36 +01:00
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
2019-06-08 14:36:22 +01:00
|
|
|
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2018-05-29 17:15:22 +01:00
|
|
|
*
|
2018-07-22 13:24:36 +01:00
|
|
|
* This file is part of GNU Mes.
|
2018-05-29 17:15:22 +01:00
|
|
|
*
|
2018-07-22 13:24:36 +01:00
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
2018-05-29 17:15:22 +01:00
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
2018-07-22 13:24:36 +01:00
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
2018-05-29 17:15:22 +01:00
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-22 13:24:36 +01:00
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
2018-05-29 17:15:22 +01:00
|
|
|
*/
|
|
|
|
|
2019-05-07 23:25:41 +01:00
|
|
|
#include <mes/lib.h>
|
2018-06-26 05:19:51 +01:00
|
|
|
#include <stdlib.h>
|
2018-06-16 19:51:16 +01:00
|
|
|
|
2019-05-29 15:15:12 +01:00
|
|
|
#if SYSTEM_LIBC
|
2019-03-23 20:44:00 +00:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdarg.h>
|
2019-02-15 08:28:46 +00:00
|
|
|
// The Mes C Library defines and initializes these in crt1
|
2019-03-02 11:35:18 +00:00
|
|
|
int __stdin = STDIN;
|
|
|
|
int __stdout = STDOUT;
|
|
|
|
int __stderr = STDERR;
|
|
|
|
|
|
|
|
int
|
2019-05-12 23:40:33 +01:00
|
|
|
mes_open (char const *file_name, int flags, int mask)
|
2019-03-02 11:35:18 +00:00
|
|
|
{
|
2019-06-08 14:36:22 +01:00
|
|
|
int filedes = open (file_name, flags, mask);
|
|
|
|
if (filedes > 2)
|
|
|
|
__ungetc_clear (filedes);
|
|
|
|
return filedes;
|
2019-05-18 12:27:42 +01:00
|
|
|
}
|
2019-03-02 11:35:18 +00:00
|
|
|
|
2019-05-29 15:15:12 +01:00
|
|
|
#else // !SYSTEM_LIBC
|
2019-05-12 23:40:33 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
mes_open (char const *file_name, int flags, int mask)
|
|
|
|
{
|
|
|
|
return _open3 (file_name, flags, mask);
|
|
|
|
}
|
|
|
|
|
2019-05-29 15:15:12 +01:00
|
|
|
#endif // !SYSTEM_LIBC
|