src/stdlib/proptbls.c
/*===================================================
 * add_dir_files_to_proplist -- Add all files in dir to list of property tables
 * Created: 2002/10/19, Perry Rapp
 *=================================================*/
- Add all files in dir to list of property tables
Created: 2002/10/19, Perry Rapp
- Add all files in dir to list of property tables Created : 2002 / 10 / 19 Perry Rapp
INT
add_dir_files_to_proplist (CNSTRING dir, SELECT_FNC selectfnc, LIST list)
{
	struct dirent **programs;
	INT n = scandir(dir, &programs, selectfnc, alphasort);
	INT i;
	for (i=0; i<n; ++i) {
		TABLE table = create_table_str();
		set_prop_dnum(table, 1, "filename", programs[i]->d_name);
		set_prop_dnum(table, 2, "dir", dir);
		stdfree(programs[i]);
		programs[i] = NULL;
		enqueue_list(list, table);
	}
	if (n>0)
		stdfree(programs);
	return i;
}
INT add_dir_files_to_proplist ( CNSTRING dir , SELECT_FNC selectfnc , LIST list ) { struct dirent * * programs ; INT n = scandir ( dir , & programs , selectfnc , alphasort ) ; INT i ; for ( i = 0 ; i < n ; ++ i ) { TABLE table = create_table_str ( ) ; set_prop_dnum ( table , 1 , " " , programs [ i ] -> d_name ) ; set_prop_dnum ( table , 2 , " " , dir ) ; stdfree ( programs [ i ] ) ; programs [ i ] = NULL ; enqueue_list ( list , table ) ; } if ( n > 0 ) stdfree ( programs ) ; return i ; }
add_dir_files_to_proplist -- Add all files in dir to list of property tables
 Created: 2002/10/19, Perry Rapp
add_dir_files_to_proplist -- Add all files in dir to list of property tables Created : 2002 / 10 / 19 Perry Rapp