stdio.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * stdio.h
  3. *
  4. * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _STDIO_H_
  20. #define _STDIO_H_
  21. #include <stdlib.h>
  22. #include <stdarg.h>
  23. #define EOF -1
  24. #define getc(s) fgetc(s)
  25. #define getchar() fgetc(stdin)
  26. #define putc(c, s) fputc(c, s)
  27. #define putchar(c) fputc(c, stdout)
  28. #define getc_unlocked(s) fgetc_unlocked(s)
  29. #define getchar_unlocked() fgetc_unlocked(stdin)
  30. #define putc_unlocked(c, s) fputc_unlocked(c, s)
  31. #define putchar_unlocked(c) fputc(c, stdout)
  32. struct __crt_file;
  33. typedef struct __crt_file FILE;
  34. extern FILE *stdin;
  35. extern FILE *stdout;
  36. extern FILE *stderr;
  37. int fgetc(FILE *stream);
  38. int fputc(int c, FILE *stream);
  39. char *fgets(char *s, int size, FILE *stream);
  40. int fputs(const char *s, FILE *stream);
  41. int ungetc(int c, FILE *stream);
  42. char *gets(char *s);
  43. int puts(const char *s);
  44. int fgetc_unlocked(FILE *stream);
  45. int fputc_unlocked(int c, FILE *stream);
  46. char *fgets_unlocked(char *s, int size, FILE *stream);
  47. int fputs_unlocked(const char *s, FILE *stream);
  48. FILE *fopen(const char *pathname, const char *mode);
  49. FILE *fdopen(int fd, const char *mode);
  50. FILE *fmemopen(void *buf, size_t size, const char *mode);
  51. int fclose(FILE *stream);
  52. #define BUFSIZ 4096
  53. #define _IOFBF 0
  54. #define _IOLBF 1
  55. #define _IONBF 2
  56. int setvbuf(FILE *stream, char *buf, int mode, size_t size);
  57. void setbuf(FILE *stream, char *buf);
  58. void setbuffer(FILE *stream, char *buf, size_t size);
  59. void setlinebuf(FILE *stream);
  60. int printf(const char *format, ...);
  61. int fprintf(FILE *stream, const char *format, ...);
  62. int dprintf(int fd, const char *format, ...);
  63. int sprintf(char *str, const char *format, ...);
  64. int snprintf(char *str, size_t size, const char *format, ...);
  65. int vprintf(const char *format, va_list ap);
  66. int vfprintf(FILE *stream, const char *format, va_list ap);
  67. int vdprintf(int fd, const char *format, va_list ap);
  68. int vsprintf(char *str, const char *format, va_list ap);
  69. int vsnprintf(char *str, size_t size, const char *format, va_list ap);
  70. #endif