repo.or.cz
/
beagle.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
QueryResponses.cs, DumpIndex.cs, IQueryResult.cs, QueryExecutor.cs, QueryResult.cs...
[beagle.git]
/
glue
/
beagled-utils.c
blob
39a8939826fb70787a380f2c873defd89713df4f
1
#include <unistd.h>
2
#include <dirent.h>
3
#include <string.h>
4
5
int
6
beagled_utils_readdir
(
void
*
dir
,
char
*
name
,
int
max_len
)
7
{
8
struct
dirent
*
entry
=
readdir
((
DIR
*)
dir
);
9
10
if
(
entry
==
NULL
) {
11
if
(
max_len
>
0
)
12
*
name
=
'\0'
;
13
return
-
1
;
14
}
15
16
strncpy
(
name
,
entry
->
d_name
,
max_len
);
17
return
0
;
18
}