Archived
1
0
Fork 0

Initial commit

This commit is contained in:
Henrik Hautakoski 2010-04-20 20:38:50 +02:00 committed by Henrik Hautakoski
commit fdfefe7d55
31 changed files with 3242 additions and 0 deletions

31
test/raw_inotify.c Normal file
View file

@ -0,0 +1,31 @@
#include <stdio.h>
#include <string.h>
#include <inotifytools/inotifytools.h>
#include <inotifytools/inotify.h>
// (IN_MOVE | IN_CREATE | IN_DELETE | IN_ONLYDIR)
#define WMASK (IN_MOVE | IN_MOVE_SELF | IN_CREATE | IN_DELETE | IN_ONLYDIR)
int main(int argc, char **argv) {
struct inotify_event *ev;
if (argc < 2)
return 1;
if ( !inotifytools_initialize()
|| !inotifytools_watch_recursively(argv[1], WMASK) ) {
fprintf(stderr, "%s\n", strerror(inotifytools_error()) );
return 1;
}
for(;;) {
ev = inotifytools_next_event(-1);
printf("%u: ", ev->wd);
inotifytools_printf(ev, "%w:%f %e\n");
}
return 0;
}