iPXE
efi_strings.h
Go to the documentation of this file.
00001 #ifndef _IPXE_EFI_STRINGS_H
00002 #define _IPXE_EFI_STRINGS_H
00003 
00004 /** @file
00005  *
00006  * EFI strings
00007  */
00008 
00009 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00010 
00011 #include <stddef.h>
00012 #include <stdint.h>
00013 #include <stdarg.h>
00014 
00015 extern int efi_vsnprintf ( wchar_t *wbuf, size_t wsize, const char *fmt,
00016                            va_list args );
00017 extern int efi_snprintf ( wchar_t *wbuf, size_t wsize, const char *fmt, ... );
00018 extern int efi_vssnprintf ( wchar_t *wbuf, ssize_t swsize, const char *fmt,
00019                             va_list args );
00020 extern int efi_ssnprintf ( wchar_t *wbuf, ssize_t swsize,
00021                            const char *fmt, ... );
00022 
00023 /**
00024  * Write a formatted string to a wide-character buffer
00025  *
00026  * @v wbuf              Buffer into which to write the string
00027  * @v fmt               Format string
00028  * @v args              Arguments corresponding to the format string
00029  * @ret wlen            Length of formatted string (in wide characters)
00030  */
00031 static inline int efi_vsprintf ( wchar_t *buf, const char *fmt, va_list args ) {
00032         return efi_vsnprintf ( buf, ~( ( size_t ) 0 ), fmt, args );
00033 }
00034 
00035 /**
00036  * Write a formatted string to a buffer
00037  *
00038  * @v wbuf              Buffer into which to write the string
00039  * @v fmt               Format string
00040  * @v ...               Arguments corresponding to the format string
00041  * @ret wlen            Length of formatted string (in wide characters)
00042  */
00043 #define efi_sprintf( buf, fmt, ... ) \
00044         efi_snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ )
00045 
00046 #endif /* _IPXE_EFI_STRINGS_H */