summaryrefslogtreecommitdiff
path: root/watch_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'watch_list.c')
-rw-r--r--watch_list.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/watch_list.c b/watch_list.c
index 1f5089d..81b850f 100644
--- a/watch_list.c
+++ b/watch_list.c
@@ -88,6 +88,36 @@ int watch_list_add(watch_list_t* list, int watch_fd, const char* string)
return 0;
}
+char* watch_list_find_path(watch_list_t* list, int watch_fd)
+{
+ if(!list)
+ return NULL;
+
+ watch_list_element_t* tmp = list->first_;
+ while(tmp) {
+ if(tmp->watch_fd_ == watch_fd)
+ return tmp->path_;
+ tmp = tmp->next_;
+ }
+
+ return NULL;
+}
+
+int watch_list_find_fd(watch_list_t* list, const char* path)
+{
+ if(!list || !path)
+ return -1;
+
+ watch_list_element_t* tmp = list->first_;
+ while(tmp) {
+ if(tmp->path && !strcmp(path, tmp->path))
+ return tmp->path_;
+ tmp = tmp->next_;
+ }
+
+ return -1;
+}
+
void watch_list_print(watch_list_t* list, const char* head, const char* sep, const char* tail)
{
if(!list)