library/src/filesystem/BP-FilesystemRegistry.cc
// display directory entry (recurses)
display directory entry (recurses)
display directory entry ( recurses )
BP_ERROR_T BP_FSRegDisplayFilesDirectory
(
		P_BP_FSREG                  fs_reg,
		P_BP_HASH_TABLE_KEYED_ENTRY dir,
		BP_BOOL                     recurse,
		size_t                      tab_depth
)
{
	P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL;
	P_BP_HASH_TABLE_KEYED_ENTRY tmp   = NULL;
	size_t display_tab_depth = tab_depth;
	display_tab_depth++;
	size_t display_tab_n = 0;
	P_BP_HASH_TABLE_KEYED_ENTRY dir_recurse = (P_BP_HASH_TABLE_KEYED_ENTRY) dir->data;
	HASH_ITER(hh, dir_recurse, entry, tmp)
	{
		if(entry->type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		{
			BP_FSRegDisplayFilesDirectory
			(
				fs_reg,
				entry,
				recurse,
				display_tab_depth
			);
		}
		else
		{
			BP_FSRegDisplayFilesEntry
			(
				fs_reg,
				entry,
				BP_TRUE,
				BP_TRUE,
				BP_TRUE,
				display_tab_depth
			);
		}
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_FSRegDisplayFilesDirectory ( P_BP_FSREG fs_reg , P_BP_HASH_TABLE_KEYED_ENTRY dir , BP_BOOL recurse , size_t tab_depth ) { P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp = NULL ; size_t display_tab_depth = tab_depth ; display_tab_depth ++ ; size_t display_tab_n = 0 ; P_BP_HASH_TABLE_KEYED_ENTRY dir_recurse = ( P_BP_HASH_TABLE_KEYED_ENTRY ) dir -> data ; HASH_ITER ( hh , dir_recurse , entry , tmp ) { if ( entry -> type == BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) { BP_FSRegDisplayFilesDirectory ( fs_reg , entry , recurse , display_tab_depth ) ; } else { BP_FSRegDisplayFilesEntry ( fs_reg , entry , BP_TRUE , BP_TRUE , BP_TRUE , display_tab_depth ) ; } } return ERR_SUCCESS ; }
display directory entry (recurses)
display directory entry ( recurses )
// temporary iterator values used during the HASH_ITER loop below // increase the display tab depth in case of recursion (keeps // things lined up) // display tab counter // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Display the Directory Header %%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // printf("[DIR] %s", dir->key); // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Recurse if Necessary %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // iterate through all hashes and display // return indicating success