2017-05-02 21:30:46 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
2017-11-21 18:22:26 +00:00
|
|
|
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2017-05-02 21:30:46 +00:00
|
|
|
*
|
|
|
|
* This file is part of Mes.
|
|
|
|
*
|
|
|
|
* Mes is free software; you can redistribute it and/or modify it
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Mes is distributed in the hope that it will be useful, but
|
|
|
|
* 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
|
|
|
|
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-05-23 05:16:08 +00:00
|
|
|
#ifndef __MES_STDIO_H
|
|
|
|
#define __MES_STDIO_H 1
|
2017-05-02 15:00:07 +00:00
|
|
|
|
2018-05-30 19:55:39 +00:00
|
|
|
char **environ;
|
2017-05-02 21:30:46 +00:00
|
|
|
int g_stdin;
|
2017-05-19 04:56:47 +00:00
|
|
|
int g_stdout;
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2017-07-23 18:42:29 +00:00
|
|
|
#ifndef STDIN
|
2017-05-02 21:30:46 +00:00
|
|
|
#define STDIN 0
|
2017-07-23 18:42:29 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef STDOUT
|
2017-05-02 21:30:46 +00:00
|
|
|
#define STDOUT 1
|
2017-07-23 18:42:29 +00:00
|
|
|
#endif
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2017-07-23 18:42:29 +00:00
|
|
|
#ifndef STDERR
|
|
|
|
#define STDERR 2
|
|
|
|
#endif
|
2017-05-02 15:00:07 +00:00
|
|
|
|
2018-06-02 09:41:06 +00:00
|
|
|
#if WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif
|
2017-07-23 13:49:03 +00:00
|
|
|
#undef __MES_STDIO_H
|
2017-05-02 21:30:46 +00:00
|
|
|
#include_next <stdio.h>
|
|
|
|
|
2018-06-02 09:41:06 +00:00
|
|
|
#else // ! WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2018-05-30 19:55:39 +00:00
|
|
|
#ifndef __MESCCLIB__
|
|
|
|
#define __MESCCLIB__ 15
|
|
|
|
#endif
|
|
|
|
|
2017-07-23 18:42:29 +00:00
|
|
|
#ifndef EOF
|
|
|
|
#define EOF -1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
2018-05-30 19:55:39 +00:00
|
|
|
#ifndef BUFSIZ
|
|
|
|
#define BUFSIZ 256
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef L_tmpnam
|
|
|
|
#define L_tmpnam 100
|
|
|
|
#endif
|
|
|
|
|
2018-06-03 16:54:26 +00:00
|
|
|
#if !defined (__MES_FILE_T) && ! defined (_FILE_T)
|
|
|
|
#define __MES_FILE_T
|
|
|
|
#define _FILE_T
|
|
|
|
typedef int FILE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define stdin (FILE*)0
|
|
|
|
#define stdout (FILE*)1
|
|
|
|
#define stderr (FILE*)2
|
2017-05-23 05:16:08 +00:00
|
|
|
|
|
|
|
#define SEEK_SET 0
|
|
|
|
#define SEEK_CUR 1
|
|
|
|
#define SEEK_END 2
|
|
|
|
|
2017-07-24 11:39:34 +00:00
|
|
|
#ifndef __MES_SIZE_T
|
|
|
|
#define __MES_SIZE_T
|
2017-12-05 18:49:37 +00:00
|
|
|
#undef size_t
|
2017-07-24 11:39:34 +00:00
|
|
|
typedef unsigned long size_t;
|
|
|
|
#endif
|
|
|
|
|
2018-05-29 16:15:22 +00:00
|
|
|
FILE *fdopen (int fd, char const *mode);
|
|
|
|
FILE *fopen (char const *file_name, char const *mode);
|
2017-08-06 11:53:56 +00:00
|
|
|
int eputc (int c);
|
2017-05-23 05:16:08 +00:00
|
|
|
int eputs (char const* s);
|
2017-07-24 15:25:53 +00:00
|
|
|
int fclose (FILE *stream);
|
2018-05-30 19:55:39 +00:00
|
|
|
int feof (FILE *stream);
|
2017-11-25 21:57:18 +00:00
|
|
|
int ferror (FILE *stream);
|
2018-05-29 16:15:22 +00:00
|
|
|
int fflush (FILE *stream);
|
|
|
|
int fgetc (FILE* stream);
|
2018-06-03 16:54:26 +00:00
|
|
|
char *fgets (char *s, int size, FILE *stream);
|
2017-07-24 11:39:34 +00:00
|
|
|
int fprintf (FILE *stream, char const *format, ...);
|
2018-05-29 16:15:22 +00:00
|
|
|
int fpurge (FILE *stream);
|
|
|
|
int fputc (int c, FILE *stream);
|
|
|
|
int fputs (char const* s, FILE *stream);
|
2017-07-24 18:11:22 +00:00
|
|
|
int fseek (FILE *stream, long offset, int whence);
|
2018-05-29 16:15:22 +00:00
|
|
|
int getc (FILE *stream);
|
2017-05-23 05:16:08 +00:00
|
|
|
int getchar ();
|
2017-07-24 11:23:15 +00:00
|
|
|
int printf (char const* format, ...);
|
2018-05-29 16:15:22 +00:00
|
|
|
int putc (int c, FILE* stream);
|
2017-07-24 11:23:15 +00:00
|
|
|
int putchar (int c);
|
|
|
|
int puts (char const* s);
|
2017-07-24 18:19:49 +00:00
|
|
|
int remove (char const *file_name);
|
2017-07-24 11:23:15 +00:00
|
|
|
int snprintf(char *str, size_t size, char const *format, ...);
|
|
|
|
int sprintf (char *str, char const* format, ...);
|
2018-05-29 16:15:22 +00:00
|
|
|
int sscanf (char const *str, const char *format, ...);
|
|
|
|
int ungetc (int c, FILE* stream);
|
|
|
|
long ftell (FILE *stream);
|
|
|
|
size_t fread (void *ptr, size_t size, size_t count, FILE *stream);
|
|
|
|
size_t freadahead (FILE *fp);
|
|
|
|
size_t fwrite (void const *ptr, size_t size, size_t count, FILE *stream);
|
2017-05-23 05:16:08 +00:00
|
|
|
|
2018-06-02 09:41:06 +00:00
|
|
|
#endif // ! WITH_GLIBC
|
2017-05-02 21:30:46 +00:00
|
|
|
|
2017-05-23 05:16:08 +00:00
|
|
|
#endif // __MES_STDIO_H
|