Directory/RB_Get_RB_SingleFileDirectory [ Functions ]
NAME
RB_Get_RB_SingleFileDirectory -- get a RB_Directory structure
SYNOPSIS
struct RB_Directory *RB_Get_RB_SingleFileDirectory( char *arg_fullpath )
FUNCTION
Returns a RB_Directory structure to the give directory, specified by the path that contains only a single file. This is used for the --singlefile option.
INPUT
- filename -- a filename. This may include the path.
RESULT
a freshly allocated RB_Directory that contains only a single file.
SOURCE
{ struct RB_Directory *rb_directory; struct RB_Path *path; char *pathname = NULL; char *filename = NULL; assert( arg_fullpath ); pathname = RB_Get_PathName( arg_fullpath ); filename = RB_Get_FileName( arg_fullpath ); if ( pathname ) { path = RB_Get_RB_Path( pathname ); } else { /* no directory was specified so we use * the current directory */ path = RB_Get_RB_Path( "./" ); } rb_directory = ( struct RB_Directory * ) malloc( sizeof( struct RB_Directory ) ); rb_directory->first = 0; rb_directory->last = 0; rb_directory->first_path = path; RB_Directory_Insert_RB_Filename( rb_directory, RB_Get_RB_Filename( filename, path ) ); return rb_directory; }