stdio.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __STDIO_H
  2. #define __STDIO_H
  3. #include <stdarg.h>
  4. #include <linux/compiler.h>
  5. /* stdin */
  6. int getc(void);
  7. int tstc(void);
  8. /* stdout */
  9. #if !defined(CONFIG_SPL_BUILD) || \
  10. (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \
  11. (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
  12. defined(CONFIG_SPL_SERIAL_SUPPORT))
  13. void putc(const char c);
  14. void puts(const char *s);
  15. int __printf(1, 2) printf(const char *fmt, ...);
  16. int vprintf(const char *fmt, va_list args);
  17. #else
  18. static inline void putc(const char c)
  19. {
  20. }
  21. static inline void puts(const char *s)
  22. {
  23. }
  24. static inline int __printf(1, 2) printf(const char *fmt, ...)
  25. {
  26. return 0;
  27. }
  28. static inline int vprintf(const char *fmt, va_list args)
  29. {
  30. return 0;
  31. }
  32. #endif
  33. /*
  34. * FILE based functions (can only be used AFTER relocation!)
  35. */
  36. #define stdin 0
  37. #define stdout 1
  38. #define stderr 2
  39. #define MAX_FILES 3
  40. /* stderr */
  41. #define eputc(c) fputc(stderr, c)
  42. #define eputs(s) fputs(stderr, s)
  43. #define eprintf(fmt, args...) fprintf(stderr, fmt, ##args)
  44. int __printf(2, 3) fprintf(int file, const char *fmt, ...);
  45. void fputs(int file, const char *s);
  46. void fputc(int file, const char c);
  47. int ftstc(int file);
  48. int fgetc(int file);
  49. #endif /* __STDIO_H */