diff options
-rw-r--r-- | rhdropbox.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/rhdropbox.c b/rhdropbox.c index 1fbd56f..bbf4509 100644 --- a/rhdropbox.c +++ b/rhdropbox.c @@ -124,6 +124,24 @@ int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotif return ret; } +void process_cmd_status(int fd, watch_list_t* watch_lst) +{ + if(!watch_lst || !watch_lst->first_) { + send_response(fd, "currently no paths in watch list"); + return; + } + + char buf[100]; + watch_list_element_t* tmp = watch_lst->first_; + while(tmp) { + snprintf(buf, 100, "%3d: %s", tmp->watch_fd_, tmp->path_); + send_response(fd, buf); + tmp = tmp->next_; + } + + return; +} + void process_cmd_listen(const char* param, int fd, client_t* client_lst) { client_t* listener = client_find(client_lst, fd); @@ -211,7 +229,7 @@ int process_cmd(const char* cmd, int fd, int inotify_fd, watch_list_t* watch_lst return ret; break; } - case STATUS: break; + case STATUS: process_cmd_status(fd, watch_lst); break; case LOG: { if(param && param[0]) log_printf(NOTICE, "ext msg: %s", param); |