/* dir-listing.c: * **************************************************************** * Copyright (C) 2003 Tom Lord * * See the file "COPYING" for further information about * the copyright and warranty status of this work. */ #include "hackerlab/vu/safe.h" #include "libfsutils/dir-listing.h" rel_table directory_files (t_uchar const * const path) { rel_table answer; DIR * dir; char * file; answer = 0; safe_opendir (&dir, path); while (!safe_readdir (&file, dir)) { rel_add_records (&answer, rel_make_record (file, 0), 0); lim_free (0, file); } safe_closedir (dir); return answer; } rel_table maybe_directory_files (t_uchar const * const path) { int errn; rel_table answer; DIR * dir; char * file; answer = 0; if (!vu_opendir (&errn, &dir, path)) { while (!safe_readdir (&file, dir)) { rel_add_records (&answer, rel_make_record (file, 0), 0); lim_free (0, file); } safe_closedir (dir); } return answer; } /* tag: Tom Lord Tue May 13 09:13:46 2003 (dir-listing.c) */