You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _IPXE_EFI_STRINGS_H
  2. #define _IPXE_EFI_STRINGS_H
  3. /** @file
  4. *
  5. * EFI strings
  6. */
  7. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  8. #include <stddef.h>
  9. #include <stdint.h>
  10. #include <stdarg.h>
  11. extern int efi_vsnprintf ( wchar_t *wbuf, size_t wsize, const char *fmt,
  12. va_list args );
  13. extern int efi_snprintf ( wchar_t *wbuf, size_t wsize, const char *fmt, ... );
  14. extern int efi_vssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt,
  15. va_list args );
  16. extern int efi_ssnprintf ( wchar_t *wbuf, ssize_t swsize,
  17. const char *fmt, ... );
  18. /**
  19. * Write a formatted string to a wide-character buffer
  20. *
  21. * @v wbuf Buffer into which to write the string
  22. * @v fmt Format string
  23. * @v args Arguments corresponding to the format string
  24. * @ret wlen Length of formatted string (in wide characters)
  25. */
  26. static inline int efi_vsprintf ( wchar_t *buf, const char *fmt, va_list args ) {
  27. return efi_vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
  28. }
  29. /**
  30. * Write a formatted string to a buffer
  31. *
  32. * @v wbuf Buffer into which to write the string
  33. * @v fmt Format string
  34. * @v ... Arguments corresponding to the format string
  35. * @ret wlen Length of formatted string (in wide characters)
  36. */
  37. #define efi_sprintf( buf, fmt, ... ) \
  38. efi_snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
  39. #endif /* _IPXE_EFI_STRINGS_H */