daemon: dev-output command.

Useful for controlling conversations between two nodes, by
blocking one's output.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-05-26 15:25:24 +09:30
parent 97bc4ed0cb
commit b9d4f7c0ab
7 changed files with 79 additions and 4 deletions

View File

@@ -114,6 +114,23 @@ bool json_tok_is_null(const char *buffer, const jsmntok_t *tok)
return buffer[tok->start] == 'n';
}
bool json_tok_bool(const char *buffer, const jsmntok_t *tok, bool *b)
{
if (tok->type != JSMN_PRIMITIVE)
return false;
if (tok->end - tok->start == strlen("true")
&& memcmp(buffer + tok->start, "true", strlen("true")) == 0) {
*b = true;
return true;
}
if (tok->end - tok->start == strlen("false")
&& memcmp(buffer + tok->start, "false", strlen("false")) == 0) {
*b = false;
return true;
}
return false;
}
const jsmntok_t *json_next(const jsmntok_t *tok)
{
const jsmntok_t *t;