Iterate through the options in the manifest response, and add them * to the plugin and the command line options */
| 996 | /* Iterate through the options in the manifest response, and add them |
| 997 | * to the plugin and the command line options */ |
| 998 | static const char *plugin_opts_add(struct plugin *plugin, |
| 999 | const char *buffer, |
| 1000 | const jsmntok_t *resulttok) |
| 1001 | { |
| 1002 | const jsmntok_t *options = json_get_member(buffer, resulttok, "options"); |
| 1003 | |
| 1004 | if (!options) { |
| 1005 | return tal_fmt(plugin, |
| 1006 | "\"result.options\" was not found in the manifest"); |
| 1007 | } |
| 1008 | |
| 1009 | if (options->type != JSMN_ARRAY) { |
| 1010 | return tal_fmt(plugin, "\"result.options\" is not an array"); |
| 1011 | } |
| 1012 | |
| 1013 | for (size_t i = 0; i < options->size; i++) { |
| 1014 | const char *err; |
| 1015 | err = plugin_opt_add(plugin, buffer, json_get_arr(options, i)); |
| 1016 | if (err) |
| 1017 | return err; |
| 1018 | } |
| 1019 | |
| 1020 | return NULL; |
| 1021 | } |
| 1022 | |
| 1023 | static void json_stream_forward_change_id(struct json_stream *stream, |
| 1024 | const char *buffer, |
no test coverage detected