| 859 | } |
| 860 | |
| 861 | char *plugin_opt_set(const char *arg, struct plugin_opt *popt) |
| 862 | { |
| 863 | struct plugin_opt_value *v; |
| 864 | |
| 865 | /* Warn them that this is deprecated */ |
| 866 | if (popt->deprecated && !deprecated_apis) |
| 867 | return tal_fmt(tmpctx, "deprecated option (will be removed!)"); |
| 868 | |
| 869 | if (!popt->multi) { |
| 870 | tal_free(popt->values); |
| 871 | popt->values = tal_arr(popt, struct plugin_opt_value *, 0); |
| 872 | } |
| 873 | |
| 874 | v = plugin_opt_value(popt->values, popt->type, arg); |
| 875 | if (!v) |
| 876 | return tal_fmt(tmpctx, "%s does not parse as type %s", |
| 877 | arg, popt->type); |
| 878 | tal_arr_expand(&popt->values, v); |
| 879 | |
| 880 | return NULL; |
| 881 | } |
| 882 | |
| 883 | /* Returns true if "name" was already registered and now overwritten. */ |
| 884 | static bool plugin_opt_register(struct plugin_opt *popt) |
no test coverage detected