-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.c
More file actions
44 lines (37 loc) · 1.07 KB
/
example.c
File metadata and controls
44 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "fscrawler-common.h"
int
filter (struct stat *buf)
{
/*NOTE: It is just dummy, as it is job of consumer to provide this
* callback. It just decides whether to include this file or
* not based on stat data.
**/
return 1;
}
/* call_back routine:
* The call_back function is called for every x number of entries
* found during crawling where x is variable passed as argument.
*/
void
call_back (struct xdirent *entries, int count)
{
static int call_count = 0;
int i = 0;
call_count++;
/* printf ("*******CALL COUNT: %d ***********\n", call_count); */
for (i=0; i<count; i++) {
if (DEBUG)
printf ("Inode num: %lu -> ", entries[i].xd_ino);
printf ("%s\n", entries[i].xd_name);
}
free (entries);
return;
}
int
main (int argc, char *argv[])
{
struct options opt = {0,};
opt.thread_count = 2;
opt.buffer_len = 200;
return fscrawl (argv[1], &filter, &call_back, &opt);
}