librnr/examples/example_config.c
static void CmdFind(int argc, char *argv[])
{
  char          *sPat;
  size_t         lenPat;
  ConfigIter_T  *pIterSects;
  ConfigIter_T  *pIterKeys;
  const char    *sSectionName;
  const char    *sKey;
  const char    *sVal;

  CHKARGS(argc, 1);
  CHKCFG();

  sPat    = argv[1];
  lenPat  = strlen(sPat);

  pIterSects = ConfigDbIterNew(TheConfig);

  while( (sSectionName = ConfigIterNext(pIterSects)) != NULL )
  {
    pIterKeys = ConfigSectionIterNew(TheConfig, sSectionName);

    while( (sKey = ConfigIterNext(pIterKeys)) != NULL )
    {
      if( !strncmp(sPat, sKey, lenPat) )
      {
        sVal = ConfigGetStr(TheConfig, sSectionName, sKey);
        printf("%s: [%s]: %s=%s\n",
          ConfigDbGetName(TheConfig), sSectionName, sKey, sVal);
      }
    }

    ConfigIterDelete(pIterKeys);
  }

  ConfigIterDelete(pIterSects);
}
/*!
 * \brief Find configuration key=values matching substring.
 *
 * \param argc    Command argument count.
 * \param argv    Array of arguments.
 */
\brief Find configuration key=values matching substring.
\param argc    Command argument count.
\param argv    Array of arguments.
\ brief Find configuration key = values matching substring . \ param argc Command argument count . \ param argv Array of arguments .
static void CmdFind(int argc, char *argv[])
{
  char          *sPat;
  size_t         lenPat;
  ConfigIter_T  *pIterSects;
  ConfigIter_T  *pIterKeys;
  const char    *sSectionName;
  const char    *sKey;
  const char    *sVal;
  CHKARGS(argc, 1);
  CHKCFG();
  sPat    = argv[1];
  lenPat  = strlen(sPat);
  pIterSects = ConfigDbIterNew(TheConfig);
  while( (sSectionName = ConfigIterNext(pIterSects)) != NULL )
  {
    pIterKeys = ConfigSectionIterNew(TheConfig, sSectionName);
    while( (sKey = ConfigIterNext(pIterKeys)) != NULL )
    {
      if( !strncmp(sPat, sKey, lenPat) )
      {
        sVal = ConfigGetStr(TheConfig, sSectionName, sKey);
        printf("%s: [%s]: %s=%s\n",
          ConfigDbGetName(TheConfig), sSectionName, sKey, sVal);
      }
    }
    ConfigIterDelete(pIterKeys);
  }
  ConfigIterDelete(pIterSects);
}
static void CmdFind ( int argc , char * argv [ ] ) { char * sPat ; size_t lenPat ; ConfigIter_T * pIterSects ; ConfigIter_T * pIterKeys ; const char * sSectionName ; const char * sKey ; const char * sVal ; CHKARGS ( argc , 1 ) ; CHKCFG ( ) ; sPat = argv [ 1 ] ; lenPat = strlen ( sPat ) ; pIterSects = ConfigDbIterNew ( TheConfig ) ; while ( ( sSectionName = ConfigIterNext ( pIterSects ) ) != NULL ) { pIterKeys = ConfigSectionIterNew ( TheConfig , sSectionName ) ; while ( ( sKey = ConfigIterNext ( pIterKeys ) ) != NULL ) { if ( ! strncmp ( sPat , sKey , lenPat ) ) { sVal = ConfigGetStr ( TheConfig , sSectionName , sKey ) ; printf ( " \n " , ConfigDbGetName ( TheConfig ) , sSectionName , sKey , sVal ) ; } } ConfigIterDelete ( pIterKeys ) ; } ConfigIterDelete ( pIterSects ) ; }
\brief Find configuration key=values matching substring.
\ brief Find configuration key = values matching substring .