Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
archived/test/t_inotify.c
2010-10-19 11:25:24 +02:00

40 lines
678 B
C

#include <stdio.h>
#include "../src/notify.h"
PROT_SCAN_CALLBACK(my_callback) {
//printf("FROM THREAD -- path: %s; is_dir = %i\n", path, dir);
}
int main(int argc, char *argv[]) {
notify_event *event;
if (argc < 2)
return 1;
notify_init();
if (!notify_add_watch(argv[1]))
return 1;
printf("begin watching on: %s\n", argv[1]);
for (;;) {
event = notify_read(3);
if (event == NULL)
continue;
printf("====================\n"
"Type: %s\n"
"Path: %s\n"
"Filename: %s\n"
"Directory: %u\n"
"====================\n"
, notify_event_typetostr(event), event->path, event->filename, event->dir);
}
return 0;
}