Our normal frameworks don't (yet?) support custom post-manifest responses, * so this is open-coded */
| 10 | /* Our normal frameworks don't (yet?) support custom post-manifest responses, |
| 11 | * so this is open-coded */ |
| 12 | int main(int argc, char *argv[]) |
| 13 | { |
| 14 | char *buf; |
| 15 | int r, off; |
| 16 | const jsmntok_t *toks, *id; |
| 17 | |
| 18 | common_setup(argv[0]); |
| 19 | |
| 20 | buf = tal_arr(tmpctx, char, 100); |
| 21 | off = 0; |
| 22 | do { |
| 23 | r = read(STDIN_FILENO, buf + off, tal_bytelen(buf) - off); |
| 24 | if (r < 0) |
| 25 | err(1, "reading stdin"); |
| 26 | off += r; |
| 27 | if (off == tal_bytelen(buf)) |
| 28 | tal_resize(&buf, off * 2); |
| 29 | |
| 30 | toks = json_parse_simple(tmpctx, buf, off); |
| 31 | } while (!toks); |
| 32 | |
| 33 | /* Tell it we're disabled (reusing id). */ |
| 34 | id = json_get_member(buf, toks, "id"); |
| 35 | buf = tal_fmt(tmpctx, "{\"jsonrpc\":\"2.0\",\"id\":%.*s,\"result\":{\"disable\":\"Self-disable test after getmanifest\"} }", |
| 36 | json_tok_full_len(id), |
| 37 | json_tok_full(buf, id)); |
| 38 | write_all(STDOUT_FILENO, buf, strlen(buf)); |
| 39 | |
| 40 | common_shutdown(); |
| 41 | return 0; |
| 42 | } |
nothing calls this directly
no test coverage detected