Archived
1
0
Fork 0

notify/fscrawl: fixed up src/notify/tree, ADT, new API, new name.

This commit is contained in:
Henrik Hautakoski 2010-09-30 23:04:11 +02:00
parent 9fbe9cfc23
commit 8d7b4a74c7
8 changed files with 260 additions and 277 deletions

View file

@ -3,7 +3,7 @@ CC=gcc
CFLAGS=-g -D__DEBUG__
LDFLAGS=-L/usr/lib64/mysql -lmysqlclient
all : raw_inotify strbuf path rbtree inotify tree mysql stdout queue
all : raw_inotify strbuf path rbtree inotify fscrawl mysql stdout queue
raw_inotify :
$(CC) -linotifytools t_raw_inotify.c -o test_raw_inotify
@ -39,19 +39,19 @@ inotify :
../src/common/strbuf.c \
../src/common/path.c \
../src/notify/event.c \
../src/notify/tree.c \
../src/notify/fscrawl.c \
../src/notify/queue.c \
../src/notify/inotify.c \
t_inotify.c -o test_inotify
tree :
fscrawl :
$(CC) $(CFLAGS) \
../src/common/path.c \
../src/notify/tree.c \
../src/notify/fscrawl.c \
../src/common/xalloc.c \
../src/common/die.c \
../src/common/strbuf.c \
t_tree.c -o test_tree
t_fscrawl.c -o test_fscrawl
mysql :
$(CC) -D DB_DEBUG $(CFLAGS) $(LDFLAGS) \

40
test/t_fscrawl.c Normal file
View file

@ -0,0 +1,40 @@
#include <stdio.h>
#include "../src/notify/fscrawl.h"
int main(int argc, char *argv[]) {
fscrawl_t crawl;
unsigned int c_ent = 0;
if (argc < 2)
return 1;
crawl = fsc_open(argv[1]);
if (crawl == NULL) {
printf("Invalid path\n");
return 1;
}
for(;;) {
fs_entry *ent = fsc_read(crawl);
if (!ent)
break;
printf("%s%s", ent->base, ent->name);
if (ent->dir)
printf("/\n");
else
printf("\n");
c_ent++;
}
printf("%i Entries\n", c_ent);
return 0;
}

View file

@ -1,36 +0,0 @@
#include <stdio.h>
#include "../src/notify/tree.h"
int main(int argc, char *argv[]) {
struct entry *ent;
struct tree *tree;
unsigned int c_ent = 0;
if (argc < 2)
return 1;
tree = tree_new(argv[1]);
if (tree == NULL) {
printf("error\n");
return 1;
}
for(;;) {
ent = tree_next_ent(tree);
if (ent == NULL)
break;
printf("%s%s\n", ent->base, ent->name);
c_ent++;
}
printf("%i Entries\n", c_ent);
return 0;
}