From ec7b2f6a8a3566b0158d7b2c6573e5cb1ef845b7 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 13 Aug 2006 18:14:06 +0200 Subject: Remove inotify-watchdir.c --- inotify-watchdir.c | 89 ------------------------------------------------------ 1 file changed, 89 deletions(-) delete mode 100644 inotify-watchdir.c diff --git a/inotify-watchdir.c b/inotify-watchdir.c deleted file mode 100644 index f34e03a..0000000 --- a/inotify-watchdir.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * initofy-watchdir.c - * - */ - -#include -#include -#include -#include -#include - -#include "inotify.h" -#include "inotify-syscalls.h" - -static void print_event(int mask) -{ - if (mask & IN_ISDIR) - printf("(dir) "); - else - printf("(file) "); - - if (mask & IN_ACCESS) - printf("ACCESS "); - if (mask & IN_MODIFY) - printf("MODIFY "); - if (mask & IN_ATTRIB) - printf("ATTRIB "); - if (mask & IN_CLOSE) - printf("CLOSE "); - if (mask & IN_OPEN) - printf("OPEN "); - if (mask & IN_MOVED_FROM) - printf("MOVED_FROM "); - if (mask & IN_MOVED_TO) - printf("MOVED_TO "); - if (mask & IN_MOVE_SELF) - printf("MOVE_SELF "); - if (mask & IN_DELETE) - printf("DELETE "); - if (mask & IN_CREATE) - printf("CREATE "); - if (mask & IN_DELETE_SELF) - printf("DELETE_SELF "); - if (mask & IN_UNMOUNT) - printf("UNMOUNT "); - if (mask & IN_Q_OVERFLOW) - printf("Q_OVERFLOW "); - if (mask & IN_IGNORED) - printf("IGNORED " ); - - printf("(0x%08x), ", mask); -} - -int main(int argc, char *argv[]) -{ - int fd, watch, len, ret; - struct inotify_event *inev; - char buf[1000]; - - if (argc != 2) { - printf("Usage: %s \n", argv[0]); - exit(-1); - } - - fd = inotify_init(); - if (fd < 0) - exit(-2); - - watch = inotify_add_watch(fd, argv[1], IN_ALL_EVENTS|IN_UNMOUNT); - - memset(&buf, 0, sizeof(buf)); - - while (1) { - len = read(fd, buf, sizeof(buf)); - inev = (struct inotify_event *) &buf; - while (len > 0) { - printf("wd=%04x, ", inev->wd); - print_event(inev->mask); - printf("cookie=%04x, len=%04x, name=\"%s\"\n", inev->cookie, inev->len, inev->name); - - len -= sizeof(struct inotify_event) + inev->len; - inev = (struct inotify_event *) ((char *) inev + sizeof(struct inotify_event) + inev->len); - } - } - - ret = inotify_rm_watch(fd, watch); - - return ret; -} -- cgit v1.2.3-54-g00ecf