librnr/path.c
char *SearchPathIterNext(PathIter_T *pIter)
{
  const char      *sPath;   // search path component
  size_t           nLen;    // string length

  // end of search
  if( pIter->m_bIsEos )
  {
    return NULL;
  }

  // get the next search path component
  else if( (sPath = DListStrIterDataNext(&(pIter->m_iterPaths))) != NULL )
  {
    nLen  = strlen(sPath) + strlen(DIR_SEP_STR) + pIter->m_nFileLen;

    delete(pIter->m_sFilePath);         // clear any old constructed file path
    pIter->m_sFilePath = NEWSTR(nLen);  // allocate new file path
    
    sprintf(pIter->m_sFilePath, "%s%s%s", 
      sPath, DIR_SEP_STR, pIter->m_sFileCanonical);

    LOGDIAG4("'%s'=%s()", pIter->m_sFilePath, LOGFUNCNAME);

    return pIter->m_sFilePath;
  }

  // end of search
  else
  {
    pIter->m_bIsEos = true;
    return NULL;
  }
}
/*!
 * \brief Construct next file path from search path and search file name.
 *
 * \param pIter Path iterator.
 *
 * \return 
 *  Returns next constructed file path on success, NULL if at end of search 
 *  or on error
 */
\brief Construct next file path from search path and search file name.
\param pIter Path iterator.

\return
Returns next constructed file path on success, NULL if at end of search
or on error
\ brief Construct next file path from search path and search file name . \ param pIter Path iterator . \ return Returns next constructed file path on success NULL if at end of search or on error
char *SearchPathIterNext(PathIter_T *pIter)
{
  const char      *sPath;   
  size_t           nLen;    
  if( pIter->m_bIsEos )
  {
    return NULL;
  }
  else if( (sPath = DListStrIterDataNext(&(pIter->m_iterPaths))) != NULL )
  {
    nLen  = strlen(sPath) + strlen(DIR_SEP_STR) + pIter->m_nFileLen;
    delete(pIter->m_sFilePath);         
    pIter->m_sFilePath = NEWSTR(nLen);  
    sprintf(pIter->m_sFilePath, "%s%s%s", 
      sPath, DIR_SEP_STR, pIter->m_sFileCanonical);
    LOGDIAG4("'%s'=%s()", pIter->m_sFilePath, LOGFUNCNAME);
    return pIter->m_sFilePath;
  }
  else
  {
    pIter->m_bIsEos = true;
    return NULL;
  }
}
char * SearchPathIterNext ( PathIter_T * pIter ) { const char * sPath ; size_t nLen ; if ( pIter -> m_bIsEos ) { return NULL ; } else if ( ( sPath = DListStrIterDataNext ( & ( pIter -> m_iterPaths ) ) ) != NULL ) { nLen = strlen ( sPath ) + strlen ( DIR_SEP_STR ) + pIter -> m_nFileLen ; delete ( pIter -> m_sFilePath ) ; pIter -> m_sFilePath = NEWSTR ( nLen ) ; sprintf ( pIter -> m_sFilePath , " " , sPath , DIR_SEP_STR , pIter -> m_sFileCanonical ) ; LOGDIAG4 ( " " , pIter -> m_sFilePath , LOGFUNCNAME ) ; return pIter -> m_sFilePath ; } else { pIter -> m_bIsEos = true ; return NULL ; } }
\brief Construct next file path from search path and search file name.
\ brief Construct next file path from search path and search file name .
// search path component // string length // end of search // get the next search path component // clear any old constructed file path // allocate new file path // end of search