[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scandir patch
From: |
Ludovic Courtès |
Subject: |
Re: scandir patch |
Date: |
Mon, 11 Jun 2012 13:52:25 +0200 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.0.93 (gnu/linux) |
Hi!
Andy Wingo <address@hidden> 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’.