Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: xively-jumpstart-demo
xi_printf.c
00001 // Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved. 00002 // This is part of Xively C library, it is under the BSD 3-Clause license. 00003 00004 /** 00005 * \file xi_printf.c 00006 * \author Olgierd Humenczuk 00007 * \brief Our custom `printf()` hook [see xi_printf.h] 00008 */ 00009 00010 #include <stdarg.h> 00011 #include <stdio.h> 00012 00013 #include "xi_printf.h" 00014 #include "xi_consts.h" 00015 00016 #ifdef __cplusplus 00017 extern "C" { 00018 #endif 00019 00020 user_print_t USER_PRINT = 0; 00021 00022 int xi_printf( const char *fmt, ... ) 00023 { 00024 char buffer[ XI_PRINTF_BUFFER_SIZE ]; 00025 int n = 0; 00026 00027 va_list ap; 00028 va_start( ap, fmt ); 00029 vsnprintf( buffer, XI_PRINTF_BUFFER_SIZE, fmt, ap ); 00030 va_end( ap ); 00031 00032 00033 if( USER_PRINT ) 00034 { 00035 USER_PRINT( buffer ); 00036 } 00037 else 00038 { 00039 printf( "%s", buffer ); 00040 } 00041 00042 return n; 00043 } 00044 00045 #ifdef __cplusplus 00046 } 00047 #endif
Generated on Wed Jul 13 2022 17:00:32 by
1.7.2