summaryrefslogtreecommitdiffstats
path: root/nserver/src/ncmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'nserver/src/ncmd.c')
-rw-r--r--nserver/src/ncmd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/nserver/src/ncmd.c b/nserver/src/ncmd.c
index 6b9298c..6b0be37 100644
--- a/nserver/src/ncmd.c
+++ b/nserver/src/ncmd.c
@@ -109,6 +109,7 @@ int find_function(struct bstrList *cmd_parts)
struct tagbstring fdelete = bsStatic("/delete");
struct tagbstring flist = bsStatic("/list");
struct tagbstring fstore = bsStatic("/store");
+ struct tagbstring fload = bsStatic("/load");
check(cmd_parts != NULL, "cmd_parts is NULL");
check(cmd_parts->qty > 0, "qty check failed");
@@ -135,6 +136,8 @@ int find_function(struct bstrList *cmd_parts)
return NS_LIST;
} else if (bstricmp(cmd_name, &fstore) == 0) {
return NS_STORE;
+ } else if (bstricmp(cmd_name, &fload) == 0) {
+ return NS_LOAD;
} else {
return NS_NOP;
}
@@ -291,6 +294,20 @@ int call_function(int func, struct bstrList *cmd_parts, char *out)
}
strncpy(out, "OK\n", RSP_SIZE);
break;
+ case NS_LOAD:
+ if(check_args(cmd_parts, 3) != 0) {
+ strncpy(out, "error: command invalid\n", RSP_SIZE);
+
+ return -1;
+ }
+ if (ssload(bdata(cmd_parts->entry[1]),
+ bdata(cmd_parts->entry[2])) < 0) {
+ strncpy(out, "error: load failed\n", RSP_SIZE);
+
+ return -1;
+ }
+ strncpy(out, "OK\n", RSP_SIZE);
+ break;
default:
strncpy(out, "error: function not found\n", RSP_SIZE);