stdio.h 417 B

12345678910111213141516171819202122
  1. #ifndef _OVERRIDE_STDIO_H_
  2. #define _OVERRIDE_STDIO_H_
  3. #include_next "stdio.h"
  4. #ifdef __BUFSIZ__
  5. # define BUFSIZ __BUFSIZ__
  6. #else
  7. # define BUFSIZ 1024
  8. #endif
  9. extern void output_redirect(const char *str, size_t l);
  10. #define puts(s) output_redirect((s), strlen(s))
  11. #define printf(...) do { \
  12. char __printf_buf[BUFSIZ]; \
  13. snprintf(__printf_buf, BUFSIZ, __VA_ARGS__); \
  14. puts(__printf_buf); \
  15. } while(0)
  16. #endif