Exemplo n.º 1
0
const char*
dirScanner_next( DirScanner*  s )
{
    char*  ret = NULL;

    if (!s || s->dir == NULL)
        return NULL;

    for (;;)
    {
        /* read new entry if needed */
        s->entry = readdir(s->dir);
        if (s->entry == NULL) {
            _dirScanner_done(s);
            break;
        }

        /* ignore special directories */
        ret = s->entry->d_name;

        if (!strcmp(ret,".") || !strcmp(ret,"..")) {
            ret = NULL;
            continue;
        }
        break;
    }
    return ret;
}
Exemplo n.º 2
0
const char*
dirScanner_next( DirScanner*  s )
{
    char*  ret = NULL;

    if (!s || s->dir == NULL)
        return NULL;

    for (;;)
    {
        
        s->entry = readdir(s->dir);
        if (s->entry == NULL) {
            _dirScanner_done(s);
            break;
        }

        
        ret = s->entry->d_name;

        if (!strcmp(ret,".") || !strcmp(ret,"..")) {
            ret = NULL;
            continue;
        }
        break;
    }
    return ret;
}
Exemplo n.º 3
0
void
dirScanner_free( DirScanner*  s )
{
    if (!s)
        return;

    _dirScanner_done(s);
    AFREE(s);
}
Exemplo n.º 4
0
const char*
dirScanner_next( DirScanner*  s )
{
    char*  ret = NULL;

    if (!s || s->findIndex1 <= 0)
        return NULL;

    while (ret == NULL) {
        ret = s->findData.name;

        /* ignore special directories */
        if (!strcmp(ret, ".") || !strcmp(ret, "..")) {
            ret = NULL;
        }
        /* find next one */
        if (_findnext(s->findIndex1-1, &s->findData) < 0) {
            _dirScanner_done(s);
            break;
        }
    }
    return ret;
}