#include <stdint.h>#include <stdarg.h>Go to the source code of this file.
Defines | |
| #define | sprintf(buf, fmt,...) snprintf ( (buf), ~( ( size_t ) 0 ), (fmt), ## __VA_ARGS__ ) |
| Write a formatted string to a buffer. | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| int | __attribute__ ((format(printf, 1, 2))) printf(const char *fmt |
| int int | __attribute__ ((format(printf, 3, 4))) snprintf(char *buf |
| int int size_t const char int | __attribute__ ((format(printf, 2, 3))) asprintf(char **strp |
| int int size_t const char int const char int | vprintf (const char *fmt, va_list args) |
| Write a formatted string to the console. | |
| int | vsnprintf (char *buf, size_t size, const char *fmt, va_list args) |
| Write a formatted string to a buffer. | |
| int | vasprintf (char **strp, const char *fmt, va_list args) |
| Write a formatted string to newly allocated memory. | |
| static int | vsprintf (char *buf, const char *fmt, va_list args) |
| Write a formatted string to a buffer. | |
Variables | |
| int int size_t | size |
| int int size_t const char * | fmt |
Write a formatted string to a buffer.
| buf | Buffer into which to write the string | |
| fmt | Format string | |
| ... | Arguments corresponding to the format string |
| len | Length of formatted string |
Definition at line 32 of file stdio.h.
Referenced by eth_ntoa(), imgfill_cmdline(), inet6_ntoa(), inet_ntoa(), isa_id_string(), and uuid_ntoa().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| int __attribute__ | ( | (format(printf, 1, 2)) | ) | const |
| int int __attribute__ | ( | (format(printf, 3, 4)) | ) |
Write a formatted string to the console.
| fmt | Format string | |
| args | Arguments corresponding to the format string |
| len | Length of formatted string |
Definition at line 400 of file vsprintf.c.
References printf_context::handler, printf_putchar(), and vcprintf().
Referenced by printf().
00400 { 00401 struct printf_context ctx; 00402 00403 /* Hand off to vcprintf */ 00404 ctx.handler = printf_putchar; 00405 return vcprintf ( &ctx, fmt, args ); 00406 }
Write a formatted string to a buffer.
| buf | Buffer into which to write the string | |
| size | Size of buffer | |
| fmt | Format string | |
| args | Arguments corresponding to the format string |
| len | Length of formatted string |
Definition at line 302 of file vsprintf.c.
References sputc_context::buf, sputc_context::ctx, printf_context::handler, sputc_context::max_len, printf_sputc(), and vcprintf().
Referenced by snprintf(), vasprintf(), vmsg(), vsprintf(), vssnprintf(), and xfer_vprintf().
00302 { 00303 struct sputc_context sctx; 00304 size_t len; 00305 size_t end; 00306 00307 /* Hand off to vcprintf */ 00308 sctx.ctx.handler = printf_sputc; 00309 sctx.buf = buf; 00310 sctx.max_len = size; 00311 len = vcprintf ( &sctx.ctx, fmt, args ); 00312 00313 /* Add trailing NUL */ 00314 if ( size ) { 00315 end = size - 1; 00316 if ( len < end ) 00317 end = len; 00318 buf[end] = '\0'; 00319 } 00320 00321 return len; 00322 }
| int vasprintf | ( | char ** | strp, | |
| const char * | fmt, | |||
| va_list | args | |||
| ) |
Write a formatted string to newly allocated memory.
| strp | Pointer to hold allocated string | |
| fmt | Format string | |
| args | Arguments corresponding to the format string |
| len | Length of formatted string |
Definition at line 17 of file asprintf.c.
References ENOMEM, malloc(), NULL, va_copy, va_end, and vsnprintf().
Referenced by asprintf().
00017 { 00018 size_t len; 00019 va_list args_tmp; 00020 00021 /* Calculate length needed for string */ 00022 va_copy ( args_tmp, args ); 00023 len = ( vsnprintf ( NULL, 0, fmt, args_tmp ) + 1 ); 00024 va_end ( args_tmp ); 00025 00026 /* Allocate and fill string */ 00027 *strp = malloc ( len ); 00028 if ( ! *strp ) 00029 return -ENOMEM; 00030 return vsnprintf ( *strp, len, fmt, args ); 00031 }
| static int vsprintf | ( | char * | buf, | |
| const char * | fmt, | |||
| va_list | args | |||
| ) | [inline, static] |
Write a formatted string to a buffer.
| buf | Buffer into which to write the string | |
| fmt | Format string | |
| args | Arguments corresponding to the format string |
| len | Length of formatted string |
Definition at line 43 of file stdio.h.
References vsnprintf().
Definition at line 13 of file stdio.h.
Referenced by ath5k_copy_channels(), ath5k_hw_rfgain_init(), atl1e_setup_ring_resources(), e1000_init_nvm_params_82541(), e1000e_init_nvm_params_80003es2lan(), e1000e_init_nvm_params_82571(), ib_srp_parse_byte_string(), igb_init_nvm_params_82575(), meme820(), multiboot_build_memmap(), net80211_rx_frag(), pci_bar_size(), relocate(), RSA_decrypt(), and sky2_rx_start().
1.5.7.1