stdio.h (2926B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2016,2017,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 4 * 5 * This file is part of GNU Mes. 6 * 7 * GNU Mes is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or (at 10 * your option) any later version. 11 * 12 * GNU Mes is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #ifndef __MES_STDIO_H 21 #define __MES_STDIO_H 1 22 23 #include <mes/lib.h> 24 25 #if SYSTEM_LIBC 26 #ifndef _GNU_SOURCE 27 #define _GNU_SOURCE 28 #endif 29 #undef __MES_STDIO_H 30 #include_next <stdio.h> 31 32 #else // ! SYSTEM_LIBC 33 34 #ifndef _IOFBF 35 #define _IOFBF 0 /* Fully buffered. */ 36 #define _IOLBF 1 /* Line buffered. */ 37 #define _IONBF 2 /* No buffering. */ 38 #endif 39 40 #ifndef BUFSIZ 41 #define BUFSIZ 256 42 #endif 43 44 #ifndef L_tmpnam 45 #define L_tmpnam 100 46 #endif 47 48 #include <sys/types.h> 49 50 #define stdin (FILE*)0 51 #define stdout (FILE*)1 52 #define stderr (FILE*)2 53 54 #define SEEK_SET 0 55 #define SEEK_CUR 1 56 #define SEEK_END 2 57 58 FILE *fdopen (int fd, char const *mode); 59 FILE *fopen (char const *file_name, char const *mode); 60 int eputc (int c); 61 int eputs (char const *s); 62 int fclose (FILE * stream); 63 int feof (FILE * stream); 64 int ferror (FILE * stream); 65 int fflush (FILE * stream); 66 int fgetc (FILE * stream); 67 char *fgets (char *s, int size, FILE * stream); 68 int fpurge (FILE * stream); 69 int fputc (int c, FILE * stream); 70 int fputs (char const *s, FILE * stream); 71 int fseek (FILE * stream, long offset, int whence); 72 int getc (FILE * stream); 73 int getchar (void); 74 char *getlogin (void); 75 int putc (int c, FILE * stream); 76 int putchar (int c); 77 int puts (char const *s); 78 int remove (char const *file_name); 79 int rename (char const *old_name, char const *new_name); 80 int setvbuf (FILE * stream, char *buf, int mode, size_t size); 81 int ungetc (int c, FILE * stream); 82 long ftell (FILE * stream); 83 size_t fread (void *ptr, size_t size, size_t count, FILE * stream); 84 size_t freadahead (FILE * fp); 85 size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream); 86 void perror (char const *message); 87 88 #if !__M2__ 89 int fprintf (FILE * stream, char const *format, ...); 90 int fscanf (FILE * stream, char const *template, ...); 91 int printf (char const *format, ...); 92 int snprintf (char *str, size_t size, char const *format, ...); 93 int sprintf (char *str, char const *format, ...); 94 int sscanf (char const *str, char const *format, ...); 95 #endif // !__M2__ 96 97 #endif // ! SYSTEM_LIBC 98 99 #endif // __MES_STDIO_H