stdio.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #define _STDIO_H // Make GMP believe we exist.
  8. #include <bits/FILE.h>
  9. #include <limits.h>
  10. #include <stdarg.h>
  11. #include <sys/cdefs.h>
  12. #include <sys/types.h>
  13. #define FILENAME_MAX 1024
  14. __BEGIN_DECLS
  15. #ifndef EOF
  16. # define EOF (-1)
  17. #endif
  18. #define SEEK_SET 0
  19. #define SEEK_CUR 1
  20. #define SEEK_END 2
  21. #define _IOFBF 0
  22. #define _IOLBF 1
  23. #define _IONBF 2
  24. #define L_tmpnam 256
  25. extern FILE* stdin;
  26. extern FILE* stdout;
  27. extern FILE* stderr;
  28. typedef off_t fpos_t;
  29. int fseek(FILE*, long offset, int whence);
  30. int fseeko(FILE*, off_t offset, int whence);
  31. int fgetpos(FILE*, fpos_t*);
  32. int fsetpos(FILE*, const fpos_t*);
  33. long ftell(FILE*);
  34. off_t ftello(FILE*);
  35. char* fgets(char* buffer, int size, FILE*);
  36. int fputc(int ch, FILE*);
  37. int fileno(FILE*);
  38. int fgetc(FILE*);
  39. int fgetc_unlocked(FILE*);
  40. int getc(FILE*);
  41. int getc_unlocked(FILE* stream);
  42. int getchar();
  43. ssize_t getdelim(char**, size_t*, int, FILE*);
  44. ssize_t getline(char**, size_t*, FILE*);
  45. int ungetc(int c, FILE*);
  46. int remove(const char* pathname);
  47. FILE* fdopen(int fd, const char* mode);
  48. FILE* fopen(const char* pathname, const char* mode);
  49. FILE* freopen(const char* pathname, const char* mode, FILE*);
  50. void flockfile(FILE* filehandle);
  51. void funlockfile(FILE* filehandle);
  52. int fclose(FILE*);
  53. void rewind(FILE*);
  54. void clearerr(FILE*);
  55. int ferror(FILE*);
  56. int feof(FILE*);
  57. int fflush(FILE*);
  58. size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
  59. size_t fread_unlocked(void* ptr, size_t size, size_t nmemb, FILE*);
  60. size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*);
  61. int vprintf(const char* fmt, va_list) __attribute__((format(printf, 1, 0)));
  62. int vfprintf(FILE*, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
  63. int vasprintf(char** strp, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
  64. int vsprintf(char* buffer, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
  65. int vsnprintf(char* buffer, size_t, const char* fmt, va_list) __attribute__((format(printf, 3, 0)));
  66. int fprintf(FILE*, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
  67. int printf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
  68. void dbgputch(char);
  69. void dbgputstr(const char*, size_t);
  70. int sprintf(char* buffer, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
  71. int asprintf(char** strp, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
  72. int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
  73. int putchar(int ch);
  74. int putc(int ch, FILE*);
  75. int puts(const char*);
  76. int fputs(const char*, FILE*);
  77. void perror(const char*);
  78. int scanf(const char* fmt, ...) __attribute__((format(scanf, 1, 2)));
  79. int sscanf(const char* str, const char* fmt, ...) __attribute__((format(scanf, 2, 3)));
  80. int fscanf(FILE*, const char* fmt, ...) __attribute__((format(scanf, 2, 3)));
  81. int vfscanf(FILE*, const char*, va_list) __attribute__((format(scanf, 2, 0)));
  82. int vsscanf(const char*, const char*, va_list) __attribute__((format(scanf, 2, 0)));
  83. int setvbuf(FILE*, char* buf, int mode, size_t);
  84. void setbuf(FILE*, char* buf);
  85. void setlinebuf(FILE*);
  86. int rename(const char* oldpath, const char* newpath);
  87. FILE* tmpfile();
  88. char* tmpnam(char*);
  89. FILE* popen(const char* command, const char* type);
  90. int pclose(FILE*);
  91. __END_DECLS