summaryrefslogtreecommitdiff
path: root/cmd/cmd_stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/cmd_stat.c')
-rw-r--r--cmd/cmd_stat.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/cmd/cmd_stat.c b/cmd/cmd_stat.c
new file mode 100644
index 0000000..ce19085
--- /dev/null
+++ b/cmd/cmd_stat.c
@@ -0,0 +1,55 @@
+#include "cmd_stat.h"
+
+void *cmd_stat(void *data)
+{
+ char *param = (char *)data;
+ char *ret = NULL;
+
+ int i;
+ int count;
+ sds params;
+ sds out_result;
+ sds *tokens;
+
+ const int buf_size = 128;
+ char buf[buf_size+1];
+
+ printf("STAT\n");
+
+ params = sdsnew(param);
+ out_result = sdsempty();
+ tokens = sdssplitargs(params, &count);
+
+ out_result = sdscat(out_result,"+----------+----------+\n");
+ out_result = sdscat(out_result,"| STAT | VAL |\n");
+ out_result = sdscat(out_result,"+----------+----------+\n");
+
+ //cmd_success
+ snprintf(buf,buf_size,"| CMD_SUCC | %08s |\n", tokens[0]);
+ out_result = sdscat(out_result, buf);
+ //cmd_err
+ snprintf(buf,buf_size,"| CMD_ERR | %08s |\n", tokens[1]);
+ out_result = sdscat(out_result, buf);
+ //ipc tx
+ snprintf(buf,buf_size,"| IPC_TX | %08s |\n", tokens[2]);
+ out_result = sdscat(out_result, buf);
+ //ipc rx
+ snprintf(buf,buf_size,"| IPC_RX | %08s |\n", tokens[3]);
+ out_result = sdscat(out_result, buf);
+
+ out_result = sdscat(out_result,"+----------+----------+\n");
+
+ sdsfreesplitres(tokens, count);
+
+
+ //snprintf(buf, buf_size, "%s\n", param);
+
+
+ ret = alloc_new_str(out_result);
+ printf("%s",ret);
+
+ sdsfree(out_result);
+ sdsfree(params);
+
+ return ret;
+}