From 23fbfdade60daf4b88cec374ccd4532d8c87324b Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 21 Sep 2012 12:15:18 +0000 Subject: prefix based plugin lookup for peerinfo tool --- src/peerinfo-tool/gnunet-peerinfo_plugins.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/peerinfo-tool/gnunet-peerinfo_plugins.c') diff --git a/src/peerinfo-tool/gnunet-peerinfo_plugins.c b/src/peerinfo-tool/gnunet-peerinfo_plugins.c index ba7c1d392..3bca9feb2 100644 --- a/src/peerinfo-tool/gnunet-peerinfo_plugins.c +++ b/src/peerinfo-tool/gnunet-peerinfo_plugins.c @@ -167,8 +167,18 @@ GPI_plugins_find (const char *name) { struct TransportPlugin *head = plugins_head; - while ((head != NULL) && (0 != strcmp (name, head->short_name))) + char *stripped = GNUNET_strdup (name); + char *sep = strchr (stripped, '_'); + if (NULL != sep) + sep[0] = '\0'; + + while (head != NULL) + { + if (head->short_name == strstr (head->short_name, stripped)) + break; head = head->next; + } + GNUNET_free (stripped); if (NULL == head) return NULL; return head->api; -- cgit v1.2.3