stdio.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Minimal stdio for ring-3 commands.
  2. *
  3. * The file layer is read-only and whole-file for now; see libc/stdio_file.c
  4. * for the fd-layer TODO. stdout/stderr are console streams.
  5. */
  6. #ifndef LIBC_STDIO_H
  7. #define LIBC_STDIO_H
  8. #include <stddef.h>
  9. #include <stdarg.h>
  10. typedef struct __libc_file FILE;
  11. extern FILE *stdin;
  12. extern FILE *stdout;
  13. extern FILE *stderr;
  14. #define EOF (-1)
  15. #define SEEK_SET 0
  16. #define SEEK_CUR 1
  17. #define SEEK_END 2
  18. #define _IOFBF 0
  19. #define _IOLBF 1
  20. #define _IONBF 2
  21. int printf(const char *format, ...);
  22. int vprintf(const char *format, va_list ap);
  23. int fprintf(FILE *stream, const char *format, ...);
  24. int vfprintf(FILE *stream, const char *format, va_list ap);
  25. int sprintf(char *buf, const char *format, ...);
  26. int snprintf(char *buf, size_t size, const char *format, ...);
  27. int vsprintf(char *buf, const char *format, va_list ap);
  28. int vsnprintf(char *buf, size_t size, const char *format, va_list ap);
  29. int puts(const char *s);
  30. int fputs(const char *s, FILE *stream);
  31. int putchar(int c);
  32. int fputc(int c, FILE *stream);
  33. int fgetc(FILE *stream);
  34. int getchar(void);
  35. char *fgets(char *s, int size, FILE *stream);
  36. FILE *fopen(const char *path, const char *mode);
  37. int fclose(FILE *stream);
  38. size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
  39. size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
  40. int fseek(FILE *stream, long offset, int whence);
  41. long ftell(FILE *stream);
  42. void rewind(FILE *stream);
  43. int fflush(FILE *stream);
  44. int feof(FILE *stream);
  45. int ferror(FILE *stream);
  46. void clearerr(FILE *stream);
  47. int fileno(FILE *stream);
  48. void perror(const char *s);
  49. #endif