repo.or.cz
/
glibc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix endless loop with invalid /etc/shells file.
[glibc.git]
/
manual
/
examples
/
dir2.c
blob
a75c8857427623fb9467e2053a847ad63fc3ed68
1
/*@group*/
2
#include <stdio.h>
3
#include <dirent.h>
4
/*@end group*/
5
6
static int
7
one
(
const struct
dirent
*
unused
)
8
{
9
return
1
;
10
}
11
12
int
13
main
(
void
)
14
{
15
struct
dirent
**
eps
;
16
int
n
;
17
18
n
=
scandir
(
"./"
, &
eps
,
one
,
alphasort
);
19
if
(
n
>=
0
)
20
{
21
int
cnt
;
22
for
(
cnt
=
0
;
cnt
<
n
; ++
cnt
)
23
puts
(
eps
[
cnt
]->
d_name
);
24
}
25
else
26
perror
(
"Couldn't open the directory"
);
27
28
return
0
;
29
}