mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-14 01:00:07 +00:00
dacb975a0d
* manual/examples/dir2.c (one): Add const to argument type. Reported by J de Haan <j.de.haan@home.nl>.
30 lines
392 B
C
30 lines
392 B
C
/*@group*/
|
|
#include <stdio.h>
|
|
#include <dirent.h>
|
|
/*@end group*/
|
|
|
|
static int
|
|
one (const struct dirent *unused)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
struct dirent **eps;
|
|
int n;
|
|
|
|
n = scandir ("./", &eps, one, alphasort);
|
|
if (n >= 0)
|
|
{
|
|
int cnt;
|
|
for (cnt = 0; cnt < n; ++cnt)
|
|
puts (eps[cnt]->d_name);
|
|
}
|
|
else
|
|
perror ("Couldn't open the directory");
|
|
|
|
return 0;
|
|
}
|