stdio.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  19. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #pragma once
  27. #define _STDIO_H // Make GMP believe we exist.
  28. #include <limits.h>
  29. #include <stdarg.h>
  30. #include <bits/FILE.h>
  31. #include <sys/cdefs.h>
  32. #include <sys/types.h>
  33. #define FILENAME_MAX 1024
  34. __BEGIN_DECLS
  35. #ifndef EOF
  36. # define EOF (-1)
  37. #endif
  38. #define SEEK_SET 0
  39. #define SEEK_CUR 1
  40. #define SEEK_END 2
  41. #define _IOFBF 0
  42. #define _IOLBF 1
  43. #define _IONBF 2
  44. #define L_tmpnam 256
  45. extern FILE* stdin;
  46. extern FILE* stdout;
  47. extern FILE* stderr;
  48. typedef long fpos_t;
  49. int fseek(FILE*, long offset, int whence);
  50. int fgetpos(FILE*, fpos_t*);
  51. int fsetpos(FILE*, const fpos_t*);
  52. long ftell(FILE*);
  53. char* fgets(char* buffer, int size, FILE*);
  54. int fputc(int ch, FILE*);
  55. int fileno(FILE*);
  56. int fgetc(FILE*);
  57. int getc(FILE*);
  58. int getc_unlocked(FILE* stream);
  59. int getchar();
  60. ssize_t getdelim(char**, size_t*, int, FILE*);
  61. ssize_t getline(char**, size_t*, FILE*);
  62. int ungetc(int c, FILE*);
  63. int remove(const char* pathname);
  64. FILE* fdopen(int fd, const char* mode);
  65. FILE* fopen(const char* pathname, const char* mode);
  66. FILE* freopen(const char* pathname, const char* mode, FILE*);
  67. void flockfile(FILE* filehandle);
  68. void funlockfile(FILE* filehandle);
  69. int fclose(FILE*);
  70. void rewind(FILE*);
  71. void clearerr(FILE*);
  72. int ferror(FILE*);
  73. int feof(FILE*);
  74. int fflush(FILE*);
  75. size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
  76. size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*);
  77. int vprintf(const char* fmt, va_list);
  78. int vfprintf(FILE*, const char* fmt, va_list);
  79. int vsprintf(char* buffer, const char* fmt, va_list);
  80. int vsnprintf(char* buffer, size_t, const char* fmt, va_list);
  81. int fprintf(FILE*, const char* fmt, ...);
  82. int printf(const char* fmt, ...);
  83. int dbgprintf(const char* fmt, ...);
  84. void dbgputch(char);
  85. ssize_t dbgputstr(const char*, ssize_t);
  86. int sprintf(char* buffer, const char* fmt, ...);
  87. int snprintf(char* buffer, size_t, const char* fmt, ...);
  88. int putchar(int ch);
  89. int putc(int ch, FILE*);
  90. int puts(const char*);
  91. int fputs(const char*, FILE*);
  92. void perror(const char*);
  93. int scanf(const char* fmt, ...);
  94. int sscanf(const char* str, const char* fmt, ...);
  95. int fscanf(FILE*, const char* fmt, ...);
  96. int vfscanf(FILE*, const char*, va_list);
  97. int vsscanf(const char*, const char*, va_list);
  98. int setvbuf(FILE*, char* buf, int mode, size_t);
  99. void setbuf(FILE*, char* buf);
  100. void setlinebuf(FILE*);
  101. int rename(const char* oldpath, const char* newpath);
  102. FILE* tmpfile();
  103. char* tmpnam(char*);
  104. FILE* popen(const char* command, const char* type);
  105. int pclose(FILE*);
  106. __END_DECLS