Index: animator/hid_anim.c =================================================================== --- animator/hid_anim.c (revision 4727) +++ animator/hid_anim.c (revision 4728) @@ -1,8 +1,12 @@ +#define _DEFAULT_SOURCE +#define _BSD_SOURCE #include #include #include #include +#define proto_vsnprintf vsnprintf #include "src_plugins/hid_remote/proto_lowcommon.h" +#include "src_plugins/hid_remote/proto_lowsend.h" #include "src_plugins/hid_remote/proto_lowparse.h" #include "cmds_hash.h" @@ -9,30 +13,6 @@ static proto_ctx_t pctx; P_net_socket s_netin, s_netout; -static proto_node_t *child1(proto_node_t *lst) -{ - if (lst->is_list) - return lst->data.l.first_child; - return NULL; -} - -static int is_list(proto_node_t *nd) -{ - return (nd != NULL) && nd->is_list; -} - -static int is_str(proto_node_t *nd) -{ - return (nd != NULL) && !nd->is_list; -} - -static char *str(proto_node_t *nd) -{ - if ((nd != NULL) && !nd->is_list) - return nd->data.s.str; - return NULL; -} - static void cmd_ver(proto_node_t *args) { char *vs = str(child1(args)); @@ -45,6 +25,15 @@ } } +static void cmd_ready(proto_node_t *args) +{ + send_begin(&pctx, "ready"); + send_open(&pctx, 0); + send_close(&pctx); + send_end(&pctx); +} + + static void read_netin(void) { P_size_t len, n; @@ -61,6 +50,7 @@ printf("cmd\n"); switch(cmds_sphash(pctx.pcmd)) { case cmds_ver: cmd_ver(pctx.targ); break; + case cmds_ready: cmd_ready(pctx.targ); break; } proto_node_free(pctx.targ); break;