mescc: Add fopen.
* lib/libc+tcc.c (fopen)[!POSIX]: Remove stub. * lib/libc.c (fopen)[!POSIX]: New function. * AUTHORS: Add Jeremiah.
This commit is contained in:
parent
d717355b6c
commit
43a74e382a
9
AUTHORS
9
AUTHORS
|
@ -1,6 +1,13 @@
|
||||||
Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
Main author
|
Main author
|
||||||
All files except the files listed below
|
All files except the imported files listed below
|
||||||
|
|
||||||
|
Jeremiah Orians <jeremiah@pdp10.guru>
|
||||||
|
lib/libc.c (fopen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List of imported files
|
||||||
|
|
||||||
Based on Guile ECMAScript
|
Based on Guile ECMAScript
|
||||||
module/language/c/lexer.mes
|
module/language/c/lexer.mes
|
||||||
|
|
|
@ -103,7 +103,7 @@ int eputs (char const* s);
|
||||||
int fclose (FILE *stream);
|
int fclose (FILE *stream);
|
||||||
FILE *fdopen (int fd, char const *mode);
|
FILE *fdopen (int fd, char const *mode);
|
||||||
int fflush (FILE *stream);
|
int fflush (FILE *stream);
|
||||||
FILE *fopen (char const *pathname, char const *mode);
|
FILE *fopen (char const *file_name, char const *mode);
|
||||||
int ferror (FILE *stream);
|
int ferror (FILE *stream);
|
||||||
int fprintf (FILE *stream, char const *format, ...);
|
int fprintf (FILE *stream, char const *format, ...);
|
||||||
int fdputc (int c, int fd);
|
int fdputc (int c, int fd);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* Mes --- Maxwell Equations of Software
|
* Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
*
|
*
|
||||||
* This file is part of Mes.
|
* This file is part of Mes.
|
||||||
*
|
*
|
||||||
|
@ -76,13 +76,6 @@ fflush (FILE *stream)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
|
||||||
fopen (char const *pathname, char const *mode)
|
|
||||||
{
|
|
||||||
eputs ("fopen stub\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fprintf (FILE *stream, char const *format, ...)
|
fprintf (FILE *stream, char const *format, ...)
|
||||||
{
|
{
|
||||||
|
|
21
lib/libc.c
21
lib/libc.c
|
@ -1,6 +1,7 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* Mes --- Maxwell Equations of Software
|
* Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
* Copyright © 2018 Jeremiah Orians <jeremiah@pdp10.guru>
|
||||||
*
|
*
|
||||||
* This file is part of Mes.
|
* This file is part of Mes.
|
||||||
*
|
*
|
||||||
|
@ -174,6 +175,24 @@ eputc (int c)
|
||||||
return fdputc (c, STDERR);
|
return fdputc (c, STDERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FILE*
|
||||||
|
fopen (char const* file_name, char const* mode)
|
||||||
|
{
|
||||||
|
FILE* f;
|
||||||
|
if ('w' == mode[0])
|
||||||
|
/* 577 is O_WRONLY|O_CREAT|O_TRUNC, 384 is 600 in octal */
|
||||||
|
f = open (file_name, 577 , 384);
|
||||||
|
else
|
||||||
|
/* Everything else is a read */
|
||||||
|
f = open (file_name, 0, 0);
|
||||||
|
|
||||||
|
/* Negative numbers are error codes */
|
||||||
|
if (0 > f)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
putchar (int c)
|
putchar (int c)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue