botsense/libbotsense/bsLibUtils.c
void bsLogAsciiBuf(const char *sBufName, byte_t buf[], size_t uCount)
{
  FILE   *fp;   // log file pointer
  size_t  i;    // working index

  fp = LOG_GET_LOGFP();

  fprintf(fp, "%sDiag%d: %s=", LOG_PREFACE, LOG_GET_THRESHOLD()-1, sBufName);
  for(i=0; i<uCount; ++i)
  {
    if( isprint(buf[i]) || isspace(buf[i]) )
    {
      switch(buf[i])
      {
        case '\f':
          fprintf(fp, "\\f");
          break;
        case '\n':
          fprintf(fp, "\\n");
          break;
        case '\r':
          fprintf(fp, "\\r");
          break;
        case '\t':
          fprintf(fp, "\\t");
          break;
        case '\v':
          fprintf(fp, "\\v");
          break;
        default:
          fprintf(fp, "%c", buf[i]);
          break;
      }
    }
    else
    {
      fprintf(fp, "\\x%02x", buf[i]);
    }
  }
  fprintf(fp, "\n");
}
/*! 
 * \brief Log ascii data bytes.
 *
 * Print diagnostic logging of the contents of a buffer of ASCII bytes.
 *
 * \param sBufName  Name of buffer.
 * \param buf       Buffer.
 * \param uCount    Number of bytes to log.
 */
\brief Log ascii data bytes.
Print diagnostic logging of the contents of a buffer of ASCII bytes.

\param sBufName  Name of buffer.
\param buf       Buffer.
\param uCount    Number of bytes to log.
\ brief Log ascii data bytes . Print diagnostic logging of the contents of a buffer of ASCII bytes . \ param sBufName Name of buffer . \ param buf Buffer . \ param uCount Number of bytes to log .
void bsLogAsciiBuf(const char *sBufName, byte_t buf[], size_t uCount)
{
  FILE   *fp;   
  size_t  i;    
  fp = LOG_GET_LOGFP();
  fprintf(fp, "%sDiag%d: %s=", LOG_PREFACE, LOG_GET_THRESHOLD()-1, sBufName);
  for(i=0; i<uCount; ++i)
  {
    if( isprint(buf[i]) || isspace(buf[i]) )
    {
      switch(buf[i])
      {
        case '\f':
          fprintf(fp, "\\f");
          break;
        case '\n':
          fprintf(fp, "\\n");
          break;
        case '\r':
          fprintf(fp, "\\r");
          break;
        case '\t':
          fprintf(fp, "\\t");
          break;
        case '\v':
          fprintf(fp, "\\v");
          break;
        default:
          fprintf(fp, "%c", buf[i]);
          break;
      }
    }
    else
    {
      fprintf(fp, "\\x%02x", buf[i]);
    }
  }
  fprintf(fp, "\n");
}
void bsLogAsciiBuf ( const char * sBufName , byte_t buf [ ] , size_t uCount ) { FILE * fp ; size_t i ; fp = LOG_GET_LOGFP ( ) ; fprintf ( fp , " " , LOG_PREFACE , LOG_GET_THRESHOLD ( ) - 1 , sBufName ) ; for ( i = 0 ; i < uCount ; ++ i ) { if ( isprint ( buf [ i ] ) || isspace ( buf [ i ] ) ) { switch ( buf [ i ] ) { case ' \f ' : fprintf ( fp , " \\ " ) ; break ; case ' \n ' : fprintf ( fp , " \\ " ) ; break ; case ' \r ' : fprintf ( fp , " \\ " ) ; break ; case ' \t ' : fprintf ( fp , " \\ " ) ; break ; case ' \v ' : fprintf ( fp , " \\ " ) ; break ; default : fprintf ( fp , " " , buf [ i ] ) ; break ; } } else { fprintf ( fp , " \\ " , buf [ i ] ) ; } } fprintf ( fp , " \n " ) ; }
\brief Log ascii data bytes.
\ brief Log ascii data bytes .
// log file pointer // working index