No Clock  1.0.2
Debugging

Print debugging information. More...

Functions

int debug (const char *format,...)
 printf(3) when DEBUG is defined. More...
 
bool debug_mode_state (void)
 Determine whether the debug mode has been enabled at compile time. More...
 
int fdebug (FILE *stream, const char *format,...)
 fprintf(3) when DEBUG is defined. More...
 
int sdebug (char *str, const char *format,...)
 sprintf(3) when DEBUG is defined. More...
 
int sndebug (char *str, size_t size, const char *format,...)
 snprintf(3) when DEBUG is defined. More...
 

Detailed Description

Print debugging information.

Since
version 1.0.0

The debugging mode is determined at compilation time. One can inspect its state using debug_mode_state().

When the debugging mode is enabled, the following functions behave as their *printf(3) counterparts:

debug function *printf(3) function
debug() printf(3)
fdebug() fprintf(3)
sdebug() sprintf(3)
sndebug() snprintf(3)

On the other hand, if the debugging mode is disabled, these functions do nothing except returning 0.

Function Documentation

int debug ( const char *  format,
  ... 
)

#include <include/noclock/debug.h>

printf(3) when DEBUG is defined.

Since
version 1.0.0
Parameters
formatThe format string.
Returns
The number of written characters.
Return values
0if DEBUG is not defined
See also
printf(3)
bool debug_mode_state ( void  )

#include <include/noclock/debug.h>

Determine whether the debug mode has been enabled at compile time.

Since
version 1.0.0
Return values
trueif the debug mode is enabled.
falseotherwise.
int fdebug ( FILE *  stream,
const char *  format,
  ... 
)

#include <include/noclock/debug.h>

fprintf(3) when DEBUG is defined.

Since
version 1.0.0
Parameters
streamThe destination stream.
formatThe format string.
Returns
The number of written characters.
Return values
0if DEBUG is not defined
See also
fprintf(3)
int sdebug ( char *  str,
const char *  format,
  ... 
)

#include <include/noclock/debug.h>

sprintf(3) when DEBUG is defined.

Since
version 1.0.0
Parameters
strThe destination string.
formatThe format string.
Returns
The number of written characters.
Return values
0if DEBUG is not defined
See also
sprintf(3)
int sndebug ( char *  str,
size_t  size,
const char *  format,
  ... 
)

#include <include/noclock/debug.h>

snprintf(3) when DEBUG is defined.

Since
version 1.0.0
Parameters
strThe destination string.
sizeThe maximum number of characters to write.
formatThe format string.
Returns
The number of written characters.
Return values
0if DEBUG is not defined
See also
snprintf(3)