From 9d9f114f42f5c02a44d31bdf28ee014500582d3d Mon Sep 17 00:00:00 2001 From: Christian Mehlis Date: Wed, 26 Feb 2014 13:55:20 +0100 Subject: [PATCH] shell: adapt register prefix command to new shell api --- examples/ccn-lite-client/main.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/examples/ccn-lite-client/main.c b/examples/ccn-lite-client/main.c index c85261e8911e..6e8a72811e61 100644 --- a/examples/ccn-lite-client/main.c +++ b/examples/ccn-lite-client/main.c @@ -110,34 +110,18 @@ static void riot_ccn_express_interest(int argc, char **argv) puts("done"); } -static void riot_ccn_register_prefix(char *str) +static void riot_ccn_register_prefix(int argc, char **argv) { - char *given_prefix = strtok(str, " "); - given_prefix = strtok(NULL, " "); - static const char *default_prefix = "/ccnx/0.7.1/doc/technical"; - - if (!given_prefix) { - strncpy(small_buf, default_prefix, 100); - } - else { - strncpy(small_buf, given_prefix, 100); - } - - DEBUG("prefix='%s'\n", small_buf); - - char *type = strtok(NULL, " "); - - if (!type) { - puts("enter: prefix /path/to/abc faceid"); + if (argc < 4) { + puts("enter: prefix "); return; } - char *faceid = strtok(NULL, " ");//"2"; // 0=trans;1=msg + strncpy(small_buf, argv[1], 100); + DEBUG("prefix='%s'\n", small_buf); - if (!faceid) { - puts("enter: prefix /path/to/abc faceid"); - return; - } + char *type = argv[2]; + char *faceid = argv[3]; // 0=trans;1=msg int content_len = ccnl_riot_client_publish(relay_pid, small_buf, faceid, type, big_buf);