diff options
author | Christian Pointner <equinox@helsinki.at> | 2009-11-20 12:59:11 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2009-11-20 12:59:11 (GMT) |
commit | 652804347208838a90ac7b6b249bdce4f89c4f32 (patch) | |
tree | 10cb6d42b0875424fbc8c748d55c4fb75b345f38 | |
parent | 440f0502990098326b2d8e4935da35809a0532a8 (diff) |
added status command
-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); |