Directory/RB_Get_RB_Directory [ Functions ]

NAME

RB_Get_RB_Directory -- get a RB_Directory structure

FUNCTION

Returns a RB_Directory structure to the give directory, specified by the path. This structure can then be uses to walk through all the files in the directory and it's subdirectories.

SYNOPSIS

struct RB_Directory *RB_Get_RB_Directory(
    char *arg_rootpath_name,
    char *arg_docroot_name )

INPUTS

arg_rootpath -- the name a the directory to get,

                   a nul terminated string.

arg_docroot_name -- the name of the directory the documentation

                       file are stored in.  This directory is
                       skipped while scanning for sourcefiles.
                       It can be NULL.

RESULT

A freshly allocated RB_Directory filled with source files.

SOURCE

{
    struct RB_Directory *rb_directory;
    struct RB_Path     *doc_path = NULL;

    rb_directory =
        ( struct RB_Directory * ) malloc( sizeof( struct RB_Directory ) );
    rb_directory->first = 0;
    rb_directory->last = 0;
    rb_directory->first_path = RB_Get_RB_Path( arg_rootpath_name );

    if ( arg_docroot_name )
    {
        doc_path = RB_Get_RB_Path( arg_docroot_name );
    }

    RB_Fill_Directory( rb_directory, rb_directory->first_path, doc_path );
    if ( ( RB_Number_Of_Filenames( rb_directory ) > 0 ) &&
         ( RB_Number_Of_Paths( rb_directory ) > 0 ) )
    {
        RB_SortDirectory( rb_directory );
    }
    else
    {

        RB_Panic( "No files found! (Or all were filtered out)\n" );
    }
    return rb_directory;
}