Xively C library
Dependents: Application-xively-jumpstart-demo Application-xively-jumpstart-demo Modified_Xively_Jumpstart HW7-1_Xively_Thermostat
This is Xively C library, the code lives on GitHub.
See our example program and the tutorial, documentation can bee found here.
src/libxively/xi_printf.c
- Committer:
- xively
- Date:
- 2013-06-26
- Revision:
- 0:82702e998d3f
File content as of revision 0:82702e998d3f:
// Copyright (c) 2003-2013, LogMeIn, Inc. All rights reserved. // This is part of Xively C library, it is under the BSD 3-Clause license. /** * \file xi_printf.c * \author Olgierd Humenczuk * \brief Our custom `printf()` hook [see xi_printf.h] */ #include <stdarg.h> #include <stdio.h> #include "xi_printf.h" #include "xi_consts.h" #ifdef __cplusplus extern "C" { #endif user_print_t USER_PRINT = 0; int xi_printf( const char *fmt, ... ) { char buffer[ XI_PRINTF_BUFFER_SIZE ]; int n = 0; va_list ap; va_start( ap, fmt ); vsnprintf( buffer, XI_PRINTF_BUFFER_SIZE, fmt, ap ); va_end( ap ); if( USER_PRINT ) { USER_PRINT( buffer ); } else { printf( "%s", buffer ); } return n; } #ifdef __cplusplus } #endif