printf.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Header file for printf type functions.
  3. * Copyright (C) 2006, 2007 Free Software Foundation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. /*
  20. * String handling functions.
  21. *
  22. */
  23. #ifndef _MACH_SA_SYS_PRINTF_H_
  24. #define _MACH_SA_SYS_PRINTF_H_
  25. #include <sys/types.h>
  26. #include <stdarg.h>
  27. extern void _doprnt (const char *fmt,
  28. va_list argp,
  29. void (*putc)(char, vm_offset_t),
  30. int radix,
  31. vm_offset_t putc_arg);
  32. extern void printnum (unsigned long long u, int base,
  33. void (*putc)(char, vm_offset_t),
  34. vm_offset_t putc_arg);
  35. extern int sprintf (char *buf, const char *fmt, ...)
  36. __attribute__ ((format (printf, 2, 3)));
  37. extern int snprintf (char *buf, size_t size, const char *fmt, ...)
  38. __attribute__ ((format (printf, 3, 4)));
  39. extern int vsnprintf (char *buf, size_t size, const char *fmt, va_list args)
  40. __attribute__ ((format (printf, 3, 0)));
  41. extern int printf (const char *fmt, ...)
  42. __attribute__ ((format (printf, 1, 2)));
  43. #define printf_once(fmt, ...) \
  44. MACRO_BEGIN \
  45. static int __once = 0; \
  46. if (!__once) { \
  47. printf(fmt, ##__VA_ARGS__); \
  48. __once = 1; \
  49. } \
  50. MACRO_END
  51. extern int indent;
  52. extern void iprintf (const char *fmt, ...);
  53. extern int vprintf(const char *fmt, va_list listp);
  54. extern void safe_gets (char *str, int maxlen);
  55. #include <linux/printk.h>
  56. #define printf printk
  57. #endif /* _MACH_SA_SYS_PRINTF_H_ */