wendy

watch files or directory and run commands on any event
git clone git://z3bra.org/wendy
Log | Files | Refs | README | LICENSE

commit be93ac0426a2fedea1121fdc094cb6e1506e5d9c
parent 586f632bf3e8d3e7155542e56cfc6c28e7d2ece1
Author: z3bra <willyatmailoodotorg>
Date:   Sun Jan 31 20:02:06 2016

Remove del_node() function for simplicity sake

Diffstat:
 LICENSE |  2 +-
 wendy.c | 22 ++--------------------
 2 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2016 Willy Goiffon <willyatmailoodotorg> +Copyright (c) 2013-2016 Willy Goiffon <willyatmailoodotorg> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/wendy.c b/wendy.c @@ -130,22 +130,6 @@ add_node(int wd, const char *path) return n; } -int -del_node(int wd) -{ - struct node_t *n, *p; - p = n = head; - while (n && n->wd != wd) { - p = n; - n = n->next; - } - - p->next = n->next; - free(n); - nb--; - return 0; -} - const char * wd_path(int wd) { @@ -250,12 +234,10 @@ main (int argc, char **argv) * when there is no more files to watch. */ if (ev->mask & IN_IGNORED) { - del_node(ev->wd); + nb--; if (watch_node(fd, EVENT_PATH(ev), mask) < 0 && verbose) fprintf(stderr, "%s: watch removed\n", EVENT_PATH(ev)); - } - - if (verbose) { + } else if (verbose) { printf("%u\t%s\n", ev->mask, EVENT_PATH(ev)); fflush(stdout); }