stdio.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 2016,2017 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. #include <mes/lib.h>
  23. #if SYSTEM_LIBC
  24. #ifndef _GNU_SOURCE
  25. #define _GNU_SOURCE
  26. #endif
  27. #undef __MES_STDIO_H
  28. #include_next <stdio.h>
  29. #else // ! SYSTEM_LIBC
  30. #ifndef _IOFBF
  31. #define _IOFBF 0 /* Fully buffered. */
  32. #define _IOLBF 1 /* Line buffered. */
  33. #define _IONBF 2 /* No buffering. */
  34. #endif
  35. #ifndef BUFSIZ
  36. #define BUFSIZ 256
  37. #endif
  38. #ifndef L_tmpnam
  39. #define L_tmpnam 100
  40. #endif
  41. #include <sys/types.h>
  42. #define stdin (FILE*)0
  43. #define stdout (FILE*)1
  44. #define stderr (FILE*)2
  45. #define SEEK_SET 0
  46. #define SEEK_CUR 1
  47. #define SEEK_END 2
  48. FILE *fdopen (int fd, char const *mode);
  49. FILE *fopen (char const *file_name, char const *mode);
  50. int eputc (int c);
  51. int eputs (char const *s);
  52. int fclose (FILE * stream);
  53. int feof (FILE * stream);
  54. int ferror (FILE * stream);
  55. int fflush (FILE * stream);
  56. int fgetc (FILE * stream);
  57. char *fgets (char *s, int size, FILE * stream);
  58. int fprintf (FILE * stream, char const *format, ...);
  59. int fpurge (FILE * stream);
  60. int fputc (int c, FILE * stream);
  61. int fputs (char const *s, FILE * stream);
  62. int fscanf (FILE * stream, char const *template, ...);
  63. int fseek (FILE * stream, long offset, int whence);
  64. int getc (FILE * stream);
  65. int getchar (void);
  66. char *getlogin (void);
  67. int printf (char const *format, ...);
  68. int putc (int c, FILE * stream);
  69. int putchar (int c);
  70. int puts (char const *s);
  71. int remove (char const *file_name);
  72. int setvbuf (FILE * stream, char *buf, int mode, size_t size);
  73. int snprintf (char *str, size_t size, char const *format, ...);
  74. int sprintf (char *str, char const *format, ...);
  75. int sscanf (char const *str, char const *format, ...);
  76. int ungetc (int c, FILE * stream);
  77. long ftell (FILE * stream);
  78. size_t fread (void *ptr, size_t size, size_t count, FILE * stream);
  79. size_t freadahead (FILE * fp);
  80. size_t fwrite (void const *ptr, size_t size, size_t count, FILE * stream);
  81. #endif // ! SYSTEM_LIBC
  82. #endif // __MES_STDIO_H