Hi!

Andy Wingo <wi...@pobox.com> skribis:

> * module/ice-9/ftw.scm (scandir): Run the select? procedure on all
>   items, including subdirs and the `.' and `..' entries.

Since the goal was to mimic scandir(3), I double-checked:

#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>

int
main ()
{
  int count;
  struct dirent **list;
  count = scandir ("/", &list,
		   ({
		      int filter (const struct dirent *e) { return 0; }
		      filter;
		   }),
		   NULL);
  return count == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
On GNU/Linux, this test succeeds for me, so this change is correct
(yeah I should have checked POSIX instead ;-)).

> Pass it the basename of the file in question instead of the full name.

Makes sense too, since in C ‘struct dirent’ contains just the base name.

Please apply!  :-)

Thanks,
Ludo’.

Reply via email to