#include <stdarg.h>
Go to the source code of this file.
Functions | |
int | printk (const char *format,...) |
int | printk_va (char **out, const char *format, va_list args) |
int printk | ( | const char * | format, | |
... | ||||
) |
Definition at line 240 of file printf-stdarg.c.
References printk_va().
Referenced by ascii_to_key(), cmd_connect(), cmd_ping(), cmd_power(), cmd_psconf(), cmd_setkey(), cmd_status(), cmd_ttcp(), console_init(), console_schedule_cmd(), fw_download_cb(), gui_dec_scroll_cursor(), gui_del_scroll_box_item(), gui_display_infobox(), gui_inc_scroll_cursor(), gui_scan_cb(), http_accept(), http_recv(), ip_status_cb(), join_argv(), main(), ping_recv(), print_network(), print_network_list(), print_stats(), set_wep_key_cb(), set_wpa_key_cb(), tcp_accept_cb(), tcp_conn_err_cb(), tcp_connect_cb(), tcp_recv_cb(), tcp_send_data(), tcp_start(), tcp_timeout_cb(), ttcp_print_stats(), ttcp_start(), udp_recv_cb(), udp_send_bytes(), udp_start(), wl_cm_conn_cb(), and wl_cm_disconn_cb().
00241 { 00242 va_list args; 00243 00244 va_start( args, format ); 00245 return printk_va( 0, format, args ); 00246 }
int printk_va | ( | char ** | out, | |
const char * | format, | |||
va_list | args | |||
) |
Definition at line 171 of file printf-stdarg.c.
References PAD_RIGHT, PAD_ZERO, printchar(), printi(), prints(), and width.
Referenced by printk(), and sprintf().
00172 { 00173 register int width, pad; 00174 register int pc = 0; 00175 char scr[2]; 00176 00177 for (; *format != 0; ++format) { 00178 if (*format == '%') { 00179 ++format; 00180 width = pad = 0; 00181 if (*format == '\0') break; 00182 if (*format == '%') goto out; 00183 if (*format == '-') { 00184 ++format; 00185 pad = PAD_RIGHT; 00186 } 00187 while (*format == '0') { 00188 ++format; 00189 pad |= PAD_ZERO; 00190 } 00191 for ( ; *format >= '0' && *format <= '9'; ++format) { 00192 width *= 10; 00193 width += *format - '0'; 00194 } 00195 if( *format == 's' ) { 00196 register char *s = (char *)va_arg( args, int ); 00197 pc += prints (out, s?s:"(null)", width, pad); 00198 continue; 00199 } 00200 if( *format == 'd' ) { 00201 pc += printi (out, va_arg( args, int ), 10, 1, width, pad, 'a'); 00202 continue; 00203 } 00204 if( *format == 'p' ) { 00205 pad = 8; 00206 pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a'); 00207 continue; 00208 } 00209 if( *format == 'x' ) { 00210 pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'a'); 00211 continue; 00212 } 00213 if( *format == 'X' ) { 00214 pc += printi (out, va_arg( args, int ), 16, 0, width, pad, 'A'); 00215 continue; 00216 } 00217 if( *format == 'u' ) { 00218 pc += printi (out, va_arg( args, int ), 10, 0, width, pad, 'a'); 00219 continue; 00220 } 00221 if( *format == 'c' ) { 00222 /* char are converted to int then pushed on the stack */ 00223 scr[0] = (char)va_arg( args, int ); 00224 scr[1] = '\0'; 00225 pc += prints (out, scr, width, pad); 00226 continue; 00227 } 00228 } 00229 else { 00230 out: 00231 printchar (out, *format); 00232 ++pc; 00233 } 00234 } 00235 if (out) **out = '\0'; 00236 va_end( args ); 00237 return pc; 00238 }